1 Reply Latest reply on Aug 6, 2010 9:29 AM by Wolfgang Knauf

    Unable to deploy CMP entity to JBoss AS 5.1.0.GA

    Tao Xiao Newbie

      Hi all,

       

      I am now migrating a project to JBoss AS 5.1.GA. I got stuck when deploying a ejb jar to JBoss.

       

      Here is the exception I got:

       

       

      [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@2424c672[ defaultDomain='jboss' ]
      10:20:18,416 ERROR [AbstractKernelController] Error installing to Parse: name=vfsfile:/Applications/Tools/jboss-5.1.0.GA/server/mitapps-02/deploy/mitapps/BrandingManagement.jar/ state=Not Installed mode=Manual requiredState=Parse
      org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/Applications/Tools/jboss-5.1.0.GA/server/mitapps-02/deploy/mitapps/BrandingManagement.jar/
      at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
      at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
      at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
      at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
      at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:95)
      at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
      at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
      at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
      at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
      at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
      at org.jboss.Main.boot(Main.java:221)
      at org.jboss.Main$1.run(Main.java:556)
      at java.lang.Thread.run(Thread.java:637)
      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: {http://www.jboss.com/xml/ns/javaee}entity cannot appear in this position. Expected content of {http://www.jboss.com/xml/ns/javaee}enterprise-beans is sequence: {choice}*
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
      at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
      at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:189)
      at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:166)
      at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:137)
      at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:121)
      at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
      at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:188)
      at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:348)
      ... 34 more
      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {http://www.jboss.com/xml/ns/javaee}entity cannot appear in this position. Expected content of {http://www.jboss.com/xml/ns/javaee}enterprise-beans is sequence: {choice}*
      at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:449)
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401)
      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199)
      ... 42 more
      
      
      

       

       

       

       

      And here is my ejb-jar.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
           version="2.1">
      
      
      
        <enterprise-beans>
          <session>
            <ejb-name>BrandingService</ejb-name>
            <home>com.melbourneit.brandingmgmt.ejb.BrandingServiceHome</home>
            <remote>com.melbourneit.brandingmgmt.ejb.BrandingService</remote>
            <ejb-class>com.melbourneit.brandingmgmt.ejb.BrandingServiceBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
            <ejb-local-ref>
              <ejb-ref-name>ejb/BrandingEJB</ejb-ref-name>
              <ejb-ref-type>Entity</ejb-ref-type>
              <local-home>com.melbourneit.brandingmgmt.ejb.BrandingEJBHome</local-home>
              <local>com.melbourneit.brandingmgmt.ejb.BrandingEJB</local>
              <ejb-link>BrandingEJB</ejb-link>
            </ejb-local-ref>
            <ejb-local-ref>
              <ejb-ref-name>ejb/BrandStyleEJB</ejb-ref-name>
              <ejb-ref-type>Entity</ejb-ref-type>
              <local-home>com.melbourneit.brandingmgmt.ejb.BrandStyleEJBHome</local-home>
              <local>com.melbourneit.brandingmgmt.ejb.BrandStyleEJB</local>
              <ejb-link>BrandStyleEJB</ejb-link>
            </ejb-local-ref>
            <security-role-ref>
              <role-name>StaffRole</role-name>
              <role-link>staff</role-link>
            </security-role-ref>
          </session>
          
          <entity>
            <ejb-name>BrandStyleEJB</ejb-name>
            <local-home>com.melbourneit.brandingmgmt.ejb.BrandStyleEJBHome</local-home>
            <local>com.melbourneit.brandingmgmt.ejb.BrandStyleEJB</local>
            <ejb-class>com.melbourneit.brandingmgmt.ejb.BrandStyleEJBBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>false</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>BrandStyleEJB</abstract-schema-name>
            <cmp-field>
              <field-name>brandStyleId</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>updateDate</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>brandCss</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>brandLogo</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>mimeType</field-name>
            </cmp-field>
            <primkey-field>brandStyleId</primkey-field>
          </entity>
      
          <entity>
            <ejb-name>BrandingEJB</ejb-name>
            <local-home>com.melbourneit.brandingmgmt.ejb.BrandingEJBHome</local-home>
            <local>com.melbourneit.brandingmgmt.ejb.BrandingEJB</local>
            <ejb-class>com.melbourneit.brandingmgmt.ejb.BrandingEJBBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>false</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>BrandingEJB</abstract-schema-name>
            <cmp-field>
              <field-name>brandCode</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>channelTypeId</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>operationTypeId</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>merchantId</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>brandedDomainName</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>statusCode</field-name>
            </cmp-field>
            <cmp-field>
              <field-name>brandId</field-name>
            </cmp-field>
            <primkey-field>brandId</primkey-field>
            <query>
              <query-method>
                <method-name>findActiveBrandByChannelTypeAndBrandCode</method-name>
                <method-params>
                  <method-param>int</method-param>
                  <method-param>java.lang.String</method-param>
                  <method-param>int</method-param>
                </method-params>
              </query-method>
              <ejb-ql>SELECT OBJECT(b) FROM BrandingEJB
      AS b WHERE b.channelTypeId = ?1 AND
      b.brandCode = ?2 AND
      b.operationTypeId = ?3 AND
      b.statusCode = 'ENABLED'</ejb-ql>
            </query>
          </entity>
      
        </enterprise-beans>
      
        <relationships>
      
          <ejb-relation>
            <ejb-relation-name>brandStyle-branding</ejb-relation-name>
            <ejb-relationship-role>
              <description>brandStyleEJB</description>
              <ejb-relationship-role-name>BrandStyleRelationshipRole</ejb-relationship-role-name>
              <multiplicity>One</multiplicity>
              <relationship-role-source>
                <description>brandStyleEJB</description>
                <ejb-name>BrandStyleEJB</ejb-name>
              </relationship-role-source>
              <cmr-field>
                <description>brandingEJB</description>
                <cmr-field-name>brandingCMR</cmr-field-name>
                <cmr-field-type>java.util.Set</cmr-field-type>
              </cmr-field>
            </ejb-relationship-role>
      
            <ejb-relationship-role>
              <description>brandingEJB</description>
              <ejb-relationship-role-name>BrandingRelationshipRole</ejb-relationship-role-name>
              <multiplicity>Many</multiplicity>
              <relationship-role-source>
                <description>brandingEJB</description>
                <ejb-name>BrandingEJB</ejb-name>
              </relationship-role-source>
              <cmr-field>
                <description>brandStyleEJB</description>
                <cmr-field-name>brandStyleCMR</cmr-field-name>
              </cmr-field>
            </ejb-relationship-role>
          </ejb-relation>
      
        </relationships>
      
        <assembly-descriptor>
      
          <security-role>
            <role-name>staff</role-name>
          </security-role>
      
             <method-permission>
                  <role-name>staff</role-name>
                  <method>
                       <ejb-name>BrandingService</ejb-name>
                       <method-intf>Remote</method-intf>
                       <method-name>*</method-name>
                  </method>
             </method-permission>
      
             <method-permission>
                  <role-name>staff</role-name>
                    <method>
                       <ejb-name>BrandingService</ejb-name>
                       <method-intf>Home</method-intf>
                       <method-name>*</method-name>
                  </method>           
             </method-permission>
      
          <container-transaction>
            <method>
              <ejb-name>BrandStyleEJB</ejb-name>
              <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
          </container-transaction>
      
          <container-transaction>
            <method>
              <ejb-name>BrandingEJB</ejb-name>
              <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
          </container-transaction>
      
          <container-transaction>
            <method>
              <ejb-name>BrandingService</ejb-name>
              <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
          </container-transaction>
      
        </assembly-descriptor>
      
      </ejb-jar>
      
       
      

       

       

      This configuration works in JBoss 4 but not 5.

       

      Thanks in advanced.

        • 1. Re: Unable to deploy CMP entity to JBoss AS 5.1.0.GA
          Wolfgang Knauf Master

          Hi,

           

          I think the syntax error is not in "ejb-jar.xml" but in "jboss.xml":

           

          org.jboss.xb.binding.JBossXBRuntimeException: {http://www.jboss.com/xml/ns/javaee}entity cannot appear in this position. Expected content of {http://www.jboss.com/xml/ns/javaee}enterprise-beans is sequence: {choice}*

           

          JBoss 5.x became more strict on XML parsing, so that things that worked before (but were wrong) now become errors.

           

          Best regards

           

          Wolfgang