6 Replies Latest reply on Sep 18, 2012 11:57 PM by Chandra Shekhar

    Please help: Error in jboss.xml for Bean found in jboss.xml but not in ejb-jar.xml

    Andrew Le Newbie

      I need help configuring the jboss.xml file. According to JBoss documentation at http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch5.chapter.html, if we want to configure an entity EJB bean using  “Instance Per Transaciton Policy”, we need to do the following:

      <jboss>

      <enterprise-beans>

      <entity>

      <ejb-name>MyCMP2Bean</ejb-name>

      <jndi-name>MyCMP2</jndi-name>

      <configuration-name>

      Instance Per Transaction CMP 2.x EntityBean

      </configuration-name>

      </entity>

      <entity>

      <ejb-name>MyBMPBean</ejb-name>

      <jndi-name>MyBMP</jndi-name>

      <configuration-name>

      Instance Per Transaction BMP EntityBean

      </configuration-name>

      </entity>

      </enterprise-beans>

      </jboss>

       

      However, I tried this in our JBoss server, but got the error below.

      2012-06-20 17:54:32,962 -0700 level=ERROR class=org.jboss.metadata.XmlFileLoader [Thread: main] org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:205) failed to load jboss.xml.  There could be a syntax error.

      • org.jboss.deployment.DeploymentException: Error in jboss.xml for Bean com.eistream.sonora.users.UsersEntityEJBHome: found in jboss.xml but not in ejb-jar.xml

              at org.jboss.metadata.ApplicationMetaData.importJbossXml(ApplicationMetaData.java:956)

              at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:200)

              at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:541)

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

              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)

              at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)

              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

              at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)

        at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)

       

      My ejb-jar.xml file is:

      <?xml version="1.0" encoding="UTF-8"?>

      <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.2"

          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_2.xsd">

            <display-name>SonoraBeans</display-name>

            <enterprise-beans>


      <entity>

      <ejb-name>com.eistream.sonora.users.UsersEntityEJBHome</ejb-name>

      <home>com.eistream.sonora.users.UsersEntityEJBHome</home>

      <remote>com.eistream.sonora.users.UsersEntityEJB</remote>

      <local-home>com.eistream.sonora.users.UsersEntityEJBLocalHome</local-home>

      <local>com.eistream.sonora.users.UsersEntityEJBLocal</local>

      <ejb-class>com.eistream.sonora.users.UsersEntityEJBBean</ejb-class>

      <persistence-type>Bean</persistence-type>

      <prim-key-class>com.eistream.sonora.users.UsersEntityEJBPK</prim-key-class>

      <reentrant>false</reentrant>

      </entity>

         </enterprise-beans>

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

      </ejb-jar>

       

      And the Jboss.xml file is:

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">

      <jboss>

        <security-domain>java:/jaas/Sonora</security-domain>

        <enterprise-beans>

          <entity>
              <ejb-name>com.eistream.sonora.users.UsersEntityEJBHome</ejb-name>
              <jndi-name>com.eistream.sonora.users.UsersEntityEJBHome</jndi-name>
              <configuration-name>Instance Per Transaction CMP 2.x EntityBean</configuration-name>
          </entity>

        </enterprise-beans>

        <container-configurations>

         <container-configuration>

          <container-name>Standard BMP EntityBean</container-name>

           <commit-option>C</commit-option>

          </container-configuration>

        </container-configurations>

      </jboss>

       

      Any help is greatly appreciated. I have searched on Google for almost a day and did not find the answer to this problem.

       

      Andy