简体   繁体   中英

Trouble with Glassfish Server and ActiveMQ: peer did not send his wire format

I'm getting this error while trying to set up a JMSPublisher and JMSSubscriber

jndi.properties

java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url = tcp://localhost:4848?wireFormat.maxInactivityDurationInitalDelay=30000
topic.topic/flightStatus = flightStatus

Glassfish server is running on: http://localhost:4848

Publisher:

JmsPublisher publisher= new JmsPublisher("ConnectionFactory", "topic/flightStatus");

...

public JmsPublisher(String factoryName, String topicName) throws JMSException, NamingException {
    Context jndiContext = new InitialContext();
    TopicConnectionFactory factory = (TopicConnectionFactory) jndiContext.lookup(factoryName);
    Topic topic = (Topic) jndiContext.lookup(topicName);
    this.connect = factory.createTopicConnection();
    this.session = connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    this.publisher = session.createPublisher(topic);
}

Exception:

Exception in thread "main" javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format.
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1395)
    at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1481)
    at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:323)
    at org.apache.activemq.ActiveMQConnection.createTopicSession(ActiveMQConnection.java:1112)
    at com.mycompany.testejms.JmsPublisher.<init>(JmsPublisher.java:34)
    at com.mycompany.testejms.JmsPublisher.main(JmsPublisher.java:51)
Caused by: java.io.IOException: Wire format negotiation timeout: peer did not send his wire format.
    at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:98)
    at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
    at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
    at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1366)
    ... 5 more

The error indicates that the ActiveMQ client is not actually communicating with an ActiveMQ broker. Glassfish may be listening on http://localhost:4848 , but apparently that's not where the ActiveMQ broker is listening for connections. From what I understand, port 4848 is where the Glassfish web admin console listens for connections. Note the http in the URL you provided. By default, ActiveMQ listens on port 61616 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM