You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by vnalla <v_...@hotmail.com> on 2016/09/21 18:51:27 UTC
JMS Remote Client is not working
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.
Re: JMS Remote Client is not working
Posted by Romain Manni-Bucau <rm...@gmail.com>.
clone https://git-wip-us.apache.org/repos/asf?p=tomee.git;a=summary
and to build:
mvn clean install -pl tomee/apache-tomee -am -DskipTests -T4C
tomee will be in tomee/apache-tomee/target
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-09-21 23:08 GMT+02:00 vnalla <v_...@hotmail.com>:
> Will do, it but how do I get the code base for 7.0.2?
>
> thanks,
> Venkat
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182p4680186.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: JMS Remote Client is not working
Posted by vnalla <v_...@hotmail.com>.
Will do, it but how do I get the code base for 7.0.2?
thanks,
Venkat
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182p4680186.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: JMS Remote Client is not working
Posted by vnalla <v_...@hotmail.com>.
7.0.2 SNAPSHOT does not throw exception., but the app is not working. As you
mentioned I might have to create war file with the test and deploy the war
instead 1b7b5d8e-167c-4acf-8fd8-468245dbb1b0
thanks,
Venkat
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182p4680192.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: JMS Remote Client is not working
Posted by Romain Manni-Bucau <rm...@gmail.com>.
7.0.2-SNAPSHOT has some work around that IIRC, if you want to try to build
it to test it would be appreciated
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2016-09-21 22:52 GMT+02:00 vnalla <v_...@hotmail.com>:
> Hi,
>
> JMSConsumer consumer = jms.createDurableConsumer(topic,
> Resources.SUBSCRIPTION); this code is in the Singleton ejb in a method
> annotated with @PostConstruct throwing exception
>
> 21-Sep-2016 16:48:08.433 SEVERE [http-nio-0.0.0.0-8080-exec-2]
> org.apache.openejb.core.transaction.EjbTransactionUtil.
> handleSystemException
> EjbTransactionUtil.handleSystemException:
> org.apache.activemq.ActiveMQSession.createDurableConsumer(Ljavax/
> jms/Topic;Ljava/lang/String;)Ljavax/jms/MessageConsumer;^M
> java.lang.AbstractMethodError:
> org.apache.activemq.ActiveMQSession.createDurableConsumer(Ljavax/
> jms/Topic;Ljava/lang/String;)Ljavax/jms/MessageConsumer;^M
> at
> org.apache.openejb.resource.activemq.jms2.JMSContextImpl.
> createDurableConsumer(JMSContextImpl.java:241)^M
> at
> org.javaee7.jms.batch.SubscriptionCreator.createSubscription(
> SubscriptionCreator.java:38)^M
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 62)^M
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)^M
> at java.lang.reflect.Method.invoke(Method.java:498)^M
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> Invocation.invoke(ReflectionInvocationContext.java:205)^M
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> LifecycleInvocation.invoke(ReflectionInvocationContext.java:237)^M
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
> ReflectionInvocationContext.java:186)
>
> thanks,
> Venkat
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182p4680184.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: JMS Remote Client is not working
Posted by vnalla <v_...@hotmail.com>.
Hi,
JMSConsumer consumer = jms.createDurableConsumer(topic,
Resources.SUBSCRIPTION); this code is in the Singleton ejb in a method
annotated with @PostConstruct throwing exception
21-Sep-2016 16:48:08.433 SEVERE [http-nio-0.0.0.0-8080-exec-2]
org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException
EjbTransactionUtil.handleSystemException:
org.apache.activemq.ActiveMQSession.createDurableConsumer(Ljavax/jms/Topic;Ljava/lang/String;)Ljavax/jms/MessageConsumer;^M
java.lang.AbstractMethodError:
org.apache.activemq.ActiveMQSession.createDurableConsumer(Ljavax/jms/Topic;Ljava/lang/String;)Ljavax/jms/MessageConsumer;^M
at
org.apache.openejb.resource.activemq.jms2.JMSContextImpl.createDurableConsumer(JMSContextImpl.java:241)^M
at
org.javaee7.jms.batch.SubscriptionCreator.createSubscription(SubscriptionCreator.java:38)^M
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)^M
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)^M
at java.lang.reflect.Method.invoke(Method.java:498)^M
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)^M
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:237)^M
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
thanks,
Venkat
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JMS-Remote-Client-is-not-working-tp4680182p4680184.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: JMS Remote Client is not working
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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" <v_...@hotmail.com> 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.
>