如何解决jms中的无效连接参数?

时间:2015-12-17 10:32:17

标签: java jms activemq

我使用ActiveMQ通过使用以下客户端uri将数据对象从客户端传输到服务器:

ssl://X.X.X.X:61616?useKeepAlive=false&wireFormat.maxInactivityDuration=30000&wireFormat.cacheEnabled=false&wireFormat.tightEncodingEnabled=true

使用上面的uri我在启动应用程序时遇到以下异常:

javax.jms.JMSException: Could not create Transport. Reason: java.lang.IllegalArgumentException: Invalid connect parameters: {useKeepAlive=false}
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:245)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:258)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:230)
        at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:178)
        at com.infomindz.esdms.messaging.agent.job.handler.MessageQueueLocator.getSecureManagementJmsSession(MessageQueueLocator.java:991)
        at com.infomindz.esdms.messaging.agent.job.handler.MessageQueueLocator.sendMessageToSEMQueue(MessageQueueLocator.java:902)
        at com.infomindz.esdms.messaging.agent.job.MediaDriverStatusJob.saveAndSendPropertyDetails(Unknown Source)
        at com.infomindz.esdms.messaging.agent.job.MediaDriverStatusJob.checkInitFile(Unknown Source)
        at com.infomindz.esdms.messaging.agent.job.MediaDriverStatusJob.execute(Unknown Source)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
    Caused by: java.lang.IllegalArgumentException: Invalid connect parameters: {useKeepAlive=false}
        at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:144)
        at org.apache.activemq.transport.TransportFactory.doConnect(TransportFactory.java:51)
        at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:80)
        at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:243)

如何解决此异常?

1 个答案:

答案 0 :(得分:1)

运输参数必须以"运输为前缀。"在网址中;所以你需要这样做:

ssl://X.X.X.X:61616?transport.useKeepAlive=false

请参阅this page