6 messages in org.codehaus.grails.userRe: [grails-user] [grails-users] depl...
FromSent OnAttachments
Johan Chaves Saborío11 Sep 2007 19:17 
wouters11 Sep 2007 22:54 
Graeme Rocher12 Sep 2007 00:05 
wouters12 Sep 2007 00:52 
Johan Chaves Saborío22 Sep 2007 17:49 
wouters23 Sep 2007 23:00 
Subject:Re: [grails-user] [grails-users] deploying grails application in Websphere 5.X
From:Johan Chaves Saborío (joha@gmail.com)
Date:09/22/2007 05:49:59 PM
List:org.codehaus.grails.user

If I use -Dservlet.version=2.3 I get the following exception:

java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:41) at java.lang.reflect.Method.invoke(Method.java:386) at org.codehaus.groovy.tools.GroovyStarter.rootLoader( GroovyStarter.java:131) at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java :160) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.substring(String.java(Compiled Code)) at org.codehaus.groovy.grails.commons.GrailsClassUtils.getNameFromScript( GrailsClassUtils.java:336) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:41) at java.lang.reflect.Method.invoke(Method.java:386) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:71) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke( MetaClassHelper.java:694) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java :721) at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java :101) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod( InvokerHelper.java:115) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN( ScriptBytecodeAdapter.java:187) at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main( GrailsScriptRunner.groovy:100)

so we change the file %GRAILS_HOME%/scripts/Init.groovy in order to change de servletVersion variable to 2.3.

It seems to work, but we want to know what are we doing wrong?

On 9/12/07, wouters <wsch@gmail.com> wrote:

This workaround introduces a little overhead when upgrading grails. We added two files to scripts/ War23.groovy and Package23.groovy. We also needed to exclude a few jars from the war, so we basically duplicated the entire war task with the added EXCLUDES functionality. The Package23.groovy contains the workaround for the web.xml, and is used by War23 instead of the original Package.groovy effectively overriding the generateWebXml task with one that fixes the generated web.xml. This means that when upgrading grails these tasks should be aligned with the latest and greatest originals.

now calling: $ grails -Dservlet.version=2.3 prod war23

creates a war file that deploys in websphere (given that the other websphereisms noted on the grails website are taken into account, we use PARENT_LAST classloading).

The attached versions of the scripts are based on grails 0.5.6 and may need some tweaking for 0.6. It is not an ideal solution, but it works.

IIRC there is some code in grails that generates the web.xml which could be easily adapted to take the servlet.version into account, so that this workaround is no longer necessary. i never got around to patching it and creating an issue (we have an acceptable workaround).

HTH, wouter

graemer wrote:

Can you post your code, for the benefit of other users?

Cheers

On 9/12/07, wouters < wsch@gmail.com> wrote:

hi,

i think you can run with: -Dservlet.version=2.3 but, in 0.5.5, this still did not generate a deployable war for websphere 5.1. we had to create an alternative generateWebXml task (from Package.groovy) to 'fix' the web.xml. (Remove namespace declaration, and add 2.3 DOCTYPE). I think the namespace declaration, at least for 0.5.5, is hardcoded in the code that generates the web.xml, and ignores the servlet.versionsetting. websphere 5.1 chokes on this.

HTH, wouter

Johan Chaves Saborío wrote:

How can I deploy a grails war into a websphere 5.x server. The

problem

I'm

having is that grails generates the web.xml based on the servlet 2.4 api, but websphere is trying to use the servlet 2.3 api.

Is there any way to create the grails application with the servlet 2.3 api?

-- View this message in context:

http://www.nabble.com/-grails-users--deploying-grails-application-in-Websphere-5.X-tf4426582.html#a12629142

Sent from the grails - user mailing list archive at Nabble.com.

--------------------------------------------------------------------- To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

-- Graeme Rocher Grails Project Lead http://grails.org

--------------------------------------------------------------------- To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

http://www.nabble.com/file/p12630450/Package23.groovy Package23.groovy http://www.nabble.com/file/p12630450/War23.groovy War23.groovy -- View this message in context:
http://www.nabble.com/-grails-users--deploying-grails-application-in-Websphere-5.X-tf4426582.html#a12630450

Sent from the grails - user mailing list archive at Nabble.com.

--------------------------------------------------------------------- To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email