Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Romain Manni-Bucau
Thanks for the feedback!

- Romain
Le 17 avr. 2012 18:31, "Bjorn Danielsson" 
a écrit :

> Problem solved!
>
> Thanks AndyG, this did the trick. I compiled a fresh ActiveMQ
> snapshot (r1327126) and replaced the files from your list, and
> now everything works. Tried with OpenJPA and EclipseLink, both
> worked without a glitch. So the bug was in ActiveMQ-5.5.1.
>
> --
> Björn Danielsson
> Cuspy Code AB
>
>
> AndyG  wrote:
> > These are the required activemq jars:
> >
> > openejb\lib\activeio-core-3.2-20090713.104929-1.jar
> > openejb\lib\activemq-core-5.6-SNAPSHOT.jar
> > openejb\lib\activemq-protobuf-1.1.jar
> > openejb\lib\activemq-ra-5.6-SNAPSHOT.jar
> > openejb\lib\kahadb-5.6-SNAPSHOT.jar
> >
> >
> > --
> > View this message in context:
> http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4564896.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Bjorn Danielsson
Problem solved!

Thanks AndyG, this did the trick. I compiled a fresh ActiveMQ
snapshot (r1327126) and replaced the files from your list, and
now everything works. Tried with OpenJPA and EclipseLink, both
worked without a glitch. So the bug was in ActiveMQ-5.5.1.

-- 
Björn Danielsson
Cuspy Code AB


AndyG  wrote:
> These are the required activemq jars:
>
> openejb\lib\activeio-core-3.2-20090713.104929-1.jar
> openejb\lib\activemq-core-5.6-SNAPSHOT.jar
> openejb\lib\activemq-protobuf-1.1.jar
> openejb\lib\activemq-ra-5.6-SNAPSHOT.jar
> openejb\lib\kahadb-5.6-SNAPSHOT.jar
>
>
> --
> View this message in context: 
> http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4564896.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Romain Manni-Bucau
was more about the integration with openejb. I remember we had some API
changes mounths ago.

- Romain


2012/4/17 AndyG 

>
> Romain Manni-Bucau wrote
> >
> > i think pulling activemq-ra should be enough with maven to override the
> > version.
> >
> > @Andy: did you try?
> >
>
> I pull, build and deploy activemq daily snapshot to my local repo, but:
>
> 5.6-SNAPSHOT
>
> ...will do the trick.
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4565102.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread AndyG

Romain Manni-Bucau wrote
> 
> i think pulling activemq-ra should be enough with maven to override the
> version.
> 
> @Andy: did you try?
> 

I pull, build and deploy activemq daily snapshot to my local repo, but:

5.6-SNAPSHOT

...will do the trick.


--
View this message in context: 
http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4565102.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread AndyG

Bjorn Danielsson wrote
> The EJB then sends out a notification to a JMS topic
> 

How is this EJB sending the message?

javax.jms.JMSException: The resource is already being used in transaction
context. - Means exactly that, and it is usually a good sign that there is
some misuse or a concurrency issue at the root.

Access to a shared JMS resource is crossing a transaction/thread boundary
and this will only happen if two or more threads are concurrently accessing
the resource. 

Never share a JMS Connection/topic or queue across different threads,
putting them in a Singleton is always a good idea as this allows you to keep
the connection open for the application lifetime. Here is a really dumbed
down example:

@Singleton
SomeClass

private Connection conJms = null;

@Resource(mappedName = "JMSConnectionFactory")
private ConnectionFactory connectionFactory;

@Override
public void sendMessage(final String messge) {
if(null == this.conJms){
this.conJms = getConnectionFactory().createConnection();
//Do some JMS magic, open a queue and or topic etc etc
}

//Send the message here
}

@PreDestroy
public void preDestroy() {
//Cleanup and close this.conJms and any queues and topics etc...
}

Any EJB that wants to send a message must then inject the 'SomeClass'
instance:

@EJB
private SomeClass sc;

this.sc.sendMessage("Hello Tom, Dick and Harry");


--
View this message in context: 
http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4565058.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Romain Manni-Bucau
i think pulling activemq-ra should be enough with maven to override the
version.

@Andy: did you try?

- Romain


2012/4/17 AndyG 

> These are the required activemq jars:
>
> openejb\lib\activeio-core-3.2-20090713.104929-1.jar
> openejb\lib\activemq-core-5.6-SNAPSHOT.jar
> openejb\lib\activemq-protobuf-1.1.jar
> openejb\lib\activemq-ra-5.6-SNAPSHOT.jar
> openejb\lib\kahadb-5.6-SNAPSHOT.jar
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4564896.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread AndyG
These are the required activemq jars:

openejb\lib\activeio-core-3.2-20090713.104929-1.jar
openejb\lib\activemq-core-5.6-SNAPSHOT.jar
openejb\lib\activemq-protobuf-1.1.jar
openejb\lib\activemq-ra-5.6-SNAPSHOT.jar
openejb\lib\kahadb-5.6-SNAPSHOT.jar


--
View this message in context: 
http://openejb.979440.n4.nabble.com/How-do-I-send-JMS-messages-from-an-MDB-tp4561773p4564896.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: A resource deployed with an application does not get cleared from naming during undeploy

2012-04-17 Thread Romain Manni-Bucau
i'm currently implementing it ;)

well, sharing resources accross applications can be a nightmare but
sometimes it is what you want. To manage such a case we'll have to find a
configuration trick. Probably a system property or property to prevent the
undeployment.

- Romain


2012/4/17 lazarkirchev 

> OK, thanks a lot!
> But since the resource deployed through the resources.xml is intended to be
> container-wide available (and not only locally for an application), then is
> it possible that undeploying the resource with the app will break other
> application which also uses it (if there is such app)? Or such a scenario
> is
> unacceptable? Probably that is the reason why currently undeploying the
> resource with the app is not implemented?
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564799.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: A resource deployed with an application does not get cleared from naming during undeploy

2012-04-17 Thread lazarkirchev
OK, thanks a lot! 
But since the resource deployed through the resources.xml is intended to be
container-wide available (and not only locally for an application), then is
it possible that undeploying the resource with the app will break other
application which also uses it (if there is such app)? Or such a scenario is
unacceptable? Probably that is the reason why currently undeploying the
resource with the app is not implemented?

Lazar

--
View this message in context: 
http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564799.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Romain Manni-Bucau
Hi,

i think activemq-ra should be updated too. I don't know if there is API
changes between both version but i guess you'll see it soon ;).

- Romain


2012/4/17 Bjorn Danielsson 

> Update
>
> I can now reproduce the error in a small test program.
> All I did was increase the messaging from 2 to 4 messages
> and fiddle a bit with the JPA code. The fiddling required
> seems to be different depending on whether I use OpenJPA
> or EclipseLink.
>
> I am beginning to suspect that I might be bitten by this
> bug, fixed in ActiveMQ 5.6.0:
>
> https://issues.apache.org/jira/browse/AMQ-3465
>
> Now I am itching to try a newer ActiveMQ than the bundled one.
> Is this possible? I naively tried replacing the activemq-core
> jar but that just gave me "peer did not send his wire format".
>
> --
> Björn Danielsson
> Cuspy Code AB
>


Re: How do I *send* JMS messages from an MDB?

2012-04-17 Thread Bjorn Danielsson
Update

I can now reproduce the error in a small test program.
All I did was increase the messaging from 2 to 4 messages
and fiddle a bit with the JPA code. The fiddling required
seems to be different depending on whether I use OpenJPA
or EclipseLink.

I am beginning to suspect that I might be bitten by this
bug, fixed in ActiveMQ 5.6.0:

https://issues.apache.org/jira/browse/AMQ-3465

Now I am itching to try a newer ActiveMQ than the bundled one.
Is this possible? I naively tried replacing the activemq-core
jar but that just gave me "peer did not send his wire format".

-- 
Björn Danielsson
Cuspy Code AB


Re: A resource deployed with an application does not get cleared from naming during undeploy

2012-04-17 Thread Romain Manni-Bucau
Hi,

resources.xml or openejb.xml or tomee.xml does the same thing. The
difference is the moment when it is done and the classloader used.

- Romain


2012/4/17 lazarkirchev 

> Hi, one more detail here - what is actually the intention of resources.xml?
> Does it make the container create the actual physical resources for the
> resources described in the xml? Or, does it make the container create
> references in the application for the resources specified in the xml file?
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564680.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: A resource deployed with an application does not get cleared from naming during undeploy

2012-04-17 Thread lazarkirchev
Hi, one more detail here - what is actually the intention of resources.xml?
Does it make the container create the actual physical resources for the
resources described in the xml? Or, does it make the container create
references in the application for the resources specified in the xml file? 

Lazar

--
View this message in context: 
http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564680.html
Sent from the OpenEJB User mailing list archive at Nabble.com.