You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hkgot <ha...@gmail.com> on 2015/08/27 03:17:15 UTC

How to reference connection factory and queues from code

I configured connection factory and queues in tomee.xml. Now I need to use
these from standalone app as well as ear file. 

tomee.xml:
<?xml version="1.0" encoding="UTF-8"?>
<tomee>
 
<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
        BrokerXmlConfig =  broker:(tcp://10.1.0.56:61616)
        ServerUrl       = tcp://10.1.0.56:61616
    </Resource>

    <Resource id="MyJmsConnectionFactory"
type="javax.jms.ConnectionFactory">
    
        ResourceAdapter = MyJmsResourceAdapter
    </Resource>

    <Container id="MyJmsMdbContainer" ctype="MESSAGE">
        ResourceAdapter = MyJmsResourceAdapter
    </Container>

    <Resource id="messageQueue1" type="javax.jms.Queue"/>
    <Resource id="messageQueue2" type="javax.jms.Queue"/>
    <Resource id="messageQueue3" type="javax.jms.Queue"/>

<Deployments dir="apps" />
</tomee>

Here is my code:
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
    props.put(Context.URL_PKG_PREFIXES, "org.apache.activemq.jndi");
    props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL, "tcp://10.1.0.56:61616");
InitialContext initialContext = new InitialContext(props);

//The below is not working
          ConnectionFactory connectionFactory = (ConnectionFactory)
initialContext.lookup("MyJmsConnectionFactory");

//The below is working from standalone app, but not from Ear code
          ConnectionFactory connectionFactory = (ConnectionFactory)
initialContext.lookup("ConnectionFactory");

//The below is not working from stand alone app
initialContext.lookup("messageQueue1");

//The below is working from stand alone up - it looks like it is creating
new queue? But I dont want to create new queue as I already created in
tomee.xml
initialContext.lookup("dynamicQueues/messageQueue1");

I didn't even try looking up for queue from Ear code as I am struck at
connection factory itself. 

My MDB is working fine with the below entry in ejb-jar.xml:
<activation-config-property>
             
<activation-config-property-name>destination</activation-config-property-name>
             
<activation-config-property-value>messageQueue1</activation-config-property-value>
          </activation-config-property>

Basically, I want to configure a connection factory and queues during
startup and then use from 3 different places via JNDI:
1. From stand alone app to send messages - working as ConnectionFactory not
as MyJmsConnectionFactory. Working as dynamicQueues/messageQueue1 not as
messageQueue1
2. From ear app to send the messages - ConnectionFactory is not working
3. Process messages using MDB - working fine and I could process messages
from messageQueue1 - didn't specify any connection factory in ejb-jar.xml. I
guess it is using ConnectionFactory from my MDB.

Questions:
Am I declaring correct in tomee.xml?
How do I call it from the stand alone app?
How do I call it from Ear app?
Do I need to use same connection factory in ejb-jar.xml?




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
ServerUrl and BrokerXmlConfig are conflicting in your resource


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-09 20:31 GMT-07:00 hkgot <ha...@gmail.com>:

> I think so.
>
> My remote client has this:
> System.setProperty("aConnectionFactory",
>
> "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616");
> ConnectionFactory connectionFactory = (ConnectionFactory)
> initialContext.lookup("java:aConnectionFactory");
>
> tomee.xml has this;
>
> <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
>         BrokerXmlConfig =  broker:(tcp://localhost:61616)
>         ServerUrl       = vm://localhost
>     </Resource>
>     <Resource id="MyJmsConnectionFactory"
> type="javax.jms.ConnectionFactory">
>         ResourceAdapter = MyJmsResourceAdapter
>     </Resource>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676173.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
I think so.

My remote client has this:
System.setProperty("aConnectionFactory",
"connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616");
ConnectionFactory connectionFactory = (ConnectionFactory)
initialContext.lookup("java:aConnectionFactory");

tomee.xml has this;

<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
        BrokerXmlConfig =  broker:(tcp://localhost:61616)
        ServerUrl       = vm://localhost
    </Resource>
    <Resource id="MyJmsConnectionFactory"
type="javax.jms.ConnectionFactory">
        ResourceAdapter = MyJmsResourceAdapter
    </Resource>



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676173.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
do both use the same broker? - ie do you have set up the connection factory
accordingly?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-09 20:17 GMT-07:00 hkgot <ha...@gmail.com>:

> System.setProperty("aQueue",
> "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
>
> final Queue destination = (Queue) context.lookup("java:aQueue"); ------>
> This seems to be working
>
> In ejb.jar.xml:
>  <enterprise-beans>
>
>     <message-driven>
>       <ejb-name>MyMessageBean</ejb-name>
>       <ejb-class>com.xyz.MyMessageBean</ejb-class>
>         <messaging-type>javax.jms.MessageListener</messaging-type>
>       <transaction-type>Container</transaction-type>
> <activation-config>
>           <activation-config-property>
>
>
> <activation-config-property-name>destination</activation-config-property-name>
>
> <activation-config-property-value>aQueue</activation-config-property-value>
>           </activation-config-property>
>           .
>           .
>           .
>
>
> The above configuration is not invoking MyMessageBean even after I send a
> message to aQueue.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676171.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
System.setProperty("aQueue",
"queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");

final Queue destination = (Queue) context.lookup("java:aQueue"); ------>
This seems to be working

In ejb.jar.xml:
 <enterprise-beans>
    
    <message-driven>
      <ejb-name>MyMessageBean</ejb-name>
      <ejb-class>com.xyz.MyMessageBean</ejb-class>
        <messaging-type>javax.jms.MessageListener</messaging-type>
      <transaction-type>Container</transaction-type>
<activation-config>
          <activation-config-property>
             
<activation-config-property-name>destination</activation-config-property-name>
             
<activation-config-property-value>aQueue</activation-config-property-value>
          </activation-config-property>
          .
          .
          .


The above configuration is not invoking MyMessageBean even after I send a
message to aQueue. 



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676171.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-09-09 18:35 GMT-07:00 hkgot <ha...@gmail.com>:

> OK, I am going with system properties as per your suggestion. This is what
> I
> set:
>
> System.setProperty("aQueue",
> "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
>
> aQueue is the queue name or queue is the queue name?
>
>
aQueue


> With this I could create a message on the queue. How do I link my MDB
> listen
> to this queue? What queue name should I use in ejb-jar.xml for my MDB?
>
>
>
use destination activation config:
http://tomee.apache.org/jms-resources-and-mdb-container.html


>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676166.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
OK, I am going with system properties as per your suggestion. This is what I
set:

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

aQueue is the queue name or queue is the queue name? 

With this I could create a message on the queue. How do I link my MDB listen
to this queue? What queue name should I use in ejb-jar.xml for my MDB?



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676166.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
on server side http://tomee.apache.org/containers-and-resources.html
applies, on client side you need to either use the system properties or a
"custom" resource ie use class-name config, nothing more complicated, just
declare what you need.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-08 6:52 GMT-07:00 hkgot <ha...@gmail.com>:

> I am confused.... Your sample creates connection factory and queues on fly
> instead of using from config files. If I create on fly, how do I manage
> connection factory with min/max connections etc.?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676163.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
I am confused.... Your sample creates connection factory and queues on fly
instead of using from config files. If I create on fly, how do I manage
connection factory with min/max connections etc.?



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676163.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Then the sample i referenced does exactly that
Le 7 sept. 2015 21:51, "hkgot" <ha...@gmail.com> a écrit :

> My remote client is not on the same JVM where EAR is. It's on a separate
> machine.
>
> Sorry, I couldn't understand your explanation. Apologies for my lack of
> understanding. Is there a sample code/configuration setting that will show
> how to reference same connection factory, queues from server and remote
> clients? Thx.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676161.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
My remote client is not on the same JVM where EAR is. It's on a separate
machine. 

Sorry, I couldn't understand your explanation. Apologies for my lack of
understanding. Is there a sample code/configuration setting that will show
how to reference same connection factory, queues from server and remote
clients? Thx.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676161.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
still inline ;)

2015-09-07 20:14 GMT-07:00 hkgot <ha...@gmail.com>:

> "ConnectionFactory can be defined using a custom resource
> (with class-name), I guess for remote connections it can be the best
> solution but if parts of your ear are communicating together using local
> transport would make smooth to just reuse the same server resources."
>
> If I understand this correct, you are suggesting to reuse server resources
> both from server and remote client. Right? If yes, how do I reuse/reference
> the same server resources from remote client code?
>
>
this was my question, is "parts" of your ear are in the same JVM you just
reference them using the id as name in @Resource. If not this still works
for destinations but for connection factories you need to use next trick.


> Sorry, I couldn't understand custom resource (with class-name) - could you
> elobarate more on this? Thx.
>
>
>
In TomEE you can define a @Resource using: <Resource id="..."
class-name="xxxx">props as usual</Resource>.

This will do a new xxx(); and match properties using xxx setters. This
allows you to use any type as injection in your app. I would use it to
build a full client connection factory instead of relying on a server one
(see activemq doc for more details on the difference between the resource
adapter and the clients).


>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676158.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
"ConnectionFactory can be defined using a custom resource 
(with class-name), I guess for remote connections it can be the best 
solution but if parts of your ear are communicating together using local 
transport would make smooth to just reuse the same server resources."

If I understand this correct, you are suggesting to reuse server resources
both from server and remote client. Right? If yes, how do I reuse/reference
the same server resources from remote client code?

Sorry, I couldn't understand custom resource (with class-name) - could you
elobarate more on this? Thx.





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676158.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-09-07 19:51 GMT-07:00 hkgot <ha...@gmail.com>:

> "if I read it right, activemq is using name + connection to identify a
> queue
> so referencing the same name and the right connection will do the job"
>
> What is the right connection from EAR client side? Your sample code takes
> care of remote client, what about EAR client code?
>
>
All server side code can reuse out of the box server resources, for
destinations (queues, topic) nothing different from using normal server
queues/topics. ConnectionFactory can be defined using a custom resource
(with class-name), I guess for remote connections it can be the best
solution but if parts of your ear are communicating together using local
transport would make smooth to just reuse the same server resources.


> If I call EAR client as "Server" and remote client as "Client", what is the
> simple way to reference same connection factory and queues both from Server
> and Client?
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676156.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
"if I read it right, activemq is using name + connection to identify a queue 
so referencing the same name and the right connection will do the job"

What is the right connection from EAR client side? Your sample code takes
care of remote client, what about EAR client code?

If I call EAR client as "Server" and remote client as "Client", what is the
simple way to reference same connection factory and queues both from Server
and Client? 





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676156.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

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

2015-09-07 19:02 GMT-07:00 hkgot <ha...@gmail.com>:

> Hi Romain,
>
> Thanks for the quick response. Appreacited!!!
>
> My problem is this:
>
> Active MQ runs as embedded inside Tomee.
>
> Remote client sends a message M1 to queue Q1 (Remote client)
> MDB part of ear on the same Tomee receives and processes message M1 from
> queue Q1
> MDB part of ear on the same Tomee sends another message M2 to queue Q2
> (Client part of EAR)
>
> Q1: How both clients can reference the same queues?
>
>
if I read it right, activemq is using name + connection to identify a queue
so referencing the same name and the right connection will do the job


> Q2: what is the point of creating connection factory and queues in
> Tomee.xml
> if I create both dynamically on the client side?
>
>
>
the server needs it ;). No point for the clients.


>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676154.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
Hi Romain, 

Thanks for the quick response. Appreacited!!!

My problem is this:

Active MQ runs as embedded inside Tomee. 

Remote client sends a message M1 to queue Q1 (Remote client)
MDB part of ear on the same Tomee receives and processes message M1 from
queue Q1
MDB part of ear on the same Tomee sends another message M2 to queue Q2
(Client part of EAR)

Q1: How both clients can reference the same queues? 

Q2: what is the point of creating connection factory and queues in Tomee.xml
if I create both dynamically on the client side?







--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676154.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

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

Actually client is not using the server resource for 2 main reasons but you
can define multiple client resources using the id instead of the qualified
name IIRC.
Reasons are:

- way to make it working would be to
-- get a fully remote resource (would be slow and inefficient)
-- guess what you need on client side (would never be adapted)
-- allow you to define client resources on server side (what would be the
point?)
- each client can need a different config depending its needs and usage of
the resource





Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-07 18:37 GMT-07:00 hkgot <ha...@gmail.com>:

> Hi Romain,
>
> Finally, I got a chance to try this. The below code is working:
>
> System.setProperty("aConnectionFactory",
>
> "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");
> System.setProperty("aQueue",
> "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
> final ConnectionFactory connectionFactory = (ConnectionFactory)
> context.lookup("java:aConnectionFactory");
>
> However, I am not sure whether this is creating a new connection factory or
> referencing the connection factory from tomee.xml. Because what I
> configured
> in tomee.xml is MyJmsConnectionFactory, not connectionFactory.
>
> <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
>         ResourceAdapter = MyJmsResourceAdapter
>     </Resource>
>
> In the sample you provided, aConnectionFactory is referencing
>
> connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616,
> not MyJmsConnectionFactory. How do I reference to MyJmsConnectionFactory?
>
> Thx.
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676152.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
Hi Romain,

Finally, I got a chance to try this. The below code is working:

System.setProperty("aConnectionFactory",
"connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616");
System.setProperty("aQueue",
"queue:org.apache.activemq.command.ActiveMQQueue:LISTENER");
final ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("java:aConnectionFactory");

However, I am not sure whether this is creating a new connection factory or
referencing the connection factory from tomee.xml. Because what I configured
in tomee.xml is MyJmsConnectionFactory, not connectionFactory. 

<Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
        ResourceAdapter = MyJmsResourceAdapter
    </Resource>

In the sample you provided, aConnectionFactory is referencing
connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616,
not MyJmsConnectionFactory. How do I reference to MyJmsConnectionFactory?

Thx.









--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676152.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
think the relevant sample is
https://github.com/apache/tomee/tree/master/examples/client-resource-lookup-preview
with more info on
http://tomee-openejb.979440.n4.nabble.com/Remote-JNDI-access-to-JMS-resources-td4656767.html
 and https://issues.apache.org/jira/browse/TOMEE-393


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-30 10:10 GMT+02:00 hkgot <ha...@gmail.com>:

> Yes, stand alone means a remote client. I have a tomcat running with
> embedded
> Active MQ and the remote client is running the on the same machine. I do
> have a remote client running on a different machine, but let's tackle one
> problem at a time. Thx.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676009.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
Yes, stand alone means a remote client. I have a tomcat running with embedded
Active MQ and the remote client is running the on the same machine. I do
have a remote client running on a different machine, but let's tackle one
problem at a time. Thx.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676009.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Can you precise what standalone means? Remote client of a running server,
embedded server or other?
Le 29 août 2015 16:26, "hkgot" <ha...@gmail.com> a écrit :

> Hi Jonathan,
>
> The link has MDB examples:
>
> JMS and MDBs
> injection-of-connectionfactory
> simple-mdb-with-descriptor
> simple-mdb
>
> My question is using the connection factory and queues defined in tomee.xml
> in a stand alone program. I am getting NaminException when I try to use
> MyJMsConnectionFactory in a stand alone program. Do I need to configure
> these resources in server.xml instead of tomee.xml in order to access from
> a
> stand alone program via JNDI? If not, do I need to access
> MyJMsConnectionFactory with some prefix?
>
> Thx.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676006.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
Hi Jonathan,

The link has MDB examples:

JMS and MDBs
injection-of-connectionfactory 
simple-mdb-with-descriptor 
simple-mdb

My question is using the connection factory and queues defined in tomee.xml
in a stand alone program. I am getting NaminException when I try to use
MyJMsConnectionFactory in a stand alone program. Do I need to configure
these resources in server.xml instead of tomee.xml in order to access from a
stand alone program via JNDI? If not, do I need to access
MyJMsConnectionFactory with some prefix?

Thx.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676006.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: How to reference connection factory and queues from code

Posted by Jonathan Fisher <jo...@springventuregroup.com>.
http://tomee.apache.org/examples-trunk/


*Jonathan S. Fisher*


On Thu, Aug 27, 2015 at 8:18 PM, hkgot <ha...@gmail.com> wrote:

> Any help is appreciated.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676000.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

-- 
Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). The message is intended for the sole use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are notified that any use, distribution or copying of the 
message is strictly prohibited and may subject you to criminal or civil 
penalties. If you received this transmission in error, please contact the 
sender immediately by replying to this email and delete the material from 
any computer.

Re: How to reference connection factory and queues from code

Posted by Abdelhamid Meddeb <ab...@meddeb.net>.
Hi,

If this is about JMS service and programmatically do it:

http://www.meddeb.net/bee

Create and manage JMS service programmatically.

Cheers.

Le 28/08/2015 03:18, hkgot a écrit :
> Any help is appreciated.
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676000.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

-- 
*Abdelhamid Meddeb*
http://www.meddeb.net


Re: How to reference connection factory and queues from code

Posted by hkgot <ha...@gmail.com>.
Any help is appreciated.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676000.html
Sent from the TomEE Users mailing list archive at Nabble.com.