Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-5672

Overriding an env-entry in geronimo-web.xml fails with a DeploymentException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.6, 2.2
    • 2.1.7, 2.2.1, 3.0.0
    • deployment
    • Security Level: public (Regular issues)
    • None

    Description

      If a war declares a env-entry in its web.xml without declaring a value, it is expected that the value is provided at deployment time. When the env-entry is added to the geronimo-web.xml, the deployment fails with the following (slightly reformatted for ease of reading):

      Deployer operation failed: xml problem for web app .
      org.apache.geronimo.common.DeploymentException: xml problem for web app .
      	at org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.getTomcatWebApp(TomcatModuleBuilder.java:318)
      	at org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.createModule(TomcatModuleBuilder.java:207)
      	at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createModule(AbstractWebModuleBuilder.java:179)
      	at org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.createModule(SwitchingModuleBuilder.java:94)
      	at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getDeploymentPlan(EARConfigBuilder.java:307)
      	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:228)
      	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:135)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
      Caused by: org.apache.xmlbeans.XmlException: Invalid deployment descriptor: errors:
      
      error: cvc-complex-type.2.4a: Expected elements 'work-dir@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        clustering@http://geronimo.apache.org/xml/ns/j2ee/application-2.0
        web-container@http://geronimo.apache.org/xml/ns/naming-1.2
        host@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        cross-context@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        disable-cookies@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        valve-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        listener-chain@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        tomcat-realm@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        manager@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 
        cluster@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        abstract-naming-entry@http://geronimo.apache.org/xml/ns/naming-1.2
        env-entry@http://geronimo.apache.org/xml/ns/naming-1.2
        ejb-ref@http://geronimo.apache.org/xml/ns/naming-1.2
        ejb-local-ref@http://geronimo.apache.org/xml/ns/naming-1.2
        service-ref@http://geronimo.apache.org/xml/ns/naming-1.2
        resource-ref@http://geronimo.apache.org/xml/ns/naming-1.2
        resource-env-ref@http://geronimo.apache.org/xml/ns/naming-1.2
        message-destination@http://geronimo.apache.org/xml/ns/naming-1.2
        security-realm-name@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
        service@http://geronimo.apache.org/xml/ns/deployment-1.2
        persistence@http://java.sun.com/xml/ns/persistence' instead of 'env-entry@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1' here
      
      Descriptor:
      <xml-fragment xmlns:n="http://geronimo.apache.org/xml/ns/naming-1.2"
                    xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1"
                    xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
          <moduleId>
            <groupId>test</groupId>
            <artifactId>test</artifactId>
            <version>1.0</version>
            <type>war</type>
          </moduleId>
        </environment>
        <tom:context-root>/test</tom:context-root>
        <tom:env-entry>
          <tom:env-entry-name>set-me</tom:env-entry-name>
          <tom:env-entry-value>a value</tom:env-entry-value>
        </tom:env-entry>
      </xml-fragment>
      

      Notice that the env-entry has been changed to the "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1" namespace rather then remaining in the "http://geronimo.apache.org/xml/ns/naming-1.2" where it is acceptable. This happens for both the tomcat and jetty versions of Geronimo.

      The problem can be tracked down to a line missing from the static block in /plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java:

      GERONIMO_SCHEMA_CONVERSIONS.put("env-entry", new NamespaceElementConverter(GERONIMO_NAMING_NAMESPACE));
      

      Adding this line allows the deployment of the war with the env-entry correctly supplied.

      Attachments

        1. geronimo-5672.tar.bz2
          1 kB
          Brian Atkinson
        2. G5672.patch
          0.9 kB
          viola.lu

        Issue Links

          Activity

            People

              viola.lu viola.lu
              nairb774 Brian Atkinson
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: