No thread-bound Exception after installing grails profiler plugin - grails

After I installed the profiler plugin (http://grails.org/plugin/profiler) I started getting the following error for every request to my server:
2012-03-01 14:57:42,224 ERROR: [[default]] Servlet.service() for servlet default threw exception
java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at org.codehaus.groovy.grails.web.util.WebUtils.retrieveGrailsWebRequest(WebUtils.java:497)
at org.codehaus.groovy.grails.plugins.springsecurity.AnnotationFilterInvocationDefinition.determineUrl(AnnotationFilterInvocationDefinition.java:63)
at org.codehaus.groovy.grails.plugins.springsecurity.AbstractFilterInvocationDefinition.getAttributes(AbstractFilterInvocationDefinition.java:77)
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:171)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
I can paste the full exception if desired. If I uninstall the plugin, the error disappears.
I am running grails 1.3.7
I searched for related issues, and this is the closest I could find: http://padcom13.blogspot.com/2011/12/grails-heroku-and-spring-security-core.html I attempted the fix Padcom suggested, but it didn't seem to work here.
Has anyone run into this issue or have some idea how to fix it?

I fixed this earlier this week with version 0.4 of the plugin. It depends on the webxml plugin, but that should be automatically installed with version 0.4. If not you can manually install it.

Okay, so the problem here was a little annoying to figure out. Burt was on the right track, it was related to webxml being installed. It seems like when its installed, spring-security-core version 1.1.3 was causing the error. When I updated to 1.2.7 (as suggested by Burt in this thread: http://grails.1312388.n4.nabble.com/No-thread-bound-request-error-with-Spring-security-ldap-plugin-on-Grails-2-td4270779.html ) the problem went away and I was able to install profiler without any issues.
So, the oddity here was that spring-security-core 1.1.3 only seems to cause this exception when webxml is installed (any version).

Related

Issue while running dataflow

I am getting below error while running dataflow job. I am trying to update my existing beam version to 2.11.0 but I am getting below error at run time.
java.lang.IncompatibleClassChangeError: Class
org.apache.beam.model.pipeline.v1.RunnerApi$StandardPTransforms$Primitives
does not implement the requested interface
com.google.protobuf.ProtocolMessageEnum at
org.apache.beam.runners.core.construction.BeamUrns.getUrn(BeamUrns.java:27)
at
org.apache.beam.runners.core.construction.PTransformTranslation.(PTransformTranslation.java:58)
at
org.apache.beam.runners.core.construction.UnconsumedReads$1.visitValue(UnconsumedReads.java:49)
at
org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:666)
at
org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:649)
at
org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:649)
at
org.apache.beam.sdk.runners.TransformHierarchy$Node.visit(TransformHierarchy.java:649)
at
org.apache.beam.sdk.runners.TransformHierarchy$Node.access$600(TransformHierarchy.java:311)
at
org.apache.beam.sdk.runners.TransformHierarchy.visit(TransformHierarchy.java:245)
at
org.apache.beam.sdk.Pipeline.traverseTopologically(Pipeline.java:458)
at
org.apache.beam.runners.core.construction.UnconsumedReads.ensureAllReadsConsumed(UnconsumedReads.java:40)
at
org.apache.beam.runners.dataflow.DataflowRunner.replaceTransforms(DataflowRunner.java:868)
at
org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:660)
at
org.apache.beam.runners.dataflow.DataflowRunner.run(DataflowRunner.java:173)
at org.apache.beam.sdk.Pipeline.run(Pipeline.java:313) at
org.apache.beam.sdk.Pipeline.run(Pipeline.java:299)
This usually means that the version of com.google.protobuf:protobuf-java that Beam was built with does not match the version at runtime. Does your pipeline code also depend on protocol buffers?
UPDATE: I have filed https://issues.apache.org/jira/browse/BEAM-6839 to track this. It is not expected.
I don't have enough rep to leave a comment, but I ran into this issue and later figured out that my problem was that I had different beam versions in my pom.xml. Some had 2.19 and some had 2.20.
I would do a quick search of your versions in the pom or gradle file to make sure they are all the same.
This may be caused by incompatible dependencies. I successfully upgraded beam from 2.2.0 to 2.20.0 by upgrading the dependencies at the same time.
beam.version: 2.20.0
guava.version: 29.0-jre
bigquery.version: v2-rev20191211-1.30.9
google-api-client.version: 1.30.9
google-http-client.version: 1.34.0
pubsub.version: v1-rev20200312-1.30.9

grails 2.5.4 won't start from terminal StackOverflowError

I'm running grails 2.5.4(I cannot upgrade the version), it successfully runs in my IDE (intellij) but I cannot get any grails command to run from the terminal. Even if I type just "grails" and nothing else, it will throw an error.
The error is:Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread "main"
I can't seem to get anymore information out of it with --verbose
Also, I am running java 8
so I found out what was going on through excessive trial an error. The issue was that I had db2 installed on my machine. I don't know why that was causing the issue. But for anyone that might be running into this issue, that's what the problem was for me.
We had the same problem; in our case, all it took was an empty .inputrc file in the user's home directory to make grails work.

Grails JMS Plugin - Unable to resolve classes

I'm pretty new to grails so it's possible that i've missed something obvious, but I am trying to utilise the JMS plugin. I've included the following within the plugins section of my BuildConfig.groovy
compile ":jms:1.2"
However when I compile the app I get lots of "unable to resolve class" exceptions for imports within the jms plugin (40 in total, javax.jms.* and org.springframework.jms.* mostly).
e.g.
| Error Compilation error: startup failed:
C:\dev\prj\grails\tApp\target\work\plugins\jms-1.2\grails-app\utils\DefaultJmsBe
ans.groovy: 16: unable to resolve class org.springframework.jms.listener.Default
MessageListenerContainer
# line 16, column 1.
import org.springframework.jms.listener.DefaultMessageListenerContainer
^
C:\dev\prj\grails\tApp\target\work\plugins\jms-1.2\grails-app\services\grails\pl
ugin\jms\JmsService.groovy: 22: unable to resolve class javax.jms.Message
# line 22, column 1.
import javax.jms.Message
Is anyone able to point me in the right direction? The issue can be reproduced just by adding the plugin to the BuildConfig.groovy as mentioned above to a new grails project .
Grails version 2.3.3
Many thanks
Tom
While doing a Grails 2.2 -> 2.3.4 upgrade I ran into a similar issue and was able to get things working by manually adding spring-jms to my dependencies in BuildConfig.groovy:
compile 'org.springframework:spring-jms:3.2.5.RELEASE'
It's odd that this would stop working now of course, since the jms plugin hasn't changed in a very long time. My guess is that it depends on the spring-jms lib, but didn't have it listed as a dependency, instead relying on grails to bring it in. According to the 2.3.x upgrade guide, there have been changes to what grails brings in now, so perhaps spring-jms stopped getting a free ride.
The Grails MX website has a write-up that might help; it's built using 2.3.4:
http://grails.org.mx/2013/12/20/quickstart-jms-en-grails/
It was pretty helpful to me in getting a sample application up and running. It's in Spanish though, so may need to have Google translate it for you...
Have you tried executing the command grails refresh-dependencies before running grails run-app?
I wrote a blog post on installing a Grails plugin if you need more details.

Grails JBOSSAS Plugin -- How To get it To Work?

Newbie Question:
I've been required to deploy a grails app to jboss 5. I'm having a hell of a time figuring out how to take advantage of the grails jbossas plugin. I've followed the documentation as best as I know how, but I get the same exceptions just as if the plugin was never there.
Here's the documentation i've been following:
http://grails-plugins.github.com/grails-jbossas/docs/manual/guide/2%20Usage.html
I've added the plugin to the BuildConfig.groovy plugin{} closure. I then called grails war. Nothing happens and my war deploy bombs out.
Could somebody give a newbie a little hand holding to get this plugin to work? Unfortunately, I'm finding the documentation to be wanting in the regard of actually telling you how to use it, or when the plugin will do its magic.
UPDATE:
My environment:
Mac OS X Lion Dev machine
Grails 2.0.3
JBoss 5.1.0 -- running a Liferay instance.
Burt, I've done the following:
grails generate-jboss-deploy 5
grails war.
scp the generated war file to the deploy-jboss directory on my remote server.
Dutifully, jboss picked up the new war and attempted to deploy it. I'm getting the following (now dreaded) exception:
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator
Per the usage instructions, I've modified Datasource.groovy's hibernate configuration:
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
validator.apply_to_ddl = false
validator.autoregister_listeners = false
}
The only file that seems to have been modified or created by running the generate-jboss-delpoy 5 script is WEB-INF/jboss-web.xml. It's contents are:
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
sappi-label:loader=sappi-label.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
I confirmed that the jboss-web.xml file is present in the generated war file (exploded, then checked the directory).
Burt: what files other than jboss-web.xml should have been altered?
UPDATE (Again):
I don't think there's anything wrong with the jbossas plugin. I've done more testing and see that the plugin is doing what it is supposed to do: remove jars, put in jboss-web.xml. I haven't been able to confirm that it modifies the hibernate config, but I assume it is. I think the problem lies within the server I'm attempting to deploy to, a Liferay instance.
regardless of what I'm doing I get an exception saying that slf4j was unable to load successfully. Nothing more, nothing less. I'll keep whacking away at the problem, but it is out of scope of my original question. Burt, thanks for your help. If you have any ideas about why slf4j vomits in a Liferay/jboss environment, please let me know.
Regards.
Thanks!
I guess I didn't make it clear that you need to run the generate-jboss-deploy script, passing in the major version of JBoss that you're using, so in your case generate-jboss-deploy 5. I've updated the docs to describe this.
If this doesn't help please update your question with some indication of what the errors that you're seeing are.

Grails: server crashes when I recompile a file (when using datasources)

I'm using datasources in my Grails project.
When I edit a groovy file with server running I get the following error:
Running Grails application.. java.lang.IllegalArgumentException: Must
supply a resource type for JNDI configuration
How can I configure grails.naming.entries in Config.groovy to fix this?
Note: I'm using grails 1.3.6
Tks
I'm using 1.3.7 and hit the same issue. There's a couple bugs in the JIRA about this, looks like they were finally fixed in 2.0-M1. There's a patch for 1.3.1+ versions here, but I haven't tested that yet.
Link to possible patch: http://jira.grails.org/browse/GRAILS-7021

Resources