12 Replies Latest reply on Nov 5, 2002 5:27 AM by Stanislav Nazarenko

    MDB starts processing before the deployment is finished

    Stanislav Nazarenko Newbie

      May be it's not a brand new question here, but I haven't found any answers searching through the forum.

      My MDB uses CMP entity beans and if there are some messages left unprocessed in the queue before the re-deployment of the application starts, sometimes the newly deployed MDB starts processing the messages BEFORE the deployment has been finished. And an issue occurs: (sometimes, not always) I cannot even lookup for the home interface of the CMPs used, simply because there are no these homes deployed yet (the deployment is still in process).

      The background EJBs used by this MDB are quite complex, so I cannot just drop the message which caused the problem by catching all the occuring EJBExceptions and NamingExceptions in onMessage().

      So I'm wandering if I could determine that the deployment of the application has already been complete to be able to use all the EJBs as usual? Can I make a call to some JMX stuff to get this info?

      Thanks a lot,
      Stan

        • 1. Re: MDB starts processing before the deployment is finished
          Stanislav Nazarenko Newbie

          The issue seems to be resolved:
          I've put an MDB and CMP EBs into different JARs inside an EAR and set up the ordering of deployment.

          Thanks to all.

          • 2. Re: MDB starts processing before the deployment is finished
            Stanislav Nazarenko Newbie

            The issue seems to be resolved:
            I've put an MDB and CMP EBs into different JARs inside an EAR and set up the ordering of deployment.

            Thanks to all.

            • 3. Re: MDB starts processing before the deployment is finished
              Adrian Brock Master

              Have you tried adding this in jboss.xml?

              <message-driven>
              <ejb-name>blah</ejb-name>
              jboss.j2ee:service=EJB,jndiName=whatever
              </message-driven>

              I think it will give you the ordering you require?
              If this works, It might be possible to make
              jboss generate the from <ejb-ref>s
              So please give feedback.

              Regards,
              Adrian

              • 4. Re: MDB starts processing before the deployment is finished
                Stanislav Nazarenko Newbie

                Hi warjort,

                1. Unfortunately, the solution from my message 2 didn't work.
                2. I haven't tried before (I might be wrong, but there's no definition for in jboss.xml DTD and it confused me a bit).
                3. Now I've added section and it seems to work fine (even when the module with MDB is being loaded first). I'll test it for some time and will inform you about positive or negative results.
                Thanks a lot!

                Regards,
                Stan

                • 5. Re: MDB starts processing before the deployment is finished
                  Stanislav Nazarenko Newbie

                  No, sometimes it fails. I also tried to add for all dependent beans (because sometimes i got an error from different beans depending on current order of deployment and timing), but... no success.
                  I'm using jboss-3.0.3_tomcat-4.1.12
                  The exception trace gracefully given to me is:

                  2002-10-31 14:15:00,937 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException, causedBy:
                  java.lang.NullPointerException
                  at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createBeanClassInstance(JDBCStoreManager.java:513)
                  at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(CMPPersistenceManager.java:165)
                  at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createBeanClassInstance(CachedConnectionInterceptor.java:251)
                  at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer.java:294)
                  at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:209)
                  at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:76)
                  at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
                  at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
                  at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
                  at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
                  at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
                  at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
                  at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
                  at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
                  at $Proxy1602.findByName(Unknown Source)
                  at someproject.ejb.MyServerConfigServiceSF.ejbCreateMyServerConfigForName(MyServerConfigServiceSF.java:61)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.createSession(StatefulSessionFilePersistenceManager.java:162)
                  at org.jboss.ejb.StatefulSessionContainer.createLocalHome(StatefulSessionContainer.java:466)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invokeHome(StatefulSessionContainer.java:756)
                  at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
                  at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
                  at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(StatefulSessionInstanceInterceptor.java:128)
                  at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
                  at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
                  at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
                  at org.jboss.ejb.StatefulSessionContainer.invokeHome(StatefulSessionContainer.java:368)
                  at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
                  at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
                  at $Proxy1599.createMyServerConfigForName(Unknown Source)
                  at someproject.ejb.MyListenerHelper.getRecordPublisher(MyListenerHelper.java:47)
                  at someproject.ejb.MyListenerMDB.onMessage(MyListenerMDB.java:24)
                  ... <before MDB call> ...

                  • 6. Re: MDB starts processing before the deployment is finished
                    John Newbie

                    Thank you for posting this.

                    I am using jboss-3.0.0_tomcat-4.0.3.

                    I am having the exact same problem with MDB's trying to access a CMP entity bean before the CMP has been bound. This happens occasionally when there are messages left on the queue when the app server starts up.

                    I am also currently testing using the depends clause in the jboss.xml. So far, it seems to be working.

                    Here is my jboss.xml:

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

                    <enterprise-beans>
                    <message-driven>
                    <ejb-name>MessageUnWrap</ejb-name>
                    jboss.j2ee:service=EJB,jndiName=ejb/Configuration
                    <configuration-name>Standard Message Driven Bean</configuration-name>
                    <destination-jndi-name>queue/UnWrapQ</destination-jndi-name>
                    </message-driven>
                    </enterprise-beans>


                    I'm curious how you tried to order the EJB jar's in your application.xml. Can you let me take a look at this?

                    I'll let you know how my testing goes.

                    John eh

                    • 7. Re: MDB starts processing before the deployment is finished
                      John Newbie

                      Thank you for posting this.

                      I am using jboss-3.0.0_tomcat-4.0.3.

                      I am having the exact same problem with MDB's trying to access a CMP entity bean before the CMP has been bound. This happens occasionally when there are messages left on the queue when the app server starts up.

                      I am also currently testing using the depends clause in the jboss.xml. So far, it seems to be working.

                      Here is my jboss.xml:

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

                      <enterprise-beans>
                      <message-driven>
                      <ejb-name>MessageUnWrap</ejb-name>
                      jboss.j2ee:service=EJB,jndiName=ejb/Configuration
                      <configuration-name>Standard Message Driven Bean</configuration-name>
                      <destination-jndi-name>queue/UnWrapQ</destination-jndi-name>
                      </message-driven>
                      </enterprise-beans>


                      I'm curious how you tried to order the EJB jar's in your application.xml. Can you let me take a look at this?

                      I'll let you know how my testing goes.

                      John eh

                      • 8. Re: MDB starts processing before the deployment is finished
                        John Newbie

                        Thank you for posting this.

                        I am using jboss-3.0.0_tomcat-4.0.3.

                        I am having the exact same problem with MDB's trying to access a CMP entity bean before the CMP has been bound. This happens occasionally when there are messages left on the queue when the app server starts up.

                        I am also currently testing using the depends clause in the jboss.xml. So far, it seems to be working.

                        Here is my jboss.xml:

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

                        <enterprise-beans>
                        <message-driven>
                        <ejb-name>MessageUnWrap</ejb-name>
                        jboss.j2ee:service=EJB,jndiName=ejb/Configuration
                        <configuration-name>Standard Message Driven Bean</configuration-name>
                        <destination-jndi-name>queue/UnWrapQ</destination-jndi-name>
                        </message-driven>
                        </enterprise-beans>


                        I'm curious how you tried to order the EJB jar's in your application.xml. Can you let me take a look at this?

                        I'll let you know how my testing goes.

                        John eh

                        • 9. Re: MDB starts processing before the deployment is finished
                          Stanislav Nazarenko Newbie

                          Hi John,
                          There were some helpful topics about deployment ordering before. You might search for the word PrefixDeploymentSorter, which can be uncommented in jboss-service.xml to enable sorting by two-digit prefix in the names of your *ARs.
                          To test I'm using the following configuration:
                          <message-driven>
                          <ejb-name>MyListener</ejb-name>
                          <destination-jndi-name>queue/SomeQueue</destination-jndi-name>
                          <configuration-name>Standard Message Driven Bean</configuration-name>
                          jboss.j2ee:service=EJB,jndiName=someproject/MyServerConfigService
                          jboss.j2ee:service=EJB,jndiName=someproject/MyServerConfig
                          </message-driven>
                          And it works occasionally (about 30% of deployments are without errors). Well, it all depends on the contents of the queue and timing of deployment.
                          Anyway, I'll try to sort out this problem asap and will inform you. May be warjort could give us some hints...

                          Regards,
                          Stan

                          • 10. Re: MDB starts processing before the deployment is finished
                            Adrian Brock Master

                            I would think the should be enough?

                            The problem is that you have to specify them all :-(

                            CMP is a bit special at deployment, it has to do
                            three phase deployment because of CMR.

                            A simpler solution might be to make the queue
                            depend upon the ejb module rather than the bean.

                            Look for the queues in
                            jboss.mq.destination:

                            The ejb jars are something like
                            jboss.j2ee:server=EjbModule,....

                            Regards,
                            Adrian

                            • 11. Re: MDB starts processing before the deployment is finished
                              Stanislav Nazarenko Newbie

                              Hi warjort,

                              Thanks for reply!
                              I will try to specify them all.

                              I was also thinking about EjbModules, but how to specify them if it contains temporary path? (e.g. service=EjbModule,url=file%/D%/jboss-3.0.3_tomcat-4.1.12/server/default/tmp/deploy/server/default/deploy/alm.ear/102.alm.ear-contents/ejb/alm-ejb.jar)

                              Regards,
                              Stan

                              • 12. Re: MDB starts processing before the deployment is finished
                                Stanislav Nazarenko Newbie

                                Hi warjort,

                                When I set up dependencies for all the underlying beans and it doesn't work: I've got an error during deployment

                                18:15:00,265 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompleteDeployments()'
                                Cause: Incomplete Deployment listing:
                                Packages waiting for a deployer:

                                Incompletely deployed packages:

                                MBeans waiting for classes:

                                MBeans waiting for other MBeans:
                                [ObjectName: jboss.j2ee:jndiName=local/MyMDBListener,service=EJB
                                state: NOTYETINSTALLED
                                I Depend On: jboss.j2ee:service=EJB,jndiName=someproject/remote/MyStatefulServerConfigService
                                jboss.j2ee:service=EJB,jndiName=someproject/local/MyCMPServerConfig
                                jboss.j2ee:service=EJB,jndiName=someproject/local/CMPHandler
                                jboss.j2ee:service=EJB,jndiName=someproject/local/CMPFilterConfig
                                jboss.j2ee:jndiName=someproject/local/CMPHandlerParameter,service=EJB
                                jboss.j2ee:service=EJB,jndiName=someproject/local/CMPFilterConfigParameter
                                jboss.j2ee:jndiName=someproject/local/MyCMPConfig,service=EJB

                                Depends On Me: ]

                                and MDB doesn't start.
                                When I set up only SOME CMP dependencies, it seems to be working. I've got this (supposed to be) stable configuration, removing the beans from sections one by one, starting from the 'deepest' in the dependency hierarchy.
                                I'll let you know whether this configuration remains stable.

                                Regards,
                                Stan