2 Replies Latest reply on Sep 9, 2003 1:41 PM by smehta

    Help- Error in ejb-jar.xml for Entity Bean Attribute: expect

    smehta Newbie

      Hello all

      I am trying to upgrade from JBoss 2.2 to 3.21. In order to speed up performance, I have changed our EJBs to use local-home and local but am running into some error conditions.

      While deploying my entity beans I get an "Expected one home tag Error" and have descibed the exception below -

      Here is an excerpt of my ejb-jar.xml

      ..........................................................

      <!-- Attribute -->


      Attribute Desc.


      <ejb-name>AttributeBean</ejb-name>
      <local-home>test.ejb.AttributeHome</local-home>
      test.ejb.Attribute
      <ejb-class>test.ejb.AttributeBean</ejb-class>

      <persistence-type>Bean</persistence-type>
      <prim-key-class>test.ejb.AttributePK</prim-key-class>

      False

      <ejb-ref>
      <ejb-ref-name>ejb/RelationToAttrBean</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>RelationToAttrHome</local-home>
      RelationToAttr
      <ejb-link>RelationToAttrBean</ejb-link>
      </ejb-ref>

      <resource-ref>
      DataSource for myTest
      <res-ref-name>jdbc/myTest</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>



      <!-- RelationToAttr -->


      Relationship between attributes.


      <ejb-name>RelationToAttrBean</ejb-name>
      <local-home>test.ejb.RelationToAttrHome</local-home>
      test.ejb.RelationToAttr
      <ejb-class>test.ejb.RelationToAttrBean</ejb-class>

      <persistence-type>Bean</persistence-type>
      <prim-key-class>test.ejb.RelationToAttrPK</prim-key-class>

      False

      <resource-ref>
      DataSource for myTest
      <res-ref-name>jdbc/myTest</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      <ejb-ref>
      <ejb-ref-name>ejb/AttributeBean</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      AttributeHome
      Attribute
      <ejb-link>AttributeBean</ejb-link>
      </ejb-ref>



      <!-- Permissions -->

      <method-permission>
      <role-name>everyone</role-name>

      <ejb-name>AttributeBean</ejb-name>
      <method-name>*</method-name>

      </method-permission>


      <container-transaction>

      <ejb-name>AttributeBean</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      ..................................................................

      When I deploy this Bean, I get the following error:

      13:00:55,525 ERROR [MainDeployer] could not create deployment: file:/D:/UpGradeJBoss/Final/32/TestArea3.2/server/default
      /deploy/MyTestBeans.jar
      org.jboss.deployment.DeploymentException: Error in ejb-jar.xml for Entity Bean AttributeBean: expected one home tag
      at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:252)
      at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:141)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:433)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:784)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:639)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)

      Would appreciate any help on the matter.

      Thx

      smehta

        • 1. Re: Help- Error in ejb-jar.xml for Entity Bean Attribute: ex
          Vishal Sharma Expert

          What I can see from DD, yoy have two beans in realtionship, and bothe uses each other.
          Also both beans beans are in same JVM, Thoughu you you rae usinf local home and local remote object in tags but for reference you are using ejb-ref, which should be <ejb-local-ref>.
          And similarly make sure since your are using local interface make sure yor ejb-ref-name is like ejb/AttributeBeanLocal provided you have "java:comp/env/ejb/AttributeBeanLocal" while creating yr bean.

          I hope this helps.

          Cheeers.............
          Vishal

          • 2. Re: Help- Error in ejb-jar.xml for Entity Bean Attribute: ex
            smehta Newbie

            Thanks for your input.

            I changed my ejb-jar to look like
            ----------------excerpt start-----------------


            Attribute Desc.


            <ejb-name>AttributeBean</ejb-name>
            <local-home>test.ejb.AttributeHome</local-home>
            test.ejb.Attribute
            <ejb-class>test.ejb.AttributeBean</ejb-class>

            <persistence-type>Bean</persistence-type>
            <prim-key-class>test.ejb.AttributePK</prim-key-class>

            False

            <ejb-local-ref>
            <ejb-ref-name>ejb/RelationToAttrBean</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            <local-home>RelationToAttrHome</local-home>
            RelationToAttr
            <ejb-link>RelationToAttrBean</ejb-link>
            </ejb-local-ref>

            <resource-ref>
            DataSource for myTest
            <res-ref-name>jdbc/myTest</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>



            <!-- RelationToAttr -->


            Relationship between attributes.


            <ejb-name>RelationToAttrBean</ejb-name>
            <local-home>test.ejb.RelationToAttrHome</local-home>
            test.ejb.RelationToAttr
            <ejb-class>test.ejb.RelationToAttrBean</ejb-class>

            <persistence-type>Bean</persistence-type>
            <prim-key-class>test.ejb.RelationToAttrPK</prim-key-class>

            False

            <resource-ref>
            DataSource for myTest
            <res-ref-name>jdbc/myTest</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>

            <ejb-local-ref>
            <ejb-ref-name>ejb/AttributeBean</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            <local-home>AttributeHome</local-home>
            Attribute
            <ejb-link>AttributeBean</ejb-link>
            </ejb-local-ref>



            ----------------excerpt end-----------------
            Is there something I need to take care of when I have these 2 beans in relationship?

            Originally our system was using JBoss 2.2 and using home and remote interfaces.Although
            our application worked fine, the speed of it was quite slow.
            I was tasked with looking into upgrading to 3.2.1 and also to see if local object reference
            would improve performance.

            After making thc changes you suggested, I still get the following exceptions when I
            try to deploy my Bean -

            14:50:32,049 ERROR [MainDeployer] could not create deployment: file:/D:/UpGradeJBoss/Final/32/TestArea3.2/server/default
            default/deploy/MyTestBeans.jar

            org.jboss.deployment.DeploymentException: Error in ejb-jar.xml for Entity Bean RelationToAttrBean: expected one local-ho
            me tag
            at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:252)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:141)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:433)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:784)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:639)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
            at java.lang.reflect.Method.invoke(Native Method)