You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Steffen Ewert <St...@gmx.de> on 2007/12/12 14:51:00 UTC

Re: ActiveMQ and EJB3 - tested with JBoss

Thanks Daniel!

I think my problem is the missing @ResourceAdapter annotation. But, do you
know in which jar I can find the org.jboss.annotation.ejb.ResourceAdapter
annotation? I work on JBoss 4.2.2GA and i can't find the package
"org.jboss.annotation" anywhere ... :-( Must I install a additionaly JBoss
package? Or where else can I find the annotation?

Many thanks,
Steffen



Daniel Pocock wrote:
> 
> 
> 
> I've seen numerous postings regarding ActiveMQ with EJB3, and variations 
> of a datasource XML file for use with JBoss integration.
> 
> However, they don't quite work.  Here is what worked for me, it is 
> actually quite simple:
> 
> 1. Don't use any datasource file - only the RA file is required.  Put it 
> in the `deploy' directory.  The file is called activemq-rar-4.1.1.rar 
> and it is in the ActiveMQ distribution (lib/optional/)
> 
> 2. In JBoss, the @ResourceAdapter annotation must be placed on the 
> Message Driven Bean (MDB).  This may vary for other application servers.
> 
> 3. Examples I've seen elsewhere show an activationConfig with 
> destination= .  This doesn't work.  Put the 
> ActiveMQ destination name in the activationConfig.  There is no need to 
> put the queue in the JNDI.
> 
> Here is a working example - for EJB3 on JBoss, no XML descriptors are 
> needed, just the RA file and the MDB.
> 
> import org.jboss.annotation.ejb.ResourceAdapter;
> @MessageDriven(activationConfig =
>         {
>               @ActivationConfigProperty(propertyName="destinationType", 
> propertyValue="javax.jms.Queue"),
>               @ActivationConfigProperty(propertyName="destination", 
> propertyValue="FOO.TEST"),
>               @ActivationConfigProperty(propertyName="acknowledgeMode", 
> propertyValue="Auto-acknowledge")
>         })
> @ResourceAdapter("activemq-rar-4.1.1.rar")
> public class TestBean implements MessageListener {
> 
>   public TestBean() {
>   }
> 
>   public void onMessage(Message message) {
>   }
> 
> }
> 
> -- 
> 
> 
> -----------------------------------------------------------------------
> Ready Technology Limited
> Incorporated in England and Wales, 4940731
> Registered office: Devonshire House, 60 Goswell Rd, London, EC1M 7AD
> -----------------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-and-EJB3---tested-with-JBoss-tp13933989s2354p14295504.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ and EJB3 - tested with JBoss

Posted by Daniel Pocock <da...@readytechnology.co.uk>.



Steffen Ewert wrote:
> Thanks Daniel!
>
> I think my problem is the missing @ResourceAdapter annotation. But, do you
> know in which jar I can find the org.jboss.annotation.ejb.ResourceAdapter
> annotation? I work on JBoss 4.2.2GA and i can't find the package
> "org.jboss.annotation" anywhere ... :-( Must I install a additionaly JBoss
> package? Or where else can I find the annotation?
>
>   
I used 4.2.1.GA

This is the classpath from my build.xml:

  <path id="j2ee.classpath">
    <fileset dir="${j2ee.dir}">
      <include name="lib/**.jar"/>
      <include name="server/${j2ee.jboss.config}/lib/**.jar"/>
      <include 
name="server/${j2ee.jboss.config}/deploy/ejb3.deployer/**.jar"/>
    </fileset>
  </path>



> Many thanks,
> Steffen
>
>
>
> Daniel Pocock wrote:
>   
>>
>> I've seen numerous postings regarding ActiveMQ with EJB3, and variations 
>> of a datasource XML file for use with JBoss integration.
>>
>> However, they don't quite work.  Here is what worked for me, it is 
>> actually quite simple:
>>
>> 1. Don't use any datasource file - only the RA file is required.  Put it 
>> in the `deploy' directory.  The file is called activemq-rar-4.1.1.rar 
>> and it is in the ActiveMQ distribution (lib/optional/)
>>
>> 2. In JBoss, the @ResourceAdapter annotation must be placed on the 
>> Message Driven Bean (MDB).  This may vary for other application servers.
>>
>> 3. Examples I've seen elsewhere show an activationConfig with 
>> destination= .  This doesn't work.  Put the 
>> ActiveMQ destination name in the activationConfig.  There is no need to 
>> put the queue in the JNDI.
>>
>> Here is a working example - for EJB3 on JBoss, no XML descriptors are 
>> needed, just the RA file and the MDB.
>>
>> import org.jboss.annotation.ejb.ResourceAdapter;
>> @MessageDriven(activationConfig =
>>         {
>>               @ActivationConfigProperty(propertyName="destinationType", 
>> propertyValue="javax.jms.Queue"),
>>               @ActivationConfigProperty(propertyName="destination", 
>> propertyValue="FOO.TEST"),
>>               @ActivationConfigProperty(propertyName="acknowledgeMode", 
>> propertyValue="Auto-acknowledge")
>>         })
>> @ResourceAdapter("activemq-rar-4.1.1.rar")
>> public class TestBean implements MessageListener {
>>
>>   public TestBean() {
>>   }
>>
>>   public void onMessage(Message message) {
>>   }
>>
>> }
>>
>> -- 
>>
>>
>> -----------------------------------------------------------------------
>> Ready Technology Limited
>> Incorporated in England and Wales, 4940731
>> Registered office: Devonshire House, 60 Goswell Rd, London, EC1M 7AD
>> -----------------------------------------------------------------------
>>
>>
>>
>>     
>
>   

-- 


-----------------------------------------------------------------------
Ready Technology Limited
Incorporated in England and Wales, 4940731
Registered office: Devonshire House, 60 Goswell Rd, London, EC1M 7AD
-----------------------------------------------------------------------


Re: ActiveMQ and EJB3 - tested with JBoss

Posted by Olivier Thomas <op...@gmail.com>.
Hello, 
I have the same problem: Using JBoss 4.2.2 + ActiveMQ 4.1.1.
I follow these steps: 
+ I create a slim context based on the copy of the default context ->
./bin/run.sh -c slim  ok
+ Then i remove jms (JBossMQ) from the deploy directory to be sure to not
use it -> ok
+ Then i copy the ActiveMQ activemq-rar-4.1.1.rar into deploy directory ->
ok
+ Then create a EJB3 MDB to talk with ActiveMQ: But i can't find the
org.jboss.annotation.ejb.ResourceAdapter in any jar.

Normally it should be include into jboss-annotations-ejb3.jar, but i can't
find this one into JBoss AS 4.2.2 libs look at this:
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/)

So i use the following annotations (resourceAdaptorName):
@MessageDriven(activationConfig={

@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),
 @ActivationConfigProperty(propertyName="destination",
propertyValue="FOO.TEST"),
 @ActivationConfigProperty(propertyName="acknowledgeMode",
propertyValue="Auto-acknowledge"),
 @ActivationConfigProperty(propertyName="resourceAdaptorName",
propertyValue="activemq-rar-4.1.1.rar"),
})
@Name("logger")
public class LoggerBean implements MessageListener {
 @Logger Log log;
 public void onMessage(Message msg){
   try { ChatroomEvent event = (ChatroomEvent) ((ObjectMessage)
msg).getObject();
	  log.info( "#0: #1", event.getUser(), event.getData()==null ?
event.getAction() : event.getData() );
   } catch (JMSException jmse){ throw new RuntimeException(jmse);}
 }
}
Then reload my app and now  i've got these errors:
2007-12-12 WARN  [org.jboss.ejb3.mdb.MessagingContainer] Could not find the
queue destination-jndi-name=FOO.TEST
2007-12-12 WARN  [org.jboss.ejb3.mdb.MessagingContainer] destination not
found: queue/FOO.TEST reason: javax.naming.NameNotFoundException:
queue/FOO.TEST
But that's OK with that error : The queue doesn't exists in ActiveMQ and i'm
wondering perhaps there is a problem with remote temporary queues  creation
with JBoss ?

The next one is much more difficult to solve :(
2007-12-12 WARN  [org.jboss.ejb3.mdb.MessagingContainer] creating a new
temporary destination: queue/FOO.TEST
2007-12-12 WARN  [org.jboss.system.ServiceController] Problem starting
service
jboss.j2ee:ear=mytest.ear,jar=mytest.jar,name=LoggerBean,service=EJB3
javax.management.InstanceNotFoundException:
jboss.mq:service=DestinationManager is not registered.
        at
org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:523)

Please can u help me to solve this issue? 
Olivier T.





Steffen Ewert wrote:
> 
> Thanks Daniel!
> 
> I think my problem is the missing @ResourceAdapter annotation. But, do you
> know in which jar I can find the org.jboss.annotation.ejb.ResourceAdapter
> annotation? I work on JBoss 4.2.2GA and i can't find the package
> "org.jboss.annotation" anywhere ... :-( Must I install a additionaly JBoss
> package? Or where else can I find the annotation?
> 
> Many thanks,
> Steffen
> 
> 
> 
> Daniel Pocock wrote:
>> 
>> 
>> 
>> I've seen numerous postings regarding ActiveMQ with EJB3, and variations 
>> of a datasource XML file for use with JBoss integration.
>> 
>> However, they don't quite work.  Here is what worked for me, it is 
>> actually quite simple:
>> 
>> 1. Don't use any datasource file - only the RA file is required.  Put it 
>> in the `deploy' directory.  The file is called activemq-rar-4.1.1.rar 
>> and it is in the ActiveMQ distribution (lib/optional/)
>> 
>> 2. In JBoss, the @ResourceAdapter annotation must be placed on the 
>> Message Driven Bean (MDB).  This may vary for other application servers.
>> 
>> 3. Examples I've seen elsewhere show an activationConfig with 
>> destination= .  This doesn't work.  Put the 
>> ActiveMQ destination name in the activationConfig.  There is no need to 
>> put the queue in the JNDI.
>> 
>> Here is a working example - for EJB3 on JBoss, no XML descriptors are 
>> needed, just the RA file and the MDB.
>> 
>> import org.jboss.annotation.ejb.ResourceAdapter;
>> @MessageDriven(activationConfig =
>>         {
>>               @ActivationConfigProperty(propertyName="destinationType", 
>> propertyValue="javax.jms.Queue"),
>>               @ActivationConfigProperty(propertyName="destination", 
>> propertyValue="FOO.TEST"),
>>               @ActivationConfigProperty(propertyName="acknowledgeMode", 
>> propertyValue="Auto-acknowledge")
>>         })
>> @ResourceAdapter("activemq-rar-4.1.1.rar")
>> public class TestBean implements MessageListener {
>> 
>>   public TestBean() {
>>   }
>> 
>>   public void onMessage(Message message) {
>>   }
>> 
>> }
>> 
>> -- 
>> 
>> 
>> -----------------------------------------------------------------------
>> Ready Technology Limited
>> Incorporated in England and Wales, 4940731
>> Registered office: Devonshire House, 60 Goswell Rd, London, EC1M 7AD
>> -----------------------------------------------------------------------
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-and-EJB3---tested-with-JBoss-tp13933989s2354p14296939.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.