5 Replies Latest reply on Jan 31, 2007 11:09 PM by alllle

    Not able to create durable subscription in MDB


      I am using JBoss 4.04GA SP2 and JBoss Messaging 1.0.2SP2.

      I want to create a MDB in EJB3 that creates durable subscription to a topic. Since the topic requires a valid user/pass, EJB3 annotation along was not sufficient. I therefore, created the ejb-jar.xml and jboss.xml file that are packaged with my Jar file, which is deployed inside an EAR.

      I got the following error when deploying the EAR:

      17:48:46,234 WARN mdb.MDB - JMS provider failure detected:
      javax.jms.JMSException: Cannot create durable subscriber without a valid client ID
       at org.jboss.jms.server.endpoint.ServerSessionEndpoint.createConsumerDelegate(ServerSessionE
       at org.jboss.jms.server.endpoint.advised.SessionAdvised.org$jboss$jms$server$endpoint$advise
       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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)

      But I have already put in the client id as well as the subscription id in the jboss.xml file. Here is the content:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC
       "-//JBoss//DTD JBOSS 4.0//EN"
       <configuration-name>Standard Message Driven Bean</configuration-name>

      And the ejb-jar.xml file:
      <?xml version='1.0' encoding='UTF-8' ?>

      I've also stripped out all EJB3 annotations from the NotificationMDB class. When debug into the JBoss code, the code where the error was thrown is:
      String clientID = connectionEndpoint.getClientID();
       if (clientID == null)
       throw new JMSException("Cannot create durable subscriber without a valid client ID");
       subscription = cm.getDurableSubscription(clientID, subscriptionName, ms, pm, mm);

      because the clientID is null. Inspecting the stack tree, I saw the mdb-user and mdb-password are read correctly. I don't know where the client-id and subscription-id are stored. The value of the subscriptionName passed into the above method is set to string "subscriptionName".

      Can anyone help? Thanks!

        • 1. Re: Not able to create durable subscription in MDB

          Alright, after many many hours of digging around, I found out the JBoss extension of the EJB3 MDB annotations from wiki. I cleared the jboss.xml and ejb-jar.xml file and used only the EJB3 annotations. My MDB now looks like:

          @MessageDriven(name = "notificationMDB", activationConfig = {
           @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
           @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/notificationTopic"),
           @ActivationConfigProperty(propertyName = "user", propertyValue = "user"),
           @ActivationConfigProperty(propertyName = "password", propertyValue = "pass"),
           @ActivationConfigProperty(propertyName = "noLocal", propertyValue = "true") })
          public class NotificationMDB extends BaseServiceBean implements MessageListener {
           public void onMessage(Message message) {

          As you can see, I didn't configure it as Durable to test it out. It deployed fine without error, and it received a message okay. But then it gives out a nasty error:
          13:39:30,290 WARN connectionmanager.SimpleConnectionManager - A problem has been detected with the
          connection to remote client 4co2mt-vld24e-exm5wy4h-1-exm5xes0-5. It is possible the client has exite
          d without closing its connection(s) or there is a network problem. All connection resources correspo
          nding to that client process will now be removed.
          13:39:30,300 ERROR util.ExceptionUtil - ConsumerEndpoint[-2147483628] close [4co2mt-vld24e-exm5wy4h-
          java.lang.RuntimeException: Failed to obtain lock
           at org.jboss.messaging.core.local.PointToMultipointRouter.remove(PointToMultipointRouter.jav
           at org.jboss.messaging.core.local.Topic.remove(Topic.java:126)
           at org.jboss.messaging.core.local.CoreSubscription.disconnect(CoreSubscription.java:111)
           at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.close(ServerConsumerEndpoint.java:36
           at org.jboss.jms.server.endpoint.ServerConsumerEndpoint.remove(ServerConsumerEndpoint.java:5
           at org.jboss.jms.server.endpoint.ServerSessionEndpoint.close(ServerSessionEndpoint.java:403)
           at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.close(ServerConnectionEndpoint.jav
           at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleClientFailure(Simple
           at org.jboss.jms.server.connectionmanager.SimpleConnectionManager.handleConnectionException(
           at org.jboss.remoting.ConnectionNotifier.connectionLost(ConnectionNotifier.java:46)
           at org.jboss.remoting.Lease$LeaseTimerTask.execute(Lease.java:133)
           at org.jboss.util.TimerQueue$TimerTaskLoop.run(TimerQueue.java:181)
           at java.lang.Thread.run(Thread.java:595)
          Caused by: java.lang.InterruptedException
           at EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$WriterLock.acquire(WriterP
           at org.jboss.messaging.core.local.PointToMultipointRouter.remove(PointToMultipointRouter.jav
           ... 12 more

          From that point on, the messages are not delivered to the MDB anymore. It looks like a connection not closed problem, but it is out of my control as it is a MDB, I don't create a connection in my code.

          I always feeled that JBoss' products are very solid. But a easy MDB deployment is taking me days and still no clue. Very frustrated.

          Another thing is, I looked into the source code of SimpleConnectionManager, and it is a very short class. It apparently does not have a line 208. Seems that the source code in the download is not the one been compiled?

          • 2. Re: Not able to create durable subscription in MDB

            Sorry you are struggling. What might be best is to move this over to the JBossMessaging forum as it clearly is a messaging case at this point and not EJB(X).

            • 3. Re: Not able to create durable subscription in MDB

              You are right, it started as EJB3 question, but now is a messaging problem. Thanks for pointing it out.

              • 4. Re: Not able to create durable subscription in MDB

                Not a problem. I just want to make sure it gets the right coverage.

                • 5. Re: Not able to create durable subscription in MDB