You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by ebmm_axis <tl...@myrealbox.com> on 2008/11/13 21:23:58 UTC
Global JNDI Destinations with ActiveMQ
First and foremost, thanks to the openEJB team for all the efforts...
I am running openEJB as a stand alone server and haven't dove into it's use
with a full application server.
My reasoning for this is to keep things simple and just learn the ins and
outs of OpenEJB.
Using the Default Resource Adapter I am able to use MDBs successfully
throughout my application.
BUT, if I want to access any destination (queue or topic) GLOBALLY from a
'stand alone' client, I'm not able to. (i.e. I would like to globally
resolve via JNDI my JMSConnectionFactory and the queues/topics that I have
set up in openejb.xml)
I am failing to connect the dots with the configurations required that will
provide the global JNDI name resolution.
Any comments and direction would be much appreciated.
--
View this message in context: http://www.nabble.com/Global-JNDI-Destinations-with-ActiveMQ-tp20488872p20488872.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Global JNDI Destinations with ActiveMQ
Posted by David Blevins <da...@visi.com>.
On Nov 13, 2008, at 12:23 PM, ebmm_axis wrote:
>
> First and foremost, thanks to the openEJB team for all the efforts...
>
> I am running openEJB as a stand alone server and haven't dove into
> it's use
> with a full application server.
> My reasoning for this is to keep things simple and just learn the
> ins and
> outs of OpenEJB.
>
>
> Using the Default Resource Adapter I am able to use MDBs successfully
> throughout my application.
> BUT, if I want to access any destination (queue or topic) GLOBALLY
> from a
> 'stand alone' client, I'm not able to. (i.e. I would like to globally
> resolve via JNDI my JMSConnectionFactory and the queues/topics that
> I have
> set up in openejb.xml)
>
> I am failing to connect the dots with the configurations required
> that will
> provide the global JNDI name resolution.
>
> Any comments and direction would be much appreciated.
For a standalone client that is running locally (i.e. inside the same
vm as the server) you should be able to look things up by constructing
an initial context exactly like this:
InitialContext context = new InitialContext(); // no params
context.lookup("java:openejb/Resource/theResourceName");
Where "theResourceName" is whatever you called it in your
openejb.xml. That should give you access to the "java:openejb" global
jndi tree.
Note that this will not work from an EJB or similar component with a
"java:comp/env" namespace. We could make it available there too if
you need it.
Also note that this will not work from a remote client as pretty much
nothing in java:openejb/Resource is serializable. We have some code
for allowing users to configure a DataSource or ConnectionFactory on
the client via system properties with the ability to then look them up
via JNDI. The syntax for that is like this:
java .... -
DmyDataSource=datasource:org.hsqldb.jdbcDriver:jdbc:hsqldb:hsql://
localhost/mydb;user=joe;password=cool \
-
DmyConnectionFactory
=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://
localhost:61616 \
org.superbiz.MyClient
You can then create an InitialContext via the
RemoteInitialContextFactory and lookup "myDataSource" and get a
DataSource or lookup "myConnectionFactory" and get a ConnectionFactory.
And as always we're open to new features in this regard, so if you
have any ideas we'd love to hear them.
-David
Re: Global JNDI Destinations with ActiveMQ
Posted by David Blevins <da...@visi.com>.
On Nov 13, 2008, at 12:23 PM, ebmm_axis wrote:
>
> First and foremost, thanks to the openEJB team for all the efforts...
>
> I am running openEJB as a stand alone server and haven't dove into
> it's use
> with a full application server.
> My reasoning for this is to keep things simple and just learn the
> ins and
> outs of OpenEJB.
>
>
> Using the Default Resource Adapter I am able to use MDBs successfully
> throughout my application.
> BUT, if I want to access any destination (queue or topic) GLOBALLY
> from a
> 'stand alone' client, I'm not able to. (i.e. I would like to globally
> resolve via JNDI my JMSConnectionFactory and the queues/topics that
> I have
> set up in openejb.xml)
>
> I am failing to connect the dots with the configurations required
> that will
> provide the global JNDI name resolution.
>
> Any comments and direction would be much appreciated.