imq3_6 NO_ACKNOWLEDGE
Has anyone had success in getting this server to operate in the NO_ACKNOWLEDGE mode?
I have everything working fine under AUTO_ACKNOWLEDGE and DUPS_OK_ACKNOWLEDGE, but when I switch to NO_ACKNOWLEDGE I get a class cast exception:
java.lang.ClassCastException: com.sun.messaging.jmq.jmsclient.TopicConnectionImpl
here is my relevant code:
if(tc == null){
tc = (com.sun.messaging.jms.TopicConnection)BusObjectStore.getTopicConnection();
}
pubTopic = BusObjectStore.getTopic(jndiTopicName);
ts = ((com.sun.messaging.jms.TopicConnection) tc).createTopicSession(com.sun.messaging.jms.Session.NO_ACKNOWLEDGE);
System.out.println("ts mode : " + ts.getAcknowledgeMode());
Any insight would be much appreciated.
Hi,
If the following code works for you, then you probably have a 3.5 TopicConnection returned from the code (BusObjectStore.getTopicConnection()).
chiaming
- --
if(tc == null){
//tc = (com.sun.messaging.jms.TopicConnection)
//BusObjectStore.getTopicConnection();
//replace the above statements with the following to create a connection.
com.sun.messaging.TopicConnectionFactory factory =
new com.sun.messaging.TopicConnectionFactory();
tc = factory.createTopicConnection();
}
pubTopic = BusObjectStore.getTopic(jndiTopicName);
ts = ((com.sun.messaging.jms.TopicConnection) tc).createTopicSession(com.sun.messaging.jms.Session.NO_ACKNOWLEDGE);
-
> Hi,
>
> If the following code works for you, then you
> probably have a 3.5 TopicConnection returned from the
> code (BusObjectStore.getTopicConnection()).
>
> chiaming
>
>
> if(tc == null){
>
> //tc = (com.sun.messaging.jms.TopicConnection)
>
> //BusObjectStore.getTopicConnection();
>
> //replace the above statements with the following
> to create a connection.
> com.sun.messaging.TopicConnectionFactory factory
> =
> new
> com.sun.messaging.TopicConnectionFactory();
>
>tc = factory.createTopicConnection();
> pubTopic = BusObjectStore.getTopic(jndiTopicName);
>
> ts = ((com.sun.messaging.jms.TopicConnection)
> tc).createTopicSession(com.sun.messaging.jms.Session.N
> O_ACKNOWLEDGE);
>
>
When I used the the Admin Console to configure the object store it connects to a server that displays the following when initiating:
Sun Java(tm) System Message Queue 3 2005Q4
Sun Microsystems, Inc.
Version: 3.6 SP3 (Build 02-A)
Compile: Wed Jun 22 15:30:03 PDT 2005
And honestly, I don't think I ever installed 3.5 on this server.
Can you explain to me why that code would work on 3.5 and not 3.6? I am going to run it soon, but I don't know what to do if it works.
Thx
Thankyou very much for looking at this.
I am not sure if it is a good thing, or a bad thing, but your code did not work. It times out when calling
tc = (com.sun.messaging.jms.TopicConnection) tcf.createTopicConnection();
Another thing I don't understand is how that would even compile under 3.5? I think
ts = ((com.sun.messaging.jms.TopicConnection) tc)
.createTopicSession(com.sun.messaging.jms.Session.NO_ACKNOWLEDGE);
would be invalid parameters; it is missing a boolean.
Thanks again.
tc = (com.sun.messaging.jms.TopicConnection) tcf.createTopicConnection();
did not work could be caused by the server was not running on the same host (or default port) as the client application. Or the broker required client authentication. So you have to set the same *attributes* as those that worked for you.
The code would not compile under 3.5 jars. I guessed (the original question) that you might had a 3.5 ConnectionFactory stored in the JNDI store. A connection created from a 3.5 ConnectionFactory would cause the following to throw a ClassCastException:
tc = (com.sun.messaging.jms.TopicConnection) tcf.createTopicConnection();
To help debug the (original) problem, replace the connection creation code as follows.
if(tc == null){
//cast to JMS topic connection so we will not get a class cast exception
tc = (javax.jms.TopicConnection) BusObjectStore.getTopicConnection();
//print major and minor version number
int majorVersion = tc.getMetaData().getProviderMajorVersion();
int minorVersion = tc.getMetaData().getProviderMinorVersion();
System.out.println ("MQ connection version: " + majorVersion + ":" + minorVersion;
}
The answer is 3:5
Admin fowl up! Thanks very much for your help! I feel stupid and glad at the same time.
Now I get the error:
[B3122]: Support for [B0058]: No Acknowledgement Sessions is unavailable in this edition, please upgrade to the Enterprise Edition to enable this feature user=tq, broker=172.16.100.178:7878(32854)
Back to feeling stupid.
Thanks anyway.
> tc = (com.sun.messaging.jms.TopicConnection)
> tcf.createTopicConnection();
> did not work could be caused by the server was not
> running on the same host (or default port) as the
> client application. Or the broker required clientSystem.out.println ("MQ connection version: " + majorVersion + ":" + minorVersion;
> authentication. So you have to set the same
> *attributes* as those that worked for you.
>
> The code would not compile under 3.5 jars. I guessed
> (the original question) that you might had a 3.5
> ConnectionFactory stored in the JNDI store. A
> connection created from a 3.5 ConnectionFactory would
> cause the following to throw a ClassCastException:
>
> tc = (com.sun.messaging.jms.TopicConnection)
> tcf.createTopicConnection();
>
> To help debug the (original) problem, replace the
> connection creation code as follows.
>
> if(tc == null){
> //cast to JMS topic connection so we will not get a
> class cast exception
> tc = (javax.jms.TopicConnection)
> BusObjectStore.getTopicConnection();
>
>//print major and minor version number
> int majorVersion =
> tc.getMetaData().getProviderMajorVersion();
> int minorVersion =
> tc.getMetaData().getProviderMinorVersion();
>
> System.out.println ("MQ connection version: " +
> majorVersion + ":" + minorVersion;
