Zoltan,
As you have discovered, in an application server, when using the JMS RA (as you are here), you can't set ClientID on a
JMS Connection (which is an instance of com.sun.messaging.jms.ra.ConnectionAdapter) unless you're using the application
client container (which you aren't). If you try you get the message "MQRA:CA:Unsupported-setClientID()".
Instead you need to set ClientID on the connection factory (which is an instance of
com.sun.messaging.jms.ra.ManagedConnectionFactory).
I think this restriction is required by the rules of Java EE.
The MQ admin guide lists the properties you can set on the com.sun.messaging.jms.ra.ManagedConnectionFactory:
http://docs.sun.com/app/docs/doc/820-6740/aeoop?a=view
as you can see this includes clientID.
You can set these properties using the Glassfish admin console or using the Glassfish asadmin create-jms-resource
command, which is its command-line equivalent.
asadmin create-jms-resource is documented here:
http://docs.sun.com/app/docs/doc/820-4332/create-jms-resource-1?a=view
(scroll down to the mention of clientID)
Nigel
zamek42 wrote:
> Hi All,
>
> I need a status topic for my application to send/receive status messages.
> Sender is working well, and reader is working from standalone client
> application. I need a web client reader for this topic, via a stateless
> session bean, but it produce this message.
>
> My topicfactory is:
> jndi name: jms/CTStatusTopicFactory
> Pool Name: jms/CTStatusTopicFactory
> Type: javax.jms.TopicConnectionFactory
> no additional properties: userName=guest, password=guest
>
> My destination is:
> JNDI Name: jms/CTStatusTopic
> resource type: javax.jms.Topic
> there is a property:Name=CTStatusTopic
>
> Here is my opening code in a stateless session bean:
>
> InitialContext ic = new InitialContext();
> this.connectionFactory =
> (TopicConnectionFactory)ic.lookup(BGProcessConst.STATUS_TOPIC_FACTORY_NAME);
>
> this.connection = connectionFactory.createTopicConnection();
> this.connection.setClientID("statusId"); // here is the exception
> this.session = this.connection.createTopicSession(false,
> Session.AUTO_ACKNOWLEDGE);
> this.subscriber = this.session.createDurableSubscriber(statusTopic,
> clientId);
>
>
> What is my mistake or how can I make a durable subscription from stateless
> bean?
>
> parameters:
> Debian Gnu Linux unstable, Java 1.6.0_14 from sun, glassfish V2.1
>
> thx a lot
> Zoltan Zidarics
>