Tuesday, January 29, 2008

grails 1.0-RC4 issues/bugs

It turns out that the RC4 war file described below is a known bug in grails 1.0-RC4 (wish I'd have known about it) and so I've reverted to RC3 for now. What a pain.

I couldn't deploy the WebTestApp as a war to tomcat (RH Linux, jdk 1.5.0_06) because it failed upon app invocation. The app deployed and appeared to be started in the tomcat administrator, but would not run. I did an experiment and this problem is apparently because of a bug in grails-1.0-RC4.

I therefore did an experiment: I created 4 identical grails apps with 1 domain class and used "generate-all" to generate the controller and views. The only difference between each one, was I created each one in a different version of grails from RC1..RC4.

Basically...

for each grails version X from RC1..RC4
grails create-app testRCX
cd testRCX
grails create-domain-class User
grails generate-all User
grails -Dserver.port=9090 run-app
test
grails war
copy the war file to the tomcat instance and test.

The only one that didn't deploy to tomcat and work was the app for RC4. Tomcat indicated it was started, but when I tried to invoke it, catalina.out reported
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String

Here's the top of the error:
[4894343] [/testRC4].[gsp] Servlet.service() for servlet gsp threw exception
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
at org.codehaus.groovy.grails.web.mapping.RegexUrlMapping.createURLInternal(RegexUrlMapping.java:179)
at org.codehaus.groovy.grails.web.mapping.RegexUrlMapping.createURLInternal(RegexUrlMapping.java:241)
at org.codehaus.groovy.grails.web.mapping.RegexUrlMapping.createURL(RegexUrlMapping.java:225)
at org.codehaus.groovy.grails.web.mapping.RegexUrlMapping.createURL(RegexUrlMapping.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)


The rest of the apps ran fine on tomcat.

1 comment:

sanka said...

Myself also having same kind of prject when I am migrating spring 2.5 to 3.0.Here is the error console


Feb 23, 2010 12:17:17 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:265)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Feb 23, 2010 12:17:17 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart