5 Replies Latest reply on Jun 6, 2006 12:50 PM by bertrand.njiipwo

    Can't persist messages to JMS_MESSAGES. Now javax.jms.JMSExc

      Hello Community,

      i'm analysing the JMS messaging service when sending messages to process instance. Every think work well until that i can't store messages as BLOB in the JMS_MESSAGES table see. Thread http://www.jboss.org/index.html?module=bb&op=viewtopic&t=83570.

      Now when i shut down the JBoss Server i see the following exeption.

      2006-05-23 23:35:06,247 WARN [org.jbpm.bpel.service.messager.StartListener] could not close message consumer
      javax.jms.JMSException: The subscription had not been previously registered
       at org.jboss.mq.server.ClientConsumer.removeSubscription(ClientConsumer.java:242)
       at org.jboss.mq.server.JMSDestinationManager.unsubscribe(JMSDestinationManager.java:609)
       at org.jboss.mq.server.JMSServerInterceptorSupport.unsubscribe(JMSServerInterceptorSupport.java:250)
       at org.jboss.mq.server.TracingInterceptor.unsubscribe(TracingInterceptor.java:614)
       at org.jboss.mq.server.JMSServerInvoker.unsubscribe(JMSServerInvoker.java:250)
       at org.jboss.mq.il.jvm.JVMServerIL.unsubscribe(JVMServerIL.java:261)
       at org.jboss.mq.Connection.removeConsumer(Connection.java:938)
       at org.jboss.mq.SpySession.removeConsumer(SpySession.java:1020)
       at org.jboss.mq.SpyMessageConsumer.close(SpyMessageConsumer.java:568)
       at org.jbpm.bpel.service.messager.StartListener.close(StartListener.java:165)
       at org.jbpm.bpel.service.messager.StartListener.close(StartListener.java:148)
       at org.jbpm.bpel.service.messager.Messager.stop(Messager.java:119)
       at org.jbpm.bpel.service.messager.MessagerServlet.destroy(MessagerServlet.java:123)
       at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1316)
       at org.apache.catalina.core.StandardWrapper.stop(StandardWrapper.java:1651)
       at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:892)
       at org.apache.catalina.core.StandardContext.removeChild(StandardContext.java:3035)
       at org.apache.catalina.startup.ContextConfig.stop(ContextConfig.java:1083)
       at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:271)
       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
       at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4265)
       at org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1131)
       at org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4358)
       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:585)
       at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
       at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.web.tomcat.tc5.TomcatDeployer.performUndeployInternal(TomcatDeployer.java:424)
       at org.jboss.web.tomcat.tc5.TomcatDeployer.performUndeploy(TomcatDeployer.java:395)
       at org.jboss.web.AbstractWebDeployer.stop(AbstractWebDeployer.java:404)
       at org.jboss.web.WebModule.stopModule(WebModule.java:85)
       at org.jboss.web.WebModule.stopService(WebModule.java:51)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStop(ServiceMBeanSupport.java:300)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:232)
       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
       at $Proxy0.stop(Unknown Source)
       at org.jboss.system.ServiceController.stop(ServiceController.java:519)
       at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy30.stop(Unknown Source)
       at org.jboss.web.AbstractWebContainer.stop(AbstractWebContainer.java:432)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy31.stop(Unknown Source)
       at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:640)
       at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:632)
       at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:613)
       at org.jboss.deployment.MainDeployer.shutdown(MainDeployer.java:500)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.server.ServerImpl$ShutdownHook.shutdownDeployments(ServerImpl.java:988)
       at org.jboss.system.server.ServerImpl$ShutdownHook.shutdown(ServerImpl.java:963)
       at org.jboss.system.server.ServerImpl$ShutdownHook.run(ServerImpl.java:941)
      2006-05-23 23:35:06,277 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/hello]] messagerServlet: BPEL application stopped


      Is this the reason why i can't store messages in the JMS_MESSAGES table?

      Thanks for your help.


      Bertrand N.

        • 1. Re: Can't persist messages to JMS_MESSAGES. Now javax.jms.JM
          aguizar

          It's hard to tell without more information. If your server log does not show any JDBC connectivity errors, consider that messages are deleted once they are delivered.

          What are you trying to do with the queue activity logs?

          • 2. Re: Can't persist messages to JMS_MESSAGES. Now javax.jms.JM

            Hello @all,

            Just wan to inform that additional informations are avialable and the discussion know is close related to the JBPM BPEL extension and his JMS messaging service . I'm confuse about the right forum.

            Please have a look to the post may be you can really help. May be some one in the jbpm forum has some idea.


            Thanks again.


            Bertrand

            • 3. Re: Can't persist messages to JMS_MESSAGES. Now javax.jms.JM
              aguizar

              Bertrand,

              From the description in the JBoss AS guide, section 6.2, the message cache holds messages in memory until space usage passes defined limits. At that time, the cache starts persisting messages. I guess this explains the behavior you are experiencing.

              Regarding the use of queues, here is how it works:

              An inbound message activity (receive, pick or onMessage event) listens for messages on the queue assigned to its partner link.

              When a SOAP envelope arrives at the endpoint associated with the partner link, the port component we configured in Web services deployment descriptor performs the steps below.

              Determine which operation, among those listed in the WSDL port type, is being requested.

              Retrieve the WSDL message that describes the operation input and the BPEL property aliases associated to that message.

              Extract the part values from the SOAP envelope and put them in the body of a JMS message.

              Calculate the correlation property values from the part values and set them as property values into the JMS message.

              Send the JMS message to the queue assigned to the partner link. The JMS implementation delivers the message to a listening activity whose selector matches the message properties.
              Hope this helps.

              • 4. Re: Can't persist messages to JMS_MESSAGES. Now javax.jms.JM
                kukeltje

                Alex,

                You mean 6.2.4 MessageCache right? So this means he is probably using a Null persistence manager (6.2.6) instead of a JDBC2 persistence manager

                • 5. Re: Can't persist messages to JMS_MESSAGES. Now javax.jms.JM

                  Hello @all,

                  I can confirme that i'm using the JDBC2 PersistenceManager. For that purpose i have set the ConnectionManager to use my DataSource see:

                  {JBOSS_HOME}/server/deploy/jms/mysql-jdbc2-service.xml:


                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <!-- $Id: mysql-jdbc2-service.xml,v 1.8.2.4 2005/08/13 20:47:52 adrian Exp $ -->
                  
                  <server>
                  
                  
                   | The destination manager is the core service within JBossMQ
                   -->
                   <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq:service=DestinationManager">
                   <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends>
                   <depends optional-attribute-name="PersistenceManager">jboss.mq:service=PersistenceManager</depends>
                   <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends>
                   </mbean>
                  
                  
                   <mbean code="org.jboss.mq.server.MessageCache"
                   name="jboss.mq:service=MessageCache">
                   <attribute name="HighMemoryMark">50</attribute>
                   <attribute name="MaxMemoryMark">60</attribute>
                   <attribute name="CacheStore">jboss.mq:service=PersistenceManager</attribute>
                   </mbean>
                  
                   <mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager"
                   name="jboss.mq:service=PersistenceManager">
                   <!--depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends-->
                   <depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=MySqlDS</depends>
                  
                  <!-- Changed: SELECT_MAX_TX = SELECT MAX(TXID) FROM (SELECT MAX(TXID) AS TXID FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM JMS_MESSAGES) AS TR_TABLE-->
                   <attribute name="SqlProperties">
                   BLOB_TYPE=BYTES_BLOB
                   INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?)
                   INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
                   SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
                   SELECT_MAX_TX = SELECT MAX(TXID) FROM (SELECT MAX(TXID) AS TXID FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM JMS_MESSAGES) AS TR_TABLE
                   DELETE_ALL_TX = DELETE FROM JMS_TRANSACTIONS
                   SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?
                   SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
                   MARK_MESSAGE = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=?
                   UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?
                   UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
                   UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
                   UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?
                   UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
                   UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
                   DELETE_MARKED_MESSAGES_WITH_TX = DELETE JMS_MESSAGES FROM JMS_MESSAGES, JMS_TRANSACTIONS WHERE JMS_MESSAGES.TXID = JMS_TRANSACTIONS.TXID AND JMS_MESSAGES.TXOP=?
                   DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?
                   DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?
                   DELETE_TEMPORARY_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXOP='T'
                   DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
                   CREATE_MESSAGE_TABLE = CREATE TABLE JMS_MESSAGES (MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(150) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB LONGBLOB, PRIMARY KEY (MESSAGEID, DESTINATION))
                   CREATE_IDX_MESSAGE_TXOP_TXID = CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID)
                   CREATE_IDX_MESSAGE_DESTINATION = CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION)
                   CREATE_TX_TABLE = CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
                   CREATE_TABLES_ON_STARTUP = TRUE
                   </attribute>
                   <!-- Uncomment to override the transaction timeout for recovery per queue/subscription, in seconds -->
                   <attribute name="RecoveryTimeout">0</attribute>
                   <!--attribute name="RecoverMessagesChunk">0</attribute-->
                   </mbean>
                  
                  </server>.
                  


                  I have set the of HighMemoryMark and MemoryMark to 0. With this i can observe that the messages are quickly (milliseconds) store to the dataBase and then be removed after they are transmitted.

                  I have readed and unterstood the role of the persistenceManager like this: Only if the destination (testQueue) is not available the Message will be store in the JMS table. After being available the stored messages are then sent to the Queue and directly deleted from the database. Please let me know if i'm not wrong.

                  Once again Alex thanx for your Explanations. It was then clear for me after a look at the source code of the class org.jbpm.bpel.service.messager.PortHandler.

                  The JMS Service have been used in the BPEL extension to guarantee the reliability in the Client-Server communication and this is my own opinion also to avoid the implementation of correlation sets in BPEL. Using this we can reach that if there are many messages send by differents process instances the right process instance will receive the right message. But this way is less flexible and scalable for the proccess modeling.

                  Please let me know if persist the JMS-Messages in the database permanently is possible and if this can be reached using the JDBC2.PersistenceManager.

                  My goal is still to establish some relation between the messages send by each process instance.

                  At one side i have the table bpel_msgvariableinstance which stores SOAP-Messages (Request + Responce) that have been received and send in relation with the deployed processDefinitionID. At the other side i have isoleted processInstance informations in the table jbpm_processinstance.


                  when deploying the process definition additional tables (relation table) could be created which establish some relation between processInstanceID and messages send + received by this processInstance. At running time process information should be persist on the Fly. Hier i need your statement or your opinion.
                  How much effort this require for someone with good Hibernate knowledge ?

                  Are some design and architectural documentation of the JBPM-BPEL extension available for this purpose ?

                  Thank for your help and suggestions.

                  Regards


                  Bertrand