You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Dignesh <dg...@opentext.com> on 2016/07/05 12:45:56 UTC

Remote JNDI look up to ConnectionFactories is failing

Hi ,

I am using 7.0.1 version of TomEE. I am doing remote jndi look up to
connection factory from my local client program.I am not sure is there
something which I am missing. Can anyone please help me out in finding what
is the issue here.
I have attached my client program for reference.
clientProgram.txt
<http://tomee-openejb.979440.n4.nabble.com/file/n4679228/clientProgram.txt>  

Below is stack trace 

Jul 05, 2016 6:46:42 PM org.apache.openejb.client.EventLogger log
INFO: RemoteInitialContextCreated{providerUri=ejbd://localhost:4201}
Jul 05, 2016 6:46:42 PM org.apache.openejb.client.EventLogger log
INFO: ConnectionOpened{uri=ejbd://localhost:4201}
Exception in thread "main" javax.naming.NamingException: Unknown JNDI name
prefix 'openejb/remote/openejb:'
	at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:130)
	at
org.apache.openejb.server.ejbd.JndiRequestHandler.doLookup(JndiRequestHandler.java:261)
	at
org.apache.openejb.server.ejbd.JndiRequestHandler.processResponse(JndiRequestHandler.java:174)
	at
org.apache.openejb.server.ejbd.EjbDaemon.processJndiResponse(EjbDaemon.java:370)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:275)
	at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:104)
	at
org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:277)
	at
org.apache.openejb.server.ejbd.KeepAliveServer$Session.access$1000(KeepAliveServer.java:196)
	at
org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:331)
	at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:90)
	at
org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
	at
org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
	at org.apache.openejb.server.ServiceStats.service(ServiceStats.java:54)
	at
org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
	at org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:93)
	at
org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
	at org.apache.openejb.server.ServicePool.access$201(ServicePool.java:39)
	at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:208)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ok so then compare the instances you used and the one you get with the
config you set up. There is probably a difference there.


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-07-06 15:22 GMT+02:00 Dignesh <dg...@opentext.com>:

> Yes I am able to send messages successfully by doing "new"
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679242.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Dignesh <dg...@opentext.com>.
Yes I am able to send messages successfully by doing "new"



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679242.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
you can activate org.apache.activemq debug logs.

Do you manage to send a message doing the "new" yourself like mentionned in
previous message?


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-07-06 14:59 GMT+02:00 Dignesh <dg...@opentext.com>:

> I have verified url and Listener, both of them are valid.But still I dont
> see
> listener receiving any messages.
> Is there any way possibly via logs etc.. to determine why the messages are
> not sent.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679239.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Dignesh <dg...@opentext.com>.
I have verified url and Listener, both of them are valid.But still I dont see
listener receiving any messages.
Is there any way possibly via logs etc.. to determine why the messages are
not sent.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679239.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

answered inline

2016-07-06 13:30 GMT+02:00 Dignesh <dg...@opentext.com>:

> Hi Romain,
>
> Just few questions on configuring the resources in client.
>
> System.setProperty("aConnectionFactory",
>
> "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");
>
> So in the above property.What should be the value of the port - Is it
> something the serverURL we specify for resource in tomee.xml file.
>
>
Yes, the network connector url of the broker


> System.setProperty("aQueue",
> "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
>
> If I need to configure a topic in the client - Should I add the property in
> the below format ?
>
> System.setProperty("xyz",
> "topic:org.apache.activemq.command.ActiveMQTopic:LISTENER");
>
>
yes


>
> Currently my client program contains below 2 system properties. And I dont
> see any issues with look ups.But Messages I send are not received by the
> listener. So is there any other configuration where I am going wrong.
> System.setProperty("digneshConnection",
>
> "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616");
> System.setProperty("xyz",
> "topic:org.apache.activemq.command.ActiveMQTopic:LISTENER");
>
>
>
will just do a new ActiveMQConnectionFactory("tcp://localhost:61616"); and
new ActiveMQTopic("LISTENER");

If these settings (url and topic name) are not valid then you will not hit
your server.


>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679237.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Dignesh <dg...@opentext.com>.
Hi Romain,

Just few questions on configuring the resources in client.

System.setProperty("aConnectionFactory",
"connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");

So in the above property.What should be the value of the port - Is it
something the serverURL we specify for resource in tomee.xml file.

System.setProperty("aQueue",
"queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");

If I need to configure a topic in the client - Should I add the property in
the below format ?

System.setProperty("xyz",
"topic:org.apache.activemq.command.ActiveMQTopic:LISTENER");


Currently my client program contains below 2 system properties. And I dont
see any issues with look ups.But Messages I send are not received by the
listener. So is there any other configuration where I am going wrong.
System.setProperty("digneshConnection",
"connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616");
System.setProperty("xyz",
"topic:org.apache.activemq.command.ActiveMQTopic:LISTENER");




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679237.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
1. that's the way
2. no for the mentionned reasons. The way to solve it would likely be to
write a remote EJB acting as a proxy and getting injected the factory and
queue or equivalent.


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-07-05 15:03 GMT+02:00 Dignesh <dg...@opentext.com>:

> Thank you Romain.
>
> 1.I am using ejbd:// for JNDI look up to ejb's - The ejb's are deployed in
> tomee. I have activated it by adding
> openejb.service.manager.class =
> org.apache.openejb.server.SimpleServiceManager
> in system.properties file -  No issues with this configuration. Please let
> me know I am doing some thing wrong here.
>
> 2.Is there any other alternative apart from configuring connection
> factories
> in client as system property.
> In short i dont want to have below two statements in my client program
>       System.setProperty("aConnectionFactory",
>
> "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");
>         System.setProperty("aQueue",
> "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679232.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Dignesh <dg...@opentext.com>.
Thank you Romain.

1.I am using ejbd:// for JNDI look up to ejb's - The ejb's are deployed in
tomee. I have activated it by adding 
openejb.service.manager.class =
org.apache.openejb.server.SimpleServiceManager
in system.properties file -  No issues with this configuration. Please let
me know I am doing some thing wrong here.

2.Is there any other alternative apart from configuring connection factories
in client as system property. 
In short i dont want to have below two statements in my client program
      System.setProperty("aConnectionFactory",
"connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");
        System.setProperty("aQueue",
"queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228p4679232.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Remote JNDI look up to ConnectionFactories is failing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

several things:

- ejbd:// is only used if you set it up in tomee, default is deactivated
- default ejbd transport for tomee is http (http://xxxxxxx/tomee/ejb) but
it needs to be activated too, see tomee.remote.support on
http://tomee.apache.org/properties-listing.html
- connection factories client needs to be configured in the client, there
is a sample there
https://github.com/apache/tomee/blob/master/examples/client-resource-lookup-preview/src/test/java/org/superbiz/client/SenderTest.java#L34
(making the why short: otherwise the server would provide either a remote
proxy which would be slow or a shared client config which would likely be
inaccurate)




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-07-05 14:45 GMT+02:00 Dignesh <dg...@opentext.com>:

> Hi ,
>
> I am using 7.0.1 version of TomEE. I am doing remote jndi look up to
> connection factory from my local client program.I am not sure is there
> something which I am missing. Can anyone please help me out in finding what
> is the issue here.
> I have attached my client program for reference.
> clientProgram.txt
> <http://tomee-openejb.979440.n4.nabble.com/file/n4679228/clientProgram.txt
> >
>
> Below is stack trace
>
> Jul 05, 2016 6:46:42 PM org.apache.openejb.client.EventLogger log
> INFO: RemoteInitialContextCreated{providerUri=ejbd://localhost:4201}
> Jul 05, 2016 6:46:42 PM org.apache.openejb.client.EventLogger log
> INFO: ConnectionOpened{uri=ejbd://localhost:4201}
> Exception in thread "main" javax.naming.NamingException: Unknown JNDI name
> prefix 'openejb/remote/openejb:'
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:130)
>         at
>
> org.apache.openejb.server.ejbd.JndiRequestHandler.doLookup(JndiRequestHandler.java:261)
>         at
>
> org.apache.openejb.server.ejbd.JndiRequestHandler.processResponse(JndiRequestHandler.java:174)
>         at
>
> org.apache.openejb.server.ejbd.EjbDaemon.processJndiResponse(EjbDaemon.java:370)
>         at
> org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:275)
>         at
> org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:104)
>         at
>
> org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:277)
>         at
>
> org.apache.openejb.server.ejbd.KeepAliveServer$Session.access$1000(KeepAliveServer.java:196)
>         at
>
> org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:331)
>         at
> org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:90)
>         at
>
> org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
>         at
>
> org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
>         at
> org.apache.openejb.server.ServiceStats.service(ServiceStats.java:54)
>         at
>
> org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
>         at
> org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:93)
>         at
>
> org.apache.openejb.server.ServerServiceFilter.service(ServerServiceFilter.java:65)
>         at
> org.apache.openejb.server.ServicePool.access$201(ServicePool.java:39)
>         at
> org.apache.openejb.server.ServicePool$3.run(ServicePool.java:208)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:744)
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-look-up-to-ConnectionFactories-is-failing-tp4679228.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>