MissingMethodException in Grails Bootstrap on Tomcat - grails

after updating my grails app's security plugins, i get the following error when deploying to tomcat:
2012-01-17 09:13:04,970 [pool-2-thread-1] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: static org.example.SecRole.findByAuthority() is applicable for argument types: (java.lang.String) values: [ROLE_USER]
the app works fine when being tested via run-app.
the SecRole class has been automatically generated by the spring security plugin.
i had previously deployed the app on the same server without a problem when using an older version of the spring security plugin.
have been knocking my head against this for hours. ideas much appreciated.

This is a bug in v1.2.7 of the plugin. I released v1.2.7.1 to fix it; you can also downgrade to v1.2.6.

Are you using your own Spring Security's User and Role class?
Did you tried to create a fresh grails project and install it with vacation request sample app to test it out?
Lastly, may I know which Grails version and OS you use?
Cheers,
Chee Kin

My prod Env: Tomcat 7, Fedora, Grails 1.3.7, activiti-spring-security 0.4.6, spring-security-core 1.2.7 activiti 5.8.2
Dev Env: Mac OS 10.6, Grails 1.3.7, activiti-spring-security 0.4.6, spring-security-core 1.2.7, activiti 5.8.2
I have installed vacation request app on fresh grails project and that works fine when I run using grails run-app (both in dev and prod mode).

As per Peter's comment above, upgrading to Grails 2.0 solved the problem I described above. However, I had subsequently run into a host of upgrade issues with the app.

Related

Grails 2.4.4 compatibility with Java 8

I am having a legacy grails application that uses Grails 2.4.4 & has a runtime of Java7 / Tomcat7. We are planning to take it to Azure app service but azure supports runtime starting from java 8 / tc 8.5.
We are looking to upgrade the application to grails 2.5 as that seems to be supporting jdk8. Are there any pointers on how a 2.4.4 application could be migrated to 2.5 ?
I have done this already. There were some issues i had to solve but the error-logs and stackoverflow were my friends. I cannot provide a howto but if you just try it and send the errors you get i would be pleased to help you.
I was able to successfully get the application with a stack of grails 2.2.4 , java 1.7 , tomcat 7 migrated to grails 2.5.6 , Java 1.8 (compile) , tomcat 9 ( runtime java 11). Some of the hurdles i encountered are:
If your app uses JAXB , make sure that is available in app's runtime. With java 8 runtimes, they were available by default.
mailService Bean creation issues - Ran to issues with instantiating the mailService Bean & was resolved by setting the poolSize to 1 in the configuration.
txManager , sessionFactory instantiating issues - those were are settled by having the runtime jars - JaxB , marshaller etc. Though the stacktrace was misleading.

Spring security not working with Grails project on JBoss Application Server

I have a big(multiple custom plugin based) Grails project, which runs perfectly fine on Tomcat server.
Now for a new customer we need to deploy it on JBoss Application server. It seems to deploy fine without any error but when I try to login on the first page which is implemented using Spring Security plugin. It does not log me in. I have tried going to a valid URL to check if its a problem of redirecting but it is not the case.
Please note it is not showing any error on the log. And since it is not properly executable in development environment so each time I need to build a WAR file to test it.
Grails version: 2.4.4
Spring security version: ':spring-security-core:2.0-RC4'
JBoss version: wildfly-9.0.2.Final
I tried some setups, and they all worked as a simple new project.
I used grails 2.4.4 and spring-security 2.0-RC4.
Here are a few things you could try:
Use latest spring-security version 2.0.0
compile "org.grails.plugins:spring-security-core:2.0.0"
Add jboss plugin and generate deployment xmls (this is needed for grails 2.5.4)
build ':jbossas:1.0'
$grails generate-boss-deploy 6
Create a brand new Wildfly install and deploy your app.
I can only think about a infrastructure problem, since I got no problem with the same setup. I running on Mac, with java 8 and Wildfly 9.0.2 final. Tested grails 2.4.4 and 2.5.4, spring security 2.0-RC4 and 2.0.0.
Best,
Eder

Remote-control plugin with Grails 2.4

Is anyone using the remote-control plugin with Grails 2.4.x? I'm working on upgrading an app from 2.2.4 to to 2.4.3. I've got it all working except for a few integration tests, and a bunch of functional tests. In our functional tests, I'm getting the following error:
groovyx.remote.RemoteControlException: Error sending command chain to 'http://localhost:8080/<appname>/grails-remote-control'
at groovyx.remote.transport.http.HttpTransport.send(HttpTransport.groovy:65)
at groovyx.remote.client.RemoteControl.sendCommandChain(RemoteControl.groovy:114)
at groovyx.remote.client.RemoteControl.exec(RemoteControl.groovy:73)
at groovyx.remote.client.RemoteControl.exec(RemoteControl.groovy:67)
at groovyx.remote.client.RemoteControl.call(RemoteControl.groovy:81)
at PatientTests.oneTimeSetUp(PatientTests.groovy:17)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/<appname>/grails-remote-control
at groovyx.remote.transport.http.HttpTransport$_send_closure1.doCall(HttpTransport.groovy:62)
at groovyx.remote.transport.http.HttpTransport.send(HttpTransport.groovy:53)
I am using the 1.5 version of the remote-control plugin. Any ideas or insights would be much appreciated.
Thanks,
Dave
I faced this problem today with Grails 2.4.3 and remote control 1.5
I initially thought the issue was related to https://jira.grails.org/browse/GRAILS-10661
In my case, it was simply that I had a disconnected grails instance already running on port 8080 that I wasn't aware of.
Killing the errant process solved the issue for me.
Hope that helps.
Regards,
Peter

Deploying Grails Atmosphere app in JBoss 7

Greeting,
I'm trying to make this example work in Grails 2.1 using atmosphere plugin. When running in development environment on Tomcat it does not work, probably because Tomcat does not support web-services.
So I'm deploying it on JBoss 7.1. It does not work as well. And the following exception could be found in the log file
AtmosphereFramework exception: java.lang.IllegalStateException: The servlet or filters
that are being used by this request do not support async operation
I found the article related to async servlets support in Grails. Seems that Servlet3AsyncWebXmlProcessor should add async support to web.xml. But somebody should invoke it.
I think that atmosphere plugin is responsible for allowing async communication.
Have I missed something? Could you please help to make it work on AS7?
Ideally, I would like to figure out the way of running atmosphere applications in development environment? Is it possible?

Grails 1.3.7 spring security - No thread-bound request found at start

Suffering badly from the bug below.
See http://jira.grails.org/browse/GPSPRINGSECURITYCORE-98
Works fine in my mac os x environment but fails badly on my collegues ubuntu.
/S
Removing the resources plugin seems to fix it for us.

Resources