You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by jeunii <ij...@gmail.com> on 2017/05/11 14:30:37 UTC

javax.jms.JMSException: Cannot send to a non-connected transport

I am using the `qpid-jms-client.jar` library to form a connection with a
broker.

My code is ::

    Properties properties = new Properties();
    properties.load(this.getClass().getResourceAsStream("jndi.properties"));
    Context context = new InitialContext(properties);
    
    System.setProperty("javax.net.ssl.trustStore",
"C:/Users/xxxxx/qpid.jks");
    System.setProperty("javax.net.ssl.trustStorePassword", "test123");
    						
    ConnectionFactory factory = (ConnectionFactory)
context.lookup("myFactoryLookup");
    Destination queue = (Destination) context.lookup("myQueueLookup");
    Connection connection = factory.createConnection("<my-username>",
"<my-password>");
    connection.setExceptionListener(new MyExceptionListener());
    connection.start();

My jndi.properties file is ::

   
java.naming.factory.initial=org.apache.qpid.jms.jndi.JmsInitialContextFactory
    connectionfactory.myFactoryLookup=amqps://esesslx0100.se:9443
    queue.myQueueLookup=emft_input
    topic.myTopicLookup=topic
    destination.topicExchange=amq.topic
    jms.user=test

Now the above code gives me the ERROR ::

    Connection ExceptionListener fired, exiting.
    javax.jms.JMSException: Cannot send to a non-connected transport.
    	at
org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:66)
    	at
org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:88)
    	at
org.apache.qpid.jms.JmsConnection.onAsyncException(JmsConnection.java:1188)
    	at
org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1104)
    	at
org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:847)
    	at
org.apache.qpid.jms.provider.amqp.AmqpProvider.pumpToProtonTransport(AmqpProvider.java:820)
    	at
org.apache.qpid.jms.provider.amqp.AmqpProvider.access$300(AmqpProvider.java:90)
    	at
org.apache.qpid.jms.provider.amqp.AmqpProvider$16.run(AmqpProvider.java:683)
    	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: java.io.IOException: Cannot send to a non-connected
transport.
    	at
org.apache.qpid.jms.transports.netty.NettyTcpTransport.checkConnected(NettyTcpTransport.java:279)
    	at
org.apache.qpid.jms.transports.netty.NettyTcpTransport.allocateSendBuffer(NettyTcpTransport.java:176)
    	at
org.apache.qpid.jms.provider.amqp.AmqpProvider.pumpToProtonTransport(AmqpProvider.java:806)
    	... 9 more

Since the broker is configures with SaSL, I am also providing my username
and password. I am currently unaware of why this ERROR occurs. Ive looked
around on the internet but there is no clear explanation as to why it would
occur with qpid. Any ideas why this ERROR occurs ? 

My trustStore file is correct since I have verifies SSL connectivity using
it.



--
View this message in context: http://qpid.2158936.n2.nabble.com/javax-jms-JMSException-Cannot-send-to-a-non-connected-transport-tp7663061.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: javax.jms.JMSException: Cannot send to a non-connected transport

Posted by Robbie Gemmell <ro...@gmail.com>.
On 11 May 2017 at 16:35, Robbie Gemmell <ro...@gmail.com> wrote:
> On 11 May 2017 at 16:27, Robbie Gemmell <ro...@gmail.com> wrote:
>> On 11 May 2017 at 16:13, jeunii <ij...@gmail.com> wrote:
>>> Thanks for your reply.
>>>
>>> Actually it is picking up the config using the below config ::
>>>
>>>     System.setProperty("javax.net.ssl.trustStore",
>>> "C:/Users/xxxxx/qpid.jks");
>>>     System.setProperty("javax.net.ssl.trustStorePassword", "test123");
>>>
>>> If I remove these lines, the code will complain above a missing trustStore
>>> file.
>>
>> Ok, perhaps it hasnt imported the classes yet due to using JNDI to
>> instantiate it.
>>
>>> I tried using the latest library for Qpid but get the below ERROR ::
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> javax/jms/JMSContext
>>>         at
>>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getConnectionFactoryDefaults(JmsInitialContextFactory.java:202)
>>>         at
>>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.createConnectionFactories(JmsInitialContextFactory.java:133)
>>>         at
>>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getInitialContext(JmsInitialContextFactory.java:103)
>>>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
>>>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
>>>         at javax.naming.InitialContext.init(InitialContext.java:244)
>>>         at javax.naming.InitialContext.<init>(InitialContext.java:216)
>>>         at AMQPQPIDTest.runTest(AMQPQPIDTest.java:27)
>>>         at AMQPQPIDTest.main(AMQPQPIDTest.java:20)
>>> Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>         ... 9 more
>>>
>>
>> Thats complaining about JMSContext, an interface from JMS 2.0, which
>> the current client versions (0.20.0) implement/require rather than
>> only JMS 1.1 like the older releases.
>
> That was meant to be '0.20.0+', with the actual current version being
> 0.22.0 (though 0.23.0 is likely to be coming very soon)
>
>>
>> If the above SSL config was already being picked up however, it would
>> suggest you have some other problem. I can't think any anything else
>> form the limited information available, perhaps you can debug the
>> failure (either via logging, protocol tracing, wireshark, etc) and get
>> a better idea whats going on.
>>
>> Robbie

Tim and I have posted some comments on your various StackOverflow
posts, but for the interests of those reading here later I thought I'd
post a roundup mail.

Your StackOverflow posts mention RabbitMQ and ActiveMQ. It isn't clear
which you are using, though I think it may be the former.

As Tim mentioned, you would at minimum also need to ensure the
RabbitMQ brokers experimental AMQP 1.0 plugin was loaded, which you
didn't mention doing. However, in this case it might not make much
difference. I didn't have much success using the JMS client or some
other AMQP 1.0 clients against RabbitMQ previously due to an issue I
reported which stops them in their tracks when creating consumers and
producers: https://github.com/rabbitmq/rabbitmq-amqp1.0/issues/34

Turning up the clients logging might give some more trace/debug
information. Both the 'regular logging', and 'protocol trace logging'
(if it even gets that far) might be useful. See
http://qpid.apache.org/releases/qpid-jms-0.22.0/docs/index.html#logging
for more details.

To the stacktrace here, where it seems the TCP connection is being
cut, the server logs could also perhaps be useful in giving a reason.

Its unclear how far the connection gets, but if the server is
RabbitMQ, one potential explanation might also be:
https://github.com/rabbitmq/rabbitmq-amqp1.0/issues/47

Your mentioned researching things before deciding to use RabbitMQ,
which sounds like you aren't tied to an existing server solution? If
so, for other servers that support AMQP 1.0 and the JMS client is
routinely used against, you could try ActiveMQ, ActiveMQ Artemis, Qpid
for Java broker, Qpid C++ broker, and Qpid Dispatch router (does not
work on Windows, which you seem to be using), amongst others.

Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: javax.jms.JMSException: Cannot send to a non-connected transport

Posted by Robbie Gemmell <ro...@gmail.com>.
On 11 May 2017 at 16:27, Robbie Gemmell <ro...@gmail.com> wrote:
> On 11 May 2017 at 16:13, jeunii <ij...@gmail.com> wrote:
>> Thanks for your reply.
>>
>> Actually it is picking up the config using the below config ::
>>
>>     System.setProperty("javax.net.ssl.trustStore",
>> "C:/Users/xxxxx/qpid.jks");
>>     System.setProperty("javax.net.ssl.trustStorePassword", "test123");
>>
>> If I remove these lines, the code will complain above a missing trustStore
>> file.
>
> Ok, perhaps it hasnt imported the classes yet due to using JNDI to
> instantiate it.
>
>> I tried using the latest library for Qpid but get the below ERROR ::
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> javax/jms/JMSContext
>>         at
>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getConnectionFactoryDefaults(JmsInitialContextFactory.java:202)
>>         at
>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.createConnectionFactories(JmsInitialContextFactory.java:133)
>>         at
>> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getInitialContext(JmsInitialContextFactory.java:103)
>>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
>>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
>>         at javax.naming.InitialContext.init(InitialContext.java:244)
>>         at javax.naming.InitialContext.<init>(InitialContext.java:216)
>>         at AMQPQPIDTest.runTest(AMQPQPIDTest.java:27)
>>         at AMQPQPIDTest.main(AMQPQPIDTest.java:20)
>> Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>         ... 9 more
>>
>
> Thats complaining about JMSContext, an interface from JMS 2.0, which
> the current client versions (0.20.0) implement/require rather than
> only JMS 1.1 like the older releases.

That was meant to be '0.20.0+', with the actual current version being
0.22.0 (though 0.23.0 is likely to be coming very soon)

>
> If the above SSL config was already being picked up however, it would
> suggest you have some other problem. I can't think any anything else
> form the limited information available, perhaps you can debug the
> failure (either via logging, protocol tracing, wireshark, etc) and get
> a better idea whats going on.
>
> Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: javax.jms.JMSException: Cannot send to a non-connected transport

Posted by Robbie Gemmell <ro...@gmail.com>.
On 11 May 2017 at 16:13, jeunii <ij...@gmail.com> wrote:
> Thanks for your reply.
>
> Actually it is picking up the config using the below config ::
>
>     System.setProperty("javax.net.ssl.trustStore",
> "C:/Users/xxxxx/qpid.jks");
>     System.setProperty("javax.net.ssl.trustStorePassword", "test123");
>
> If I remove these lines, the code will complain above a missing trustStore
> file.

Ok, perhaps it hasnt imported the classes yet due to using JNDI to
instantiate it.

> I tried using the latest library for Qpid but get the below ERROR ::
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/jms/JMSContext
>         at
> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getConnectionFactoryDefaults(JmsInitialContextFactory.java:202)
>         at
> org.apache.qpid.jms.jndi.JmsInitialContextFactory.createConnectionFactories(JmsInitialContextFactory.java:133)
>         at
> org.apache.qpid.jms.jndi.JmsInitialContextFactory.getInitialContext(JmsInitialContextFactory.java:103)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
>         at javax.naming.InitialContext.init(InitialContext.java:244)
>         at javax.naming.InitialContext.<init>(InitialContext.java:216)
>         at AMQPQPIDTest.runTest(AMQPQPIDTest.java:27)
>         at AMQPQPIDTest.main(AMQPQPIDTest.java:20)
> Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>         ... 9 more
>

Thats complaining about JMSContext, an interface from JMS 2.0, which
the current client versions (0.20.0) implement/require rather than
only JMS 1.1 like the older releases.

If the above SSL config was already being picked up however, it would
suggest you have some other problem. I can't think any anything else
form the limited information available, perhaps you can debug the
failure (either via logging, protocol tracing, wireshark, etc) and get
a better idea whats going on.

Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: javax.jms.JMSException: Cannot send to a non-connected transport

Posted by jeunii <ij...@gmail.com>.
Thanks for your reply.

Actually it is picking up the config using the below config ::
  
    System.setProperty("javax.net.ssl.trustStore",
"C:/Users/xxxxx/qpid.jks"); 
    System.setProperty("javax.net.ssl.trustStorePassword", "test123"); 

If I remove these lines, the code will complain above a missing trustStore
file. I tried using the latest library for Qpid but get the below ERROR ::

Exception in thread "main" java.lang.NoClassDefFoundError:
javax/jms/JMSContext
	at
org.apache.qpid.jms.jndi.JmsInitialContextFactory.getConnectionFactoryDefaults(JmsInitialContextFactory.java:202)
	at
org.apache.qpid.jms.jndi.JmsInitialContextFactory.createConnectionFactories(JmsInitialContextFactory.java:133)
	at
org.apache.qpid.jms.jndi.JmsInitialContextFactory.getInitialContext(JmsInitialContextFactory.java:103)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
	at javax.naming.InitialContext.init(InitialContext.java:244)
	at javax.naming.InitialContext.<init>(InitialContext.java:216)
	at AMQPQPIDTest.runTest(AMQPQPIDTest.java:27)
	at AMQPQPIDTest.main(AMQPQPIDTest.java:20)
Caused by: java.lang.ClassNotFoundException: javax.jms.JMSContext
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 9 more 



--
View this message in context: http://qpid.2158936.n2.nabble.com/javax-jms-JMSException-Cannot-send-to-a-non-connected-transport-tp7663061p7663067.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: javax.jms.JMSException: Cannot send to a non-connected transport

Posted by Robbie Gemmell <ro...@gmail.com>.
Its saying the connection failed. One thing that I can think of is
that maybe you are using an older version of the client, which doesnt
pick up changes to the javax.net.ssl.* system properties on the fly,
https://issues.apache.org/jira/browse/QPIDJMS-253, in which case you
can try setting when loading the app, or use the URI config.

On 11 May 2017 at 15:30, jeunii <ij...@gmail.com> wrote:
> I am using the `qpid-jms-client.jar` library to form a connection with a
> broker.
>
> My code is ::
>
>     Properties properties = new Properties();
>     properties.load(this.getClass().getResourceAsStream("jndi.properties"));
>     Context context = new InitialContext(properties);
>
>     System.setProperty("javax.net.ssl.trustStore",
> "C:/Users/xxxxx/qpid.jks");
>     System.setProperty("javax.net.ssl.trustStorePassword", "test123");
>
>     ConnectionFactory factory = (ConnectionFactory)
> context.lookup("myFactoryLookup");
>     Destination queue = (Destination) context.lookup("myQueueLookup");
>     Connection connection = factory.createConnection("<my-username>",
> "<my-password>");
>     connection.setExceptionListener(new MyExceptionListener());
>     connection.start();
>
> My jndi.properties file is ::
>
>
> java.naming.factory.initial=org.apache.qpid.jms.jndi.JmsInitialContextFactory
>     connectionfactory.myFactoryLookup=amqps://esesslx0100.se:9443
>     queue.myQueueLookup=emft_input
>     topic.myTopicLookup=topic
>     destination.topicExchange=amq.topic
>     jms.user=test
>
> Now the above code gives me the ERROR ::
>
>     Connection ExceptionListener fired, exiting.
>     javax.jms.JMSException: Cannot send to a non-connected transport.
>         at
> org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:66)
>         at
> org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:88)
>         at
> org.apache.qpid.jms.JmsConnection.onAsyncException(JmsConnection.java:1188)
>         at
> org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1104)
>         at
> org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:847)
>         at
> org.apache.qpid.jms.provider.amqp.AmqpProvider.pumpToProtonTransport(AmqpProvider.java:820)
>         at
> org.apache.qpid.jms.provider.amqp.AmqpProvider.access$300(AmqpProvider.java:90)
>         at
> org.apache.qpid.jms.provider.amqp.AmqpProvider$16.run(AmqpProvider.java:683)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
>     Caused by: java.io.IOException: Cannot send to a non-connected
> transport.
>         at
> org.apache.qpid.jms.transports.netty.NettyTcpTransport.checkConnected(NettyTcpTransport.java:279)
>         at
> org.apache.qpid.jms.transports.netty.NettyTcpTransport.allocateSendBuffer(NettyTcpTransport.java:176)
>         at
> org.apache.qpid.jms.provider.amqp.AmqpProvider.pumpToProtonTransport(AmqpProvider.java:806)
>         ... 9 more
>
> Since the broker is configures with SaSL, I am also providing my username
> and password. I am currently unaware of why this ERROR occurs. Ive looked
> around on the internet but there is no clear explanation as to why it would
> occur with qpid. Any ideas why this ERROR occurs ?
>
> My trustStore file is correct since I have verifies SSL connectivity using
> it.
>
>
>
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/javax-jms-JMSException-Cannot-send-to-a-non-connected-transport-tp7663061.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org