I'm trying to create part of a web application as a plugin. It's nothing fancy, just a controller or two and a bunch of UI code that uses Angular and Bootstrap. I added the asset pipeline plugin to my plugin and copied over a bunch of common CSS files from another project that's a formal Grails web application (not a plugin like this one). I can verify that the same common files process just fine in that project. When I try to access the CSS files, I get the following error:
2014-09-07 14:52:37,013 [http-bio-8080-exec-4] ERROR errors.GrailsExceptionResolver - URISyntaxException occurred when processing request:
[GET] /content-creator/assets/css/bootstrap.css
Illegal character in path at index 3: css\/../fonts/glyphicons-halflings-regular.eot. Stacktrace follows:
Message: Illegal character in path at index 3: css\/../fonts/glyphicons-halflings-regular.eot
Line | Method
->> 2848 | fail in java.net.URI$Parser
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 3021 | checkChars in ''
| 3105 | parseHierarchical . in ''
| 3063 | parse in ''
| 588 | <init> . . . . . . in java.net.URI
| 43 | doCall in asset.pipeline.processors.CssProcessor$_process_closure1
| 36 | process . . . . . . in asset.pipeline.processors.CssProcessor
| 27 | processedStream in asset.pipeline.AbstractAssetFile
| 112 | fileContents . . . in asset.pipeline.DirectiveProcessor
| 93 | loadContentsForTree in ''
| 45 | compile . . . . . . in ''
| 20 | serveAsset in asset.pipeline.AssetProcessorService
| 28 | index . . . . . . . in asset.pipeline.AssetsController
| 61 | doFilter in asset.pipeline.AssetPipelineFilter
| 1142 | runWorker . . . . . in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . in java.lang.Thread
Does anyone have any idea what is going on here?
I was using asset-pipeline 1.9.4. Upgrading to 1.9.9 fixed the issue.
Related
We have a rather ancient Grails site (2.3) that has been serving our needs for quite a while. The server needs to call out to another service for customer details, and that service will soon require TLS 1.1 or higher only. Our site is running on java 1.7, which should support TLS 1.1 and 1.2, but requires it to be enabled explicitly. I'm having trouble enabling it in the grails site.
Primarily what I've tried is to start grails by running
grails -Dhttps.protocols=TLSv1.1 run-app
based on the instructions here, and the hint here. But when I do, the socket is still closed when I try to login to the other site:
Message: Connection reset
Line | Method
->> 196 | read in java.net.SocketInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 122 | read in ''
| 82 | flushBuffer . . . . . . in java.io.BufferedOutputStream
| 140 | flush in ''
| 191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream
| 99 | flush in com.ctc.wstx.io.UTF8Writer
| 214 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter
| 311 | flush in com.ctc.wstx.sw.BaseStreamWriter
| 50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
| 230 | flush in org.apache.axiom.om.impl.MTOMXMLStreamWriter
| 91 | serialize . . . . . . . in org.apache.axis2.databinding.ADBDataSource
| 638 | internalSerialize in org.apache.axiom.om.impl.llom.OMSourcedElementImpl
| 563 | serializeChildren . . . in org.apache.axiom.om.impl.util.OMSerializerUtil
| 846 | internalSerialize in org.apache.axiom.om.impl.llom.OMElementImpl
| 267 | serializeInternally . . in org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl
| 229 | internalSerialize in ''
| 188 | serializeAndConsume . . in org.apache.axiom.om.impl.llom.OMSerializableImpl
| 74 | writeTo in org.apache.axis2.transport.http.SOAPMessageFormatter
| 84 | writeRequest . . . . . in org.apache.axis2.transport.http.AxisRequestEntity
| 499 | writeRequestBody in org.apache.commons.httpclient.methods.EntityEnclosingMethod
| 2114 | writeRequest . . . . . in org.apache.commons.httpclient.HttpMethodBase
| 1096 | execute in ''
| 398 | executeWithRetry . . . in org.apache.commons.httpclient.HttpMethodDirector
| 171 | executeMethod in ''
| 397 | executeMethod . . . . . in org.apache.commons.httpclient.HttpClient
| 621 | executeMethod in org.apache.axis2.transport.http.AbstractHTTPSender
| 193 | sendViaPost . . . . . . in org.apache.axis2.transport.http.HTTPSender
| 75 | send in ''
| 404 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
| 231 | invoke in ''
| 443 | send . . . . . . . . . in org.apache.axis2.engine.AxisEngine
| 406 | send in org.apache.axis2.description.OutInAxisOperationClient
| 229 | executeImpl . . . . . . in ''
| 165 | execute in org.apache.axis2.client.OperationClient
| 3916 | login . . . . . . . . . in com.zuora.api.ZuoraServiceStub
| 51 | ___init___ in com.zuora.zortal.util.ZApi$$EPbnSoym
| 48 | <init> . . . . . . . . in com.zuora.zortal.repository.ZuoraRepository
| 40 | login in saaseiportal.unauthorized.LoginController
| 195 | doFilter . . . . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . in java.lang.Thread
I have confirmed that my system and system's java support TLS 1.1. I created an example java client to connect directly to the site. It gets a similar connection reset message when I run it regularly, but it gets a valid response when I try
java -Dhttps.protocols=TLSv1.1 SampleHttpTest
I suspect somewhere in grails is actually clearing out my setting. Immediately before the login call that generates the exception, I added a logging call to
System.out.println(System.getProperty("https.protocols"));
And it just logs a null. Setting that property immediately before I try to login has no effect, possibly because it's far too late in the application's life (some factory already created or something).
I'm actually something of a grails novice, so upgrading the app to grails 2.5 and java 8 is actually a rather daunting prospect. I'm hoping someone can point out something simple like:
"Here's where grails lets you set system properties before running any other java code"
or
"Here's where grails sets a bunch of default settings and you should check the values there already"
or
"It's probably the authentication plugin (or something) that needs to clear/fiddle with those settings"
Thanks in advance for any help!!
It may be the fork mode. To pass a JVM argument to a forked Java you have to change the BuildConfig.groovy a bit:
grails.project.fork = [
...
run : [maxMemory: 1280, minMemory: 128, debug: false, maxPerm: 256, forkReserve: true, jvmArgs: ['-Dhttps.protocols=TLSv1.1']],
...
]
But it could be something else as well.
I use Spring Security ACL plugin and have no ACLs set before. I want to access the following service method:
#PostFilter("hasPermission(filterObject, read) or hasPermission(filterObject, admin)")
List<Company> list(Map params = [:]) {
return Company.list(params)
}
I gave permission to the admin user for a company. When I access the above method everything works fine. The problem occurs when I stopped the server and do grails clean. When I restart and access the above method I get the following error. It is very strange because it worked the first time before the grails clean without errors.
2015-08-08 14:57:02,509 [http-nio-8080-exec-5] ERROR errors.GrailsExceptionResolver - ClassCastException occurred when processing request: [GET] /test2/home/list
java.lang.String cannot be cast to java.lang.Long. Stacktrace follows:
Message: java.lang.String cannot be cast to java.lang.Long
Line | Method
->> 305 | doCall in org.grails.datastore.gorm.GormStaticApi$_withCriteria_closure11
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 302 | execute in org.grails.datastore.mapping.core.DatastoreUtils
| 37 | execute . . . . . . . in org.grails.datastore.gorm.AbstractDatastoreApi
| 304 | withCriteria in org.grails.datastore.gorm.GormStaticApi
| 128 | lookupObjectIdentities in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy
| 106 | doCall in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy$_readAclsById_closure1
| 78 | readAclsById . . . . . in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy
| 288 | readAclsById in grails.plugin.springsecurity.acl.AclService
| 127 | list . . . . . . . . . in test2.HomeController
| 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 62 | doFilter . . . . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
2015-08-08 14:57:03,030 [http-nio-8080-exec-6] ERROR errors.GrailsExceptionResolver - ClassCastException occurred when processing request: [GET] /test2/home/list
java.lang.String cannot be cast to java.lang.Long. Stacktrace follows:
Message: java.lang.String cannot be cast to java.lang.Long
Line | Method
->> 305 | doCall in org.grails.datastore.gorm.GormStaticApi$_withCriteria_closure11
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 302 | execute in org.grails.datastore.mapping.core.DatastoreUtils
| 37 | execute . . . . . . . in org.grails.datastore.gorm.AbstractDatastoreApi
| 304 | withCriteria in org.grails.datastore.gorm.GormStaticApi
| 128 | lookupObjectIdentities in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy
| 106 | doCall in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy$_readAclsById_closure1
| 78 | readAclsById . . . . . in grails.plugin.springsecurity.acl.jdbc.GormAclLookupStrategy
| 288 | readAclsById in grails.plugin.springsecurity.acl.AclService
| 127 | list . . . . . . . . . in test2.HomeController
| 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 62 | doFilter . . . . . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I created a demo project here: https://github.com/confile/Spring-Security-ACL-Bug
Reproduce it:
create a mysql database name: test
grails dbm-update
grails run-app
http://localhost:8080/test2/home/list
login with user: admin pw: admin
http://localhost:8080/test2/home/createCompany1
http://localhost:8080/test2/home/addPerm
http://localhost:8080/test2/home/createCompany2
http://localhost:8080/test2/home/list
stop server
grails clean
grails run-app
http://localhost:8080/test2/home/list
Edit: I found that when I shut down my mysql server and restart it then the error is gone. It might belong to some caching issues here.
Is there a way to catch this error, e.g., in case where no ACLs have been set before?
Note: This question is still unanswered.
The issue seems actually related to the way AclSid overrides the one in the plugin.
You will see the java.lang.String cannot be cast to java.lang.Long issue when the plugins class won somehow.
There is an easy fix in general you always should be running grails package after you do a grails clean also you need to make sure on your ci server you run the package step before you build your war.
I have seen this same issue since we use UUIDs and had to make the AclSid class has a string for the sid as well. I've had no issues in production or locally once we started to correctly run the package step.
I keep getting the same error with DWR on grails when I connect to the page that is using it:
2014-12-15 08:48:57,621 [http-bio-8080-exec-8] INFO log.startup - Starting: DwrServlet v3.0.0-RC3-dev-574 on Apache Tomcat/7.0.55 / JDK 1.8.0_25 from Oracle Corporation at /CRM
2014-12-15 08:48:58,669 [http-bio-8080-exec-8] INFO log.startup - Starting: Using container abstraction org.directwebremoting.server.servlet3.Servlet30ContainerAbstraction
2014-12-15 08:48:58,703 [http-bio-8080-exec-8] INFO servlet.UrlProcessor - Probably not an issue: the url:/gi.js (org.directwebremoting.gi.GiHandler) Handler is not available. This is only an problem if you wanted to use it.
Error |
2014-12-15 08:48:58,878 [http-bio-8080-exec-8] ERROR util.LocalUtil - Failed to load 'pageflow' (org.directwebremoting.beehive.PageFlowCreator)
Message: null
Line | Method
->> 1349 | classForName in org.directwebremoting.util.LocalUtil
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 55 | addCreatorType in org.directwebremoting.impl.DefaultCreatorManager
| 192 | loadInits . . . . . . . . in org.directwebremoting.impl.DwrXmlConfigurator
| 161 | configure in ''
| 597 | configureFromSystemDwrXml in org.directwebremoting.impl.StartupUtil
| 714 | configureContainerFully in ''
| 113 | configureContainer . . . in org.directwebremoting.servlet.DwrServlet
| 72 | init in ''
| 1142 | runWorker . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . in java.lang.Thread
Caused by ClassNotFoundException: Beehive/Weblogic jar file not available.
->> 57 | <init> in org.directwebremoting.beehive.PageFlowCreator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1349 | classForName in org.directwebremoting.util.LocalUtil
| 55 | addCreatorType . . . . . in org.directwebremoting.impl.DefaultCreatorManager
| 192 | loadInits in org.directwebremoting.impl.DwrXmlConfigurator
| 161 | configure . . . . . . . . in ''
| 597 | configureFromSystemDwrXml in org.directwebremoting.impl.StartupUtil
| 714 | configureContainerFully . in ''
| 113 | configureContainer in org.directwebremoting.servlet.DwrServlet
| 72 | init . . . . . . . . . . in ''
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Everything works properly, nothing breaks but this exception is polluting the logs.
Anyone know what is it about and what should I do about it?
I am using Grails with optaplanner 6.0.1.Final and drools jars (version 5.4.0) but getting some error while running the code. StackTrace is as follows :
ERROR errors.GrailsExceptionResolver - ClassNotFoundException occurred when processing request: [GET] /Volcare-BRMS/API/eventCreationDatePrePlanning
org.drools.core.event.AbstractEventSupport. Stacktrace follows:
Message: org.drools.core.event.AbstractEventSupport
Line | Method
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 | run in ''
| 354 | findClass . . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 800 | defineClass . . . . . . . . in ''
| 142 | defineClass in java.security.SecureClassLoader
| 449 | defineClass . . . . . . . . in java.net.URLClassLoader
| 71 | access$100 in ''
| 361 | run . . . . . . . . . . . . in java.net.URLClassLoader$1
| 355 | run in ''
| 354 | findClass . . . . . . . . . in java.net.URLClassLoader
| 425 | loadClass in java.lang.ClassLoader
| 48 | <init> . . . . . . . . . . . in org.optaplanner.core.impl.solver.DefaultSolver
| 129 | buildSolver in org.optaplanner.core.config.solver.SolverConfig
| 101 | buildSolver . . . . . . . . in org.optaplanner.core.config.solver.XmlSolverFactory
| 13 | createSolver in com.volcare.brms.CustomSolverFactory
| 74 | eventCreationDatePrePlanning in volcare.brms.api.APIController
| 200 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I have also included all JAR files in classpath.
The class org.drools.core.event.AbstractEventSupport seems to be part of the drools-core module. Optaplanner provides the correct Drools version so you DO NOT need to specify any Drools module in your BuildConfig.groovy.
compile 'org.optaplanner:optaplanner-core:6.0.1.Final'
compile 'org.optaplanner:optaplanner-benchmark:6.0.1.Final'
I am trying to create RESTClient in grails using jersey. I am getting following error even after adding jersey-bundle-1.12.jar and jersey-0.7-ea.jar files.
Error 2012-03-20 10:21:06,912 [T`enter code here`hread-7] ERROR application.RootResourceUriRules - The ResourceConfig instance does not contain any root resource classes.
| Error 2012-03-20 10:21:06,912 [Thread-7] ERROR inject.Errors - The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for field: com.sun.ws.rest.spi.template.TemplateContext com.sun.ws.rest.impl.template.ViewableMessageBodyWriter.tc
| Error 2012-03-20 10:21:06,912 [Thread-7] ERROR servlet.SpringServlet - Exception occurred when intialization
Message: The ResourceConfig instance does not contain any root resource classes.
Line | Method
->> 103 | <init> in com.sun.jersey.server.impl.application.RootResourceUriRules
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1182 | _initiate in com.sun.jersey.server.impl.application.WebApplicationImpl
| 161 | access$600 . . . . in ''
| 698 | f in com.sun.jersey.server.impl.application.WebApplicationImpl$12
| 695 | f . . . . . . . . in ''
| 193 | processWithErrors in com.sun.jersey.spi.inject.Errors
| 695 | initiate . . . . . in com.sun.jersey.server.impl.application.WebApplicationImpl
| 117 | initiate in com.sun.jersey.spi.spring.container.servlet.SpringServlet
| 287 | initiate . . . . . in com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent
| 587 | load in com.sun.jersey.spi.container.servlet.WebComponent
| 213 | init . . . . . . . in ''
| 342 | init in com.sun.jersey.spi.container.servlet.ServletContainer
| 516 | init . . . . . . . in ''
| 51 | init in org.grails.jaxrs.web.JerseyServlet
| 174 | init . . . . . . . in org.grails.jaxrs.web.JaxrsContext
| 164 | init in ''
| 45 | contextInitialized in org.grails.jaxrs.web.JaxrsListener
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . . . . . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . . . . . . in ''
^ 662 | run in java.lang.Thread
| Error 2012-03-20 10:21:06,943 [Thread-7] ERROR [localhost].[/GrailsRESTClient] - Exception sending context initialized event to listener instance of class org.grails.jaxrs.web.JaxrsListener
Message: The ResourceConfig instance does not contain any root resource classes.
Line | Method
->> 103 | <init> in com.sun.jersey.server.impl.application.RootResourceUriRules
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1182 | _initiate in com.sun.jersey.server.impl.application.WebApplicationImpl
| 161 | access$600 . . . . in ''
| 698 | f in com.sun.jersey.server.impl.application.WebApplicationImpl$12
| 695 | f . . . . . . . . in ''
| 193 | processWithErrors in com.sun.jersey.spi.inject.Errors
| 695 | initiate . . . . . in com.sun.jersey.server.impl.application.WebApplicationImpl
| 117 | initiate in com.sun.jersey.spi.spring.container.servlet.SpringServlet
| 287 | initiate . . . . . in com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent
| 587 | load in com.sun.jersey.spi.container.servlet.WebComponent
| 213 | init . . . . . . . in ''
| 342 | init in com.sun.jersey.spi.container.servlet.ServletContainer
| 516 | init . . . . . . . in ''
| 51 | init in org.grails.jaxrs.web.JerseyServlet
| 174 | init . . . . . . . in org.grails.jaxrs.web.JaxrsContext
| 164 | init in ''
| 45 | contextInitialized in org.grails.jaxrs.web.JaxrsListener
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . . . . . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . . . . . . in ''
^ 662 | run in java.lang.Thread
| Error 2012-03-20 10:21:06,958 [main] ERROR core.StandardContext - Error listenerStart
| Error 2012-03-20 10:21:06,958 [main] ERROR core.StandardContext - Context [/GrailsRESTClient] startup failed due to previous errors
Any idea on how to solve above error? Thanks!