3 Replies Latest reply on Sep 11, 2002 10:04 AM by sgwood

    Wierd deployment problem with MDB

      I have an EJB jar with a mixture of CMP 2.0 entity beans and MDBs. I am having a strange problem deploying this jar into JBoss 3.0.2.

      Here is a snippet from the ejb-jar.xml, which was generated through XDoclet.

      <ejb-jar >

      <enterprise-beans>

      ... other entity beans




      <![CDATA[The Entity bean represents Tasks]]>
      <display-name>Tasks in the CPI application</display-name>

      <ejb-name>CPI/Task</ejb-name>

      com.sherman.cpi.jboss.interfaces.TaskHome
      com.sherman.cpi.jboss.interfaces.Task
      <local-home>com.sherman.cpi.jboss.interfaces.TaskLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.TaskLocal

      <ejb-class>com.sherman.cpi.jboss.ejb.TaskCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Task</abstract-schema-name>
      <cmp-field >
      ... lots of them
      </cmp-field>
      <primkey-field>uid</primkey-field>

      <ejb-local-ref >
      <ejb-ref-name>ejb/CPI/ClaimLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sherman.cpi.jboss.interfaces.ClaimLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.ClaimLocal
      <ejb-link>CPI/Claim</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref >
      <ejb-ref-name>ejb/CPI/SuffixLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sherman.cpi.jboss.interfaces.SuffixLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.SuffixLocal
      <ejb-link>CPI/Suffix</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref >
      <ejb-ref-name>ejb/CPI/ProcIdLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sherman.cpi.jboss.interfaces.ProcIdLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.ProcIdLocal
      <ejb-link>CPI/ProcId</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref >
      <ejb-ref-name>ejb/CPI/FunctionLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sherman.cpi.jboss.interfaces.FunctionLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.FunctionLocal
      <ejb-link>CPI/Function</ejb-link>
      </ejb-local-ref>
      <ejb-local-ref >
      <ejb-ref-name>ejb/CPI/ReasonCodeLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.sherman.cpi.jboss.interfaces.ReasonCodeLocalHome</local-home>
      com.sherman.cpi.jboss.interfaces.ReasonCodeLocal
      <ejb-link>CPI/ReasonCode</ejb-link>
      </ejb-local-ref>


      <query-method>
      <method-name>ejbSelectFindByDiaryKey</method-name>
      <method-params>
      <method-param>com.sherman.cpi.jboss.interfaces.ClaimLocal</method-param>
      <method-param>com.sherman.cpi.jboss.interfaces.ProcIdLocal</method-param>
      <method-param>java.sql.Date</method-param>
      <method-param>java.lang.Integer</method-param>
      </method-params>
      </query-method>
      <ejb-ql><![CDATA[SELECT OBJECT(t) FROM Task AS t WHERE t.claim = ?1 AND t.assignedToProcId = ?2 AND t.dueDate = ?3 and t.sequenceNumber = ?4]]></ejb-ql>






      ... other entity beans



      <!-- Message Driven Beans -->
      <message-driven >
      <![CDATA[An MDB processing Claim and Suffix XML]]>
      <display-name>Claim and Suffix XML message processor</display-name>

      <ejb-name>CPI/mdb/ClaimSummaryReader</ejb-name>

      <ejb-class>com.sherman.cpi.jboss.messagebean.ClaimSummaryReaderBean</ejb-class>

      <transaction-type>Bean</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>NonDurable</subscription-durability>
      </message-driven-destination>

      </message-driven>

      <message-driven >
      <![CDATA[An MDB processing Diary XML]]>
      <display-name>Diary XML message processor</display-name>

      <ejb-name>CPI/mdb/DiarySummaryReader</ejb-name>

      <ejb-class>com.sherman.cpi.jboss.messagebean.DiaryReaderBean</ejb-class>

      <transaction-type>Bean</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>NonDurable</subscription-durability>
      </message-driven-destination>

      </message-driven>

      </enterprise-beans>

      <!-- Relationships -->

      <ejb-relation >
      <ejb-relation-name>task-assignedByProcid</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>assignedByProcId</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>assignedByProcId</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/ProcId</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-reasonCode</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>reasonCode</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>reasonCode</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/ReasonCode</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-originatingFunction</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>originatingFunction</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>originatingFunction</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Function</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-suffix</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>suffix</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>suffix</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Suffix</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-taskFunction</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>taskFunction</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>taskFunction</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Function</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-claim</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>claim</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>claim</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Claim</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation >
      <ejb-relation-name>task-assignedToProcid</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>task</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/Task</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>assignedToProcId</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>assignedToProcId</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>CPI/ProcId</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      .... other relations


      <!-- Assembly Descriptor -->
      <assembly-descriptor >
      ...
      </assembly-descriptor>

      </ejb-jar>


      When I deploy the jar, I get the following messages in the server.log

      2002-09-10 06:01:35,312 INFO [org.jboss.ejb.EJBDeployer]
      Bean : CPI/mdb/ClaimSummaryReader
      Section: 22.2
      Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
      Info : Class not found: SELECT OBJECT(t) FROM Task AS t WHERE t.claim = ?1 AND t.assignedToProcId = ?2 AND t.dueDate = ?3 and t.sequenceNumber = ?4com.sherman.cpi.jboss.messagebean.ClaimSummaryReaderBean


      and


      2002-09-10 06:01:35,968 WARN [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:service=EJB,jndiName=local/CPI/mdb/ClaimSummaryReader
      java.lang.ClassNotFoundException: SELECT OBJECT(t) FROM Task AS t WHERE t.claim = ?1 AND t.assignedToProcId = ?2 AND t.dueDate = ?3 and t.sequenceNumber = ?4com.sherman.cpi.jboss.messagebean.ClaimSummaryReaderBean
      at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
      at org.jboss.ejb.Container.create(Container.java:547)
      at org.jboss.ejb.MessageDrivenContainer.create(MessageDrivenContainer.java:157)
      at org.jboss.ejb.Container.invoke(Container.java:760)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
      at $Proxy5.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:314)
      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy21.create(Unknown Source)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:386)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      ....

      Somehow, the EJB-QL and the MDB class name have been concatentated!!!

      Looking at the verifier, I cannot see Section 22.2 that is being complained about.

      My second MDB, DiaryReaderBean, deploys fine. I have also had the same MDBs working without the entity beans there.


      Any ideas?

      Thanks,


      Sherman

        • 1. Re: Wierd deployment problem with MDB


          After more fiddling, I got things to deploy properly.

          I changed the EJB-QL to be:
          SELECT OBJECT(t) FROM Task AS t WHERE t.claim.uid = ?1 AND t.assignedToProcId.uid = ?2 AND t.dueDate = ?3 and t.sequenceNumber = ?4

          so that rather than using the ClaimLocal and ProcIdLocals as ?1 and ?2 to the query, I was explicitly using their primary keys instead.

          • 2. Re: Wierd deployment problem with MDB



            Actually, it is not fixed. When I recompile and deploy, sometimes the MDB will deploy fine - other times it won't!

            • 3. Re: Wierd deployment problem with MDB



              This ended up being a problem in the EJB-QL - maybe some invalid characters. Could also have been something between Ant and XDoclet not regenerating/recompiling when I expected them to.

              Real problem is that the problems were not reported about the beans that had the EJB-QL in them - other bean deployments were effected.