3 Replies Latest reply on Sep 17, 2012 8:28 AM by chandrarsa

    Deployment exception: "found in jboss.xml but not in ejb-jar

    michael.sanders

      I'm trying to deploy my application to JBoss 3.2.3, having developed it on (and exported my EAR from) WebSphere v5. I've encountered and solved a few hurdles along the way, but I've been stuck on this one problem related to JDBC data source references for two days. I have searched the forums, google, other JBoss discussion sites etc but have not been able to solve it.

      My stateless session bean "MDBJDBCConnectionFactory" declares a resource reference "jdbc/MDBDataSource", which I'm trying to bind via jboss.xml to the concrete data source "java:/jdbc/TeraSolve_SQL".

      I get the following exception when deploying my EAR:

      12:44:42,298 INFO [EARDeployer] Init J2EE application: file:/C:/JBoss/jboss-3.2
      .3/server/all/deploy/TeraSolve_SQL.ear
      12:44:43,626 ERROR [XmlFileLoader] failed to load jboss.xml. There could be a s
      yntax error.
      org.jboss.deployment.DeploymentException: Error in jboss.xml for Bean MDBJDBCCon
      nectionFactory: found in jboss.xml but not in ejb-jar.xml
      at org.jboss.metadata.ApplicationMetaData.importJbossXml(ApplicationMeta
      Data.java:764)
      at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:175)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:436)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:786)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:778)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:641)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at java.lang.reflect.Method.invoke(Native Method)

      My EAR contains several ejb jars. The deployment descriptors for the ejb jar for which the exception is related are:

      ejb-jar.xml:
      --------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <display-name>TDBUtilsEJB</display-name>
      <enterprise-beans>

      <ejb-name>MDBJDBCConnectionFactory</ejb-name>
      <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
      com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
      <ejb-class>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>
      <resource-ref>

      <res-ref-name>jdbc/MDBDataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Application</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
      </resource-ref>


      <ejb-name>MDBSnapshotManager</ejb-name>
      <local-home>com.dss.server.xdb.snapshot.MDBSnapshotManagerLocalHome</local-home>
      com.dss.server.xdb.snapshot.MDBSnapshotManagerLocal
      <ejb-class>com.dss.server.xdb.snapshot.MDBSnapshotManagerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
      com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
      <ejb-link>MDBJDBCConnectionFactory</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>


      <ejb-name>MDBBMTController</ejb-name>
      <local-home>com.dss.server.xdb.MDBBMTControllerLocalHome</local-home>
      com.dss.server.xdb.MDBBMTControllerLocal
      <ejb-class>com.dss.server.xdb.MDBBMTControllerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>


      <ejb-name>ResourceLockSession</ejb-name>
      <local-home>com.dss.server.xdb.lock.ResourceLockSessionLocalHome</local-home>
      com.dss.server.xdb.lock.ResourceLockSessionLocal
      <ejb-class>com.dss.server.xdb.lock.ResourceLockSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
      com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
      <ejb-link>MDBJDBCConnectionFactory</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>


      <ejb-name>SessionIdManager</ejb-name>
      <local-home>com.dss.server.xdb.session.SessionIdManagerLocalHome</local-home>
      com.dss.server.xdb.session.SessionIdManagerLocal
      <ejb-class>com.dss.server.xdb.session.SessionIdManagerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
      com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
      <ejb-link>MDBJDBCConnectionFactory</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>


      <ejb-name>RDBLoggerSession</ejb-name>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-class>com.dss.server.xdb.logging.RDBLoggerSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <ejb-name>SecurityAuthoriserSession</ejb-name>
      <local-home>com.dss.server.xdb.security.SecurityAuthoriserSessionLocalHome</local-home>
      com.dss.server.xdb.security.SecurityAuthoriserSessionLocal
      <ejb-class>com.dss.server.xdb.security.SecurityAuthoriserSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>

      <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
      com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
      <ejb-link>MDBJDBCConnectionFactory</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref>

      <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
      com.dss.server.xdb.logging.RDBLoggerSessionLocal
      <ejb-link>RDBLoggerSession</ejb-link>
      </ejb-local-ref>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>SessionIdManager</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getSessionId</method-name>
      <method-params>
      </method-params>

      <trans-attribute>RequiresNew</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      jboss.xml
      -----------

      <enterprise-beans>

      <ejb-name>MDBJDBCConnectionFactory</ejb-name>
      <resource-ref>
      <res-ref-name>jdbc/MDBDataSource</res-ref-name>
      <jndi-name>java:/jdbc/TeraSolve_SQL</jndi-name>
      </resource-ref>

      </enterprise-beans>


      Things I've checked:
      0) This is indeed the first exception to occur.
      1) The session bean "MDBJDBCConnectionFactory" referenced in my jboss.xml does indeed exist in the EAR, with exactly the same name.
      2) The app deploys ok if I don't specify a jboss.xml for that ejb jar. Of course, it fails when bean "MDBJDBCConnectionFactory" first tries to use the data source, but it imples that the ejb-jar is probably ok...
      3) The concrete data source seems to be ok, as I get the message "2004-06-08 12:44:39,876 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.jdbc/TeraSolve_SQL] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=jdbc/TeraSolve_SQL to JNDI name 'java:/jdbc/TeraSolve_SQL'" in the JBoss log.

      Any help appreciated! Please point out where I'm missing something obvious!

      Thanks,
      - Michael

        • 1. Re: Deployment exception:
          ovidiu.feodorov

          Are you sure your ejb-jar.xml deploys fine? I am asking this because my jboss instance says something like "The Bean Provider must provide a remote interface and a remote home interface or a local interface and a local home interface for the bean." when I am trying to deploy a ejb-xml.jar that omits < local > tags.

          I see you declare <ejb-name>, <local-home> and everything, but you don't explicitely tag your local interface class name:

          ...
          <ejb-name>MDBJDBCConnectionFactory</ejb-name>
          <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
          com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal
          <ejb-class>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
          ...
          


          • 2. Re: Deployment exception:
            michael.sanders

            The "local" tags didn't show up in my first message! I've figured it out now:

            ejb-jar.xml
            -------------

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
            <ejb-jar>
             <display-name>TDBUtilsEJB</display-name>
             <enterprise-beans>
             <session>
             <ejb-name>MDBJDBCConnectionFactory</ejb-name>
             <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
             <local>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal</local>
             <ejb-class>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             <resource-ref>
             <description></description>
             <res-ref-name>jdbc/MDBDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Application</res-auth>
             <res-sharing-scope>Shareable</res-sharing-scope>
             </resource-ref>
             </session>
             <session>
             <ejb-name>MDBSnapshotManager</ejb-name>
             <local-home>com.dss.server.xdb.snapshot.MDBSnapshotManagerLocalHome</local-home>
             <local>com.dss.server.xdb.snapshot.MDBSnapshotManagerLocal</local>
             <ejb-class>com.dss.server.xdb.snapshot.MDBSnapshotManagerBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
             <local>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal</local>
             <ejb-link>MDBJDBCConnectionFactory</ejb-link>
             </ejb-local-ref>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             </session>
             <session>
             <ejb-name>MDBBMTController</ejb-name>
             <local-home>com.dss.server.xdb.MDBBMTControllerLocalHome</local-home>
             <local>com.dss.server.xdb.MDBBMTControllerLocal</local>
             <ejb-class>com.dss.server.xdb.MDBBMTControllerBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             </session>
             <session>
             <ejb-name>ResourceLockSession</ejb-name>
             <local-home>com.dss.server.xdb.lock.ResourceLockSessionLocalHome</local-home>
             <local>com.dss.server.xdb.lock.ResourceLockSessionLocal</local>
             <ejb-class>com.dss.server.xdb.lock.ResourceLockSessionBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
             <local>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal</local>
             <ejb-link>MDBJDBCConnectionFactory</ejb-link>
             </ejb-local-ref>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             </session>
             <session>
             <ejb-name>SessionIdManager</ejb-name>
             <local-home>com.dss.server.xdb.session.SessionIdManagerLocalHome</local-home>
             <local>com.dss.server.xdb.session.SessionIdManagerLocal</local>
             <ejb-class>com.dss.server.xdb.session.SessionIdManagerBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
             <local>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal</local>
             <ejb-link>MDBJDBCConnectionFactory</ejb-link>
             </ejb-local-ref>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             </session>
             <session>
             <ejb-name>RDBLoggerSession</ejb-name>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-class>com.dss.server.xdb.logging.RDBLoggerSessionBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             </session>
             <session>
             <ejb-name>SecurityAuthoriserSession</ejb-name>
             <local-home>com.dss.server.xdb.security.SecurityAuthoriserSessionLocalHome</local-home>
             <local>com.dss.server.xdb.security.SecurityAuthoriserSessionLocal</local>
             <ejb-class>com.dss.server.xdb.security.SecurityAuthoriserSessionBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/MDBJDBCConnectionFactory</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocalHome</local-home>
             <local>com.dss.server.xdb.jdbc.MDBJDBCConnectionFactoryLocal</local>
             <ejb-link>MDBJDBCConnectionFactory</ejb-link>
             </ejb-local-ref>
             <ejb-local-ref>
             <description></description>
             <ejb-ref-name>ejb/RDBLoggerSession</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local-home>com.dss.server.xdb.logging.RDBLoggerSessionLocalHome</local-home>
             <local>com.dss.server.xdb.logging.RDBLoggerSessionLocal</local>
             <ejb-link>RDBLoggerSession</ejb-link>
             </ejb-local-ref>
             </session>
             </enterprise-beans>
             <assembly-descriptor>
             <container-transaction>
             <method>
             <ejb-name>SessionIdManager</ejb-name>
             <method-intf>Local</method-intf>
             <method-name>getSessionId</method-name>
             <method-params>
             </method-params>
             </method>
             <trans-attribute>RequiresNew</trans-attribute>
             </container-transaction>
             </assembly-descriptor>
            </ejb-jar>
            


            jboss.xml
            ------------
            <jboss>
             <enterprise-beans>
             <session>
             <ejb-name>MDBJDBCConnectionFactory</ejb-name>
             <resource-ref>
             <res-ref-name>jdbc/MDBDataSource</res-ref-name>
             <jndi-name>java:/jdbc/TeraSolve_SQL</jndi-name>
             </resource-ref>
             </session>
             </enterprise-beans>
            </jboss>
            


            • 3. Re: Deployment exception:
              chandrarsa

              Hi there,

               

              I am also getting same exception when deploy sample session bean jdk1.7 and jboss4.5.1 version server. Kindly solve the problem. I attached source code with deployment descriptors. I assume problem with deployment descriptor hence just I created with session bean with empty unimplemented methods.