2 Replies Latest reply on Apr 2, 2002 12:39 PM by leo

    Cannot Use JDBC for Message Persistance Store

    leo Newbie


      I have an application that run on default setting of JBossMQ and is fine on publishing message into a queue. But when I change the the Message Persistance store from default rollinglogged to JDBC PersistanceManager. The JBossMQ throw the following exception when I publish message to a queue. I have been create the database schema and datasource according to manual.

      at org.jboss.mq.server.BasicQueue.addMessage(BasicQueue.java:323)
      at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:39)
      at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:100)
      at org.jboss.mq.server.JMSServer.addMessage(JMSServer.java:280)
      at org.jboss.mq.server.JMSServer.addMessage(JMSServer.java:265)
      at org.jboss.mq.il.oil.OILServerILService.run(OILServerILService.java:253)
      at java.lang.Thread.run(Thread.java:536)
      [11:42:41,204,Default] org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server

      My setting of JDBCPesistanceManager is





      Please help to tell me what wrong is my JBossMQ setting, thks for any help.

        • 1. Re: Cannot Use JDBC for Message Persistance Store
          David Martinez Newbie


          Warning: This is what worked for me. Your Mileage may vary.

          I had the same problem under JBoss 2.4.4 and Oracle persistence. I ran the ole' distributed debugger using JBoss_2_4_4 and found out that the JDBC PersistenceManager class that comes in the source code, the constructor does not exist. The constructor is supposed to create a new transaction manager which is never being created, hence the nullpointer on BasicQueue:323, which reads:

          server.getPersistenceManager().getTxManager().addPostCommitTask( txId, task );

          So I decided to go ahead and add a constructor that initializes a transactionmanager in the same way as the rolling implementation:

          * PersistenceManager constructor patch.
          * @exception javax.jms.JMSException If it blows up on constructing
          public PersistenceManager()
          throws javax.jms.JMSException
          txManager = new TxManager( this );

          This seems to have fixed the problem. Now Oracle persists my messages and I can do a "select COUNT(*) from jms_messages" and get a non-zero result. The message inside looks valid. I haven't tested it further yet, but I thought you'd be interested to know that someone else got it to work.

          So the lowdown of this is:

          1) Get jboss-2.4.4 source.
          2) Add the constructor to jbossmq/src/main/org.jboss.mq.pm.jdbc.PersistenceManager
          3) run ant build-jbossmq
          4) After building, take the jbossmq/build/lib/ext/jbossmq.jar and put it on the jboss/lib/ext directory (don't forget to back the old one up first).
          5) Try running it again.

          This is what Worked For Me (tm), based on remote debugging the application and putting a few breakpoints. I only spent a little time on this, not enough to guarantee correctness or even sanity.

          I would make sure it works and I'd test the heck of it before putting it anywhere but your own box.

          Hope this helps,

          - Hackerdude

          • 2. Re: Cannot Use JDBC for Message Persistance Store
            leo Newbie

            Thanks, the JBossMQ can run with mysql according your advise :)