Issue Details (XML | Word | Printable)

Key: GRAILS-2665
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Graeme Rocher
Reporter: Marc Guillemot
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Grails

Tomcat deployment error with 2 versions of a Grails app: "Choose unique values for the 'webAppRootKey' "

Created: 19/Mar/08 05:34 AM   Updated: 02/Jun/08 09:03 AM   Resolved: 02/Jun/08 04:37 AM
Component/s: Configuration
Affects Version/s: 1.0.1
Fix Version/s: 1.0.3

Time Tracking:
Not Specified

Issue Links:
Duplicate
 
Related
 


 Description  « Hide

Due to Tomcat class loading, 2 applications can't have the same webAppRootKey setting in web.xml

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myGrailsApp</param-value>
</context-param>

Otherwise Spring throws an exception with:
"Choose unique values for the 'webAppRootKey' context-param in your web.xml files!"

A solution would be to add the environment name to the appname as value for the webAppRootKey. Nevertheless this should be done with custom template provided by the user too what changes the way template are processed. I can try to propose a patch when this second point is cleared (I'll post a mail in the dev mailing list to discuss this).



Lee Butts added a comment - 12/May/08 08:54 PM

See related/duplicate issues for suggested solutions/patches


Marc Guillemot added a comment - 13/May/08 02:16 AM

There is a major difference between this issue and the 2 related ones: here I use a custom web.xml template.


Graeme Rocher added a comment - 02/Jun/08 04:37 AM

i've changed package.groovy to add the environment, if the user needs to change this they can run install-templates


Marc Guillemot added a comment - 02/Jun/08 05:31 AM

Graeme, from your comment, I think that the problem is not solved when using a custom template: I don't want to modify my template before creating a war, which means that Grails should not take the template as it but modify the webAppRootKey.


Graeme Rocher added a comment - 02/Jun/08 06:03 AM

I don't think i understand the problem, to me the semantics seem perfectly clear. Grails by default generates the webAppRootKey, if you don't want it generated you run install-templates and specify your own. If you have issues with running the same app multiple times on the same machine then you can use the versioning system.


Marc Guillemot added a comment - 02/Jun/08 06:23 AM

Perhaps I'm missing something. Here is my scenario:

  • I need to use custom template to put legacy filters/servlets/...
  • this template contains as well the filters/servlets/... needed by Grails, among others the webAppRootKey context param
  • if I deploy 2 versions of this web app on the same Tomcat instance, they will both have the same webAppRootKey value, which cause the problem.

Generally it seems to me that the web.xml template has 2 purposes that should perhaps not be handled together: modify the web.xml stuff needed by Grails and add custom web.xml stuff.

I don't see how the versioning system could help here, but I'm perhaps wrong.


Graeme Rocher added a comment - 02/Jun/08 08:01 AM

If you want your webAppRootKey generated by Grails for you then put @grails.project.key@ as its value in your template

<context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>@grails.project.key@</param-value>
    </context-param>

I don't see or understand what you want us to do to solve this problem any other way


Marc Guillemot added a comment - 02/Jun/08 08:18 AM

This would be just fine but according to the code of scripts/Package.groovy, I guess that it won't work (I haven't tested): the line

Ant.replace(file:tmpWebXml, token:"@grails.project.key@", value:"${grailsAppName}-${grailsEnv}-${grailsAppVersion}")

is called only if no custom web.xml exists.

A good solution for me would be to have this Ant.replace in Package.groovy for custom web.xml as well and to remove the same line in InstallTemplates.groovy to install template with the placeholder rather than with the actual value.


Graeme Rocher added a comment - 02/Jun/08 08:55 AM

ok this is done now


Marc Guillemot added a comment - 02/Jun/08 09:03 AM

Thanks.

I'm not concerned, but shouldn't the replacement occur as well if custom web.xml is defined by config.grails.config.base.webXml?