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

                 Key: GERONIMO-5672
                 URL: https://issues.apache.org/jira/browse/GERONIMO-5672
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: deployment
    Affects Versions: 2.2, 2.1.6
            Reporter: Brian Atkinson


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):

{noformat}
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-...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  cluster...@http://geronimo.apache.org/xml/ns/j2ee/application-2.0
  web-contai...@http://geronimo.apache.org/xml/ns/naming-1.2
  h...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  cross-cont...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  disable-cook...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  valve-ch...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  listener-ch...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  tomcat-re...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  mana...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1 
  clus...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  abstract-naming-en...@http://geronimo.apache.org/xml/ns/naming-1.2
  env-en...@http://geronimo.apache.org/xml/ns/naming-1.2
  ejb-...@http://geronimo.apache.org/xml/ns/naming-1.2
  ejb-local-...@http://geronimo.apache.org/xml/ns/naming-1.2
  service-...@http://geronimo.apache.org/xml/ns/naming-1.2
  resource-...@http://geronimo.apache.org/xml/ns/naming-1.2
  resource-env-...@http://geronimo.apache.org/xml/ns/naming-1.2
  message-destinat...@http://geronimo.apache.org/xml/ns/naming-1.2
  security-realm-n...@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1
  serv...@http://geronimo.apache.org/xml/ns/deployment-1.2
  persiste...@http://java.sun.com/xml/ns/persistence' instead of 
'env-en...@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>
{noformat}

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:
{noformat}
GERONIMO_SCHEMA_CONVERSIONS.put("env-entry", new 
NamespaceElementConverter(GERONIMO_NAMING_NAMESPACE));
{noformat}

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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to