Not able to create durable subscription in MDB
alllle Jan 30, 2007 7:03 PMI 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 ndpoint.java:190) at org.jboss.jms.server.endpoint.advised.SessionAdvised.org$jboss$jms$server$endpoint$advise d$SessionAdvised$createConsumerDelegate$aop(SessionAdvised.java:90) 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" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd"> <jboss> <enterprise-beans> <message-driven> <ejb-name>notificationMDB</ejb-name> <destination-jndi-name>topic/Update</destination-jndi-name> <mdb-user>user</mdb-user> <mdb-passwd>pass</mdb-passwd> <mdb-client-id>MyDurableSub</mdb-client-id> <mdb-subscription-id>mdb</mdb-subscription-id> <configuration-name>Standard Message Driven Bean</configuration-name> </message-driven> </enterprise-beans> </jboss>
And the ejb-jar.xml file:
<?xml version='1.0' encoding='UTF-8' ?> <ejb-jar> <enterprise-beans> <message-driven> <ejb-name>notificationMDB</ejb-name> <ejb-class>com.company.ejb.NotificationMDB</ejb-class> <transaction-type>Container</transaction-type> <acknowledge-mode>Auto-acknowledge</acknowledge-mode> <message-driven-destination> <destination-type>javax.jms.Topic</destination-type> <subscription-durability>Durable</subscription-durability> </message-driven-destination> </message-driven> </enterprise-beans> </ejb-jar>
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!