Hi all,
I have a problem when connecting to the JMS broker of my Glassfish. I wrote a simple test client:
package testing.jms.mqtcp;
import javax.jms.Connection;
import javax.jms.JMSException;
import com.sun.messaging.ConnectionConfiguration;
import com.sun.messaging.ConnectionFactory;
public class ConnectionFactoryViaMQTCP {
public static void main( String[] args ) {
final ConnectionFactory sunConnectionFactory = new ConnectionFactory();
try {
//sunConnectionFactory.setProperty( ConnectionConfiguration.imqAddressList, "mqtcp://localhost:10076/jms/" );
sunConnectionFactory.setProperty( ConnectionConfiguration.imqAddressList, "mq://localhost:10076/" );
Connection connection = sunConnectionFactory.createConnection();
connection.start();
connection.close();
} catch ( JMSException e ) {
e.printStackTrace();
}
}
}
The code above executes fine. However, when I want to make a connection using "mqtcp://localhost:10076/jms/" it gives the following error message:
WARNING: [I500]: Caught JVM Exception: java.io.StreamCorruptedException: Bad packet magic number: 825241888. Expecting: 469754818
com.sun.messaging.jms.JMSException: [C4000]: Packet acknowledge failed. user=guest, broker=localhost:10076
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writePacketWithAck(ProtocolHandler.java:703)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writePacketWithReply2(ProtocolHandler.java:480)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.hello(ProtocolHandler.java:947)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.hello(ProtocolHandler.java:888)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.hello(ConnectionImpl.java:528)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.openConnection(ConnectionImpl.java:2310)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.init(ConnectionImpl.java:1012)
at com.sun.messaging.jmq.jmsclient.ConnectionImpl.<init>(ConnectionImpl.java:414)
at com.sun.messaging.jmq.jmsclient.UnifiedConnectionImpl.<init>(UnifiedConnectionImpl.java:60)
at com.sun.messaging.BasicConnectionFactory.createConnection(BasicConnectionFactory.java:147)
at com.sun.messaging.BasicConnectionFactory.createConnection(BasicConnectionFactory.java:132)
at testing.jms.mqtcp.ConnectionFactoryViaMQTCP.main(ConnectionFactoryViaMQTCP.java:34)
I know that the expected magic number is from the class ReadOnlyPacket. But I don't know where the other magic number is from.
I use Glassfish V2UR2.
Neither in the Glassfish nor in the IMQ log file I can see connection attempts when using the mqtcp connection, so maybe the URL is wrong at all but I found examples for this URL on the net.
Does anyone know how to correct this error?
And apart from that. If I want to make a connection via the internet to a JMS broker should I then use the mqtcp:// connection or is mq:// also fine?
Thanks in advance,
Chris
[Message sent by forum member 'chrjohn' (chrjohn)]
http://forums.java.net/jive/thread.jspa?messageID=322093