Hi I trying to make work an simple example about EJB with Jboss througth jms.
I have debug it and it works from the index to the servlet where it call the messages producer, also I have configured the .xml in jBoss.
But the message which is send is not receive in mdb. I show all the code below:
Producer(works fine)
-------------------------
public class Producer { public void producerMessages(){ try { InitialContext ctx = new InitialContext(); ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory"); Connection connection = connectionFactory.createConnection(); Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); Destination destination = (Destination) ctx.lookup("queue/MyQueue"); MessageProducer messageProducer = session.createProducer(destination); TextMessage message = session.createTextMessage("hello JMS"); messageProducer.send(message); messageProducer.close(); session.close(); connection.close(); } catch (NamingException ex) { } catch (JMSException je) { } } }
MDB (it doesn´t catch the message)
------------------------------------------
@MessageDriven(mappedName = "jms/ReceiveMessasge",
activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/myQueue")
})
public class ReceiveMessasge implements MessageListener { /** * Default constructor. */ public ReceiveMessasge() { // TODO Auto-generated constructor stub } /** * @see MessageListener#onMessage(Message) */ public void onMessage(Message message) { System.out.println("Receive" + message); } }
connection-factories-service
---------------------------------
destinations-serviceHTML Code:<?xml version="1.0" encoding="UTF-8"?> <!-- Messaging Connection Factories deployment descriptor. $Id: connection-factories-service.xml 3332 2007-11-15 09:32:43Z timfox $ --> <server> <!-- The default connection factory does not support automatic failover or load balancing- this is so we can maintain compatiblity with applications written for JBoss MQ which use this connection factory. --> <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=ConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="JNDIBindings"> <bindings> <binding>/ConnectionFactory</binding> <binding>/XAConnectionFactory</binding> <binding>java:/ConnectionFactory</binding> <binding>java:/XAConnectionFactory</binding> </bindings> </attribute> </mbean> <!-- A clustered connection factory that supports automatic failover and load balancing of created connections. This factory is not suitable to be used by MDBs. --> <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="JNDIBindings"> <bindings> <binding>/ClusteredConnectionFactory</binding> <binding>/ClusteredXAConnectionFactory</binding> <binding>java:/ClusteredConnectionFactory</binding> <binding>java:/ClusteredXAConnectionFactory</binding> </bindings> </attribute> <attribute name="SupportsFailover">true</attribute> <attribute name="SupportsLoadBalancing">true</attribute> </mbean> <!-- A connection factory with no JNDI bindings that is used in clustering to create the connections that pull messages from one node to another --> <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="SupportsFailover">false</attribute> <attribute name="SupportsLoadBalancing">false</attribute> </mbean> <!-- An example connection factory with all attributes shown <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=ConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <constructor> <!- - You can specify the default Client ID to use for connections created using this factory - -> <arg type="java.lang.String" value="MyClientID"/> </constructor> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <!- - The transport to use - can be bisocket, sslbisocket or http - -> <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends> <depends>jboss.messaging:service=PostOffice</depends> <!- - PrefetchSize determines the approximate maximum number of messages the client consumer will buffer locally - -> <attribute name="PrefetchSize">150</attribute> <!- - Paging params to be used for temporary queues - -> <attribute name="DefaultTempQueueFullSize">200000</attribute> <attribute name="DefaultTempQueuePageSizeSize">2000</attribute> <attribute name="DefaultTempQueueDownCacheSize">2000</attribute> <!- - The batch size to use when using the DUPS_OK_ACKNOWLEDGE acknowledgement mode - -> <attribute name="DupsOKBatchSize">5000</attribute> <!- - Does this connection factory support automatic failover? - -> <attribute name="SupportsFailover">false</attribute> <!- - Does this connection factory support automatic client side load balancing? - -> <attribute name="SupportsLoadBalancing">false</attribute> <!- - The class name of the factory used to create the load balancing policy to use on the client side - -> <attribute name="LoadBalancingFactory">org.jboss.jms.client.plugin.RoundRobinLoadBalancingFactory</attribute> <!- - Whether we should be strict TCK compliant, i.e. how we deal with foreign messages, defaults to false- -> <attribute name="StrictTck">true</attribute> <!- - Should acknowledgements be sent asynchronously? - -> <attribute name="SendAcksAsync">false</attribute> <!- - Disable JBoss Remoting Connector sanity checks - There is rarely a good reason to set this to true - -> <attribute name="DisableRemotingChecks">false</attribute> <!- - The connection factory will be bound in the following places in JNDI - -> <attribute name="JNDIBindings"> <bindings> <binding>/acme/ConnectionFactory</binding> <binding>/acme/ConnectionFactoryDupe</binding> <binding>java:/xyz/CF1</binding> <binding>java:/connectionfactories/acme/connection_factory</binding> </bindings> </attribute> </mbean> --> </server>
------------------------
¿Could anybody gime advice about what is wrong?HTML Code:<?xml version="1.0" encoding="UTF-8"?> <!-- Messaging Destinations deployment descriptor. $Id: destinations-service.xml 81998 2008-12-03 06:46:29Z [email]scott.stark@jboss.org[/email] $ --> <server> <!-- The Default Dead Letter Queue. This destination is a dependency of an EJB MDB container. --> <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=DLQ" xmbean-dd="xmdesc/Queue-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> </mbean> <!-- MyQueue. --> <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=MyQueue" xmbean-dd="xmdesc/Queue-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> </mbean> </server>
Thanks


LinkBack URL
About LinkBacks
Reply With Quote