The "out of tomee" code hasnt jms2 implemented since tomee impl jms 2 on top of amq 5. Either run the client in tomee or use amq 5 client api.
Side note: importing openejb-core there is probably a way to do it using openejb amq extensions but it is not documented/official. An easier alternative is probably a small application composer openejb application providing all tomee backbone in your main. Le 21 sept. 2016 20:56, "vnalla" <[email protected]> a écrit : > Hi, > > I am using TomEE Plume 7.0.1 and trying to send a message using JMS Remote > Client. > > Here is the Code (followed > https://github.com/apache/tomee/tree/master/examples/ > client-resource-lookup-preview > ): > System.setProperty("aConnectionFactory", > "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp: > //localhost:11616"); > System.setProperty("aQueue", > "queue:org.apache.activemq.command.ActiveMQQueue:classicQueue"); > > final Properties properties = new Properties(); > properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, > "org.apache.openejb.client.RemoteInitialContextFactory"); > properties.setProperty(Context.PROVIDER_URL, > "http://localhost:8080/tomee/ejb"); > > final Context context = new InitialContext(properties); > > > final Queue destination = (Queue) context.lookup("java:aQueue"); > assertNotNull(destination); > assertEquals("classicQueue", destination.getQueueName()); > > > final ConnectionFactory connectionFactory = (ConnectionFactory) > context.lookup("java:aConnectionFactory"); > assertNotNull(connectionFactory); > > Up to this part it is working. The following code are not working: > > JMSContext jmscontext = connectionFactory.createContext(); resutls in the > following exception > INFO: > RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb} > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.144 sec > <<< FA > ILURE! - in com.mycompany.test.TestClient > testClient(com.mycompany.test.TestClient) Time elapsed: 0.124 sec <<< > ERROR! > java.lang.AbstractMethodError: > org.apache.activemq.ActiveMQConnectionFactory.cre > ateContext()Ljavax/jms/JMSContext; > > at com.mycompany.test.TestClient.testClient(TestClient.java:182 > > If I try to do the following, it fails to connect > QueueConnection qconnection = > ((org.apache.activemq.ActiveMQConnectionFactory)connectionFactory). > createQueueConnection(); > results in the following exception: > INFO: > RemoteInitialContextCreated{providerUri=http://localhost:8080/tomee/ejb} > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.374 sec > <<< FA > ILURE! - in com.mycompany.test.TestClient > testClient(com.mycompany.test.TestClient) Time elapsed: 1.356 sec <<< > ERROR! > javax.jms.JMSException: Could not connect to broker URL: > tcp://localhost:11616. > Reason: java.net.ConnectException: Connection refused: connect > at com.mycompany.test.TestClient.testClient(TestClient.java:184) > Caused by: java.net.ConnectException: Connection refused: connect > at com.mycompany.test.TestClient.testClient(TestClient.java:184) > > Thanks, > Venkat > > > > > > > > > -- > View this message in context: http://tomee-openejb.979440. > n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
