OpenEJB
  1. OpenEJB
  2. OPENEJB-854

Parsing of an openejb-jar.xml fails on <gbean-ref>s

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0-beta-2
    • Fix Version/s: None
    • Component/s: container system
    • Labels:
      None
    • Environment:
      Kubuntu, Java 1.5.0_15, Geronimo 2.1

      Description

      Deploying an EAR on Geronimo, which contains an EJB with a reference to a GBean, fails with an OpenEJBException:

      Failed parsing descriptors for module: /home/jkh/DEV/appservers/geronimo-tomcat6-javaee5-2.1/var/temp/geronimo-deploymentUtil30955.jar
      org.apache.geronimo.common.DeploymentException: Failed parsing descriptors for module: /home/jkh/DEV/appservers/geronimo-tomcat6-javaee5-2.1/var/temp/geronimo-deploymentUtil30955.jar
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.createModule(EjbModuleBuilder.java:299)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.createModule(EjbModuleBuilder.java:228)
      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.addModules(EARConfigBuilder.java:786)
      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getEarPlan(EARConfigBuilder.java:402)
      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.getDeploymentPlan(EARConfigBuilder.java:295)
      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:226)
      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
      at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
      at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
      at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
      at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
      at org.apache.geronimo.deployment.plugin.local.RedeployCommand.redeploySameConfiguration(RedeployCommand.java:225)
      at org.apache.geronimo.deployment.plugin.local.RedeployCommand.run(RedeployCommand.java:101)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: org.apache.openejb.OpenEJBException: Cannot unmarshall the openejb-jar.xml. Xml content written to: /home/jkh/DEV/appservers/geronimo-tomcat6-javaee5-2.1/var/temp/openejb-jar-30956.xml: unexpected element (uri:"http://geronimo.apache.org/xml/ns/naming-1.2", local:"ref-name"). Expected elements are <

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      ref-type>,<

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      pattern>,<

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      ref-name>
      at org.apache.openejb.config.ReadDescriptors.readOpenejbJar(ReadDescriptors.java:224)
      at org.apache.openejb.config.ReadDescriptors.deploy(ReadDescriptors.java:78)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.createModule(EjbModuleBuilder.java:297)
      ... 18 more
      Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://geronimo.apache.org/xml/ns/naming-1.2", local:"ref-name"). Expected elements are <

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      ref-type>,<

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      pattern>,<

      {http://openejb.apache.org/xml/ns/openejb-jar-2.2}

      ref-name>
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:523)
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71)
      at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:65)
      at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:209)
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:366)
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:347)
      at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:101)
      at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
      at org.apache.openejb.jee.oejb2.NamespaceFilter.startElement(NamespaceFilter.java:180)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
      at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:194)
      at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:167)
      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:120)
      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:103)
      at org.apache.openejb.jee.oejb2.JaxbOpenejbJar2.unmarshal(JaxbOpenejbJar2.java:104)
      at org.apache.openejb.jee.oejb2.JaxbOpenejbJar2.unmarshal(JaxbOpenejbJar2.java:66)
      at org.apache.openejb.config.ReadDescriptors.readOpenejbJar(ReadDescriptors.java:134)
      ... 20 more

      Example openejb-jar.xml:

      <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2">
      <enterprise-beans>
      <session>
      <ejb-name>DummyEJB</ejb-name>
      <gbean-ref>
      <ref-name>LocalGBeanName</ref-name>
      <pattern>
      <name>GlobalGBeanName</name>
      </pattern>
      </gbean-ref>
      </session>
      </enterprise-beans>
      </openejb-jar>

      This problem was reported by "dsthode" on the geronimo-user mailinglist (2008-06-25).

        Activity

        Janko Heilgeist created issue -
        Hide
        Janko Heilgeist added a comment -

        Fix for the aforementioned problem. OpenEJB forces the namespace of the <ref-name> and <ref-type> tags inside the <gbean-ref> to the correct value of "http://geronimo.apache.org/xml/ns/naming-1.2". This happens regardless of the namespace specified in the deployment descriptor (see container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/NamespaceFilter.java).

        The parsing of the deployment descriptor via JAXB depends on the class GBeanRefType (see container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/GbeanRefType.java) which is missing the correct namespace attribute in its @XmlType annotation. Therefore, the default namespace of "http://openejb.apache.org/xml/ns/openejb-jar-2.2" is expected by JAXB which results in the reported exception.

        The attached patch inserts the correct namespace attribute into the @XmlType annotation.

        Show
        Janko Heilgeist added a comment - Fix for the aforementioned problem. OpenEJB forces the namespace of the <ref-name> and <ref-type> tags inside the <gbean-ref> to the correct value of "http://geronimo.apache.org/xml/ns/naming-1.2". This happens regardless of the namespace specified in the deployment descriptor (see container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/NamespaceFilter.java). The parsing of the deployment descriptor via JAXB depends on the class GBeanRefType (see container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/GbeanRefType.java) which is missing the correct namespace attribute in its @XmlType annotation. Therefore, the default namespace of "http://openejb.apache.org/xml/ns/openejb-jar-2.2" is expected by JAXB which results in the reported exception. The attached patch inserts the correct namespace attribute into the @XmlType annotation.
        Janko Heilgeist made changes -
        Field Original Value New Value
        Attachment fix-gbeanreftype-xmlns.patch [ 12385707 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Janko Heilgeist
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development