You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Johnny Guo <qi...@consultant.volvo.com> on 2012/04/11 08:53:00 UTC

MDB not invoked

Hi,

I'm new to openejb. Now i'm working with openejb integrated with Tomcat in
Eclipse. Openejb can start successfully. One MDB was setup to listen to a
jms queue and the start log like this:
[INFO] Found ejb module EjbModule in war /newjena
[INFO] Found ejb module EjbModule in war /newjena
[INFO] Configuring enterprise application:
C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
[INFO] Auto-linking resource-ref
'jms/tdm-newjena/ReportStandardJMSConnFactory' in bean StandardReportsBean
to Resource(id=jms/tdm-newjena/ReportStandardJMSConnFactory)
[INFO] Auto-linking resource-ref 'jms/tdm-newjena/ReportStandardJMSQueue' in
bean StandardReportsBean to
Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
[INFO] Configuring Service(id=jms/tdm-newjena/ReportStandardJMSQueue,
type=Resource, provider-id=Default Queue)
[INFO] Auto-creating a Resource with id
'jms/tdm-newjena/ReportStandardJMSQueue' of type 'javax.jms.Queue for
'StandardReportsBean'.
[INFO] Creating Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
[INFO] Enterprise application
"C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena"
loaded.
[INFO] Assembling app:
C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
[INFO] Jndi(name=StandardReportsBean) -->
Ejb(deployment-id=StandardReportsBean)
[INFO] Created Ejb(deployment-id=StandardReportsBean,
ejb-name=StandardReportsBean, container=My MDB Container)

But when the message is sent to the queue, the MDB can not be invoked.  What
is the problem and how can i get more detail information if something like
this happens?
Thanks

--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548110.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi,

I was using Tomcat instead of Tomee.  And for the QCF and Queues, the resources were placed in Sever.xml and resource-link in context.xml. Both files are common Tomcat configuration files and the configuration was standard activeMQ configuration which can be found on its website.


From: Gobi Selvaraj [via OpenEJB] [mailto:ml-node+s979440n4668190h54@n4.nabble.com]
Sent: 2014年3月13日 11:23 下午
To: Guo Qiang (Consultant)
Subject: RE: MDB not invoked

Hi,
 Can you explain how and where did you configure the QCF and Queues and Listener ports in the Tomee server?


________________________________
If you reply to this email, your message will be added to the discussion below:
http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4668190.html
To unsubscribe from MDB not invoked, click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4548110&code=cWlhbmcuZ3VvQGNvbnN1bHRhbnQudm9sdm8uY29tfDQ1NDgxMTB8LTQ0OTE1ODIzNQ==>.
NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4668199.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by Gobi Selvaraj <go...@gmail.com>.
Hi,
 Can you explain how and where did you configure the QCF and Queues and
Listener ports in the Tomee server?





--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4668190.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by "vortex.alex" <co...@gmail.com>.
I resolved!

My MDB remains same as above (minus the mappedName attribute)


the CLIENT
-------------
public class MDBTest extends TestCase {

	@Resource
	private ConnectionFactory connectionFactory;
	  
	@Resource(name = "queGMS_FlightBoard")
	private Queue queue;
	  
	  
	  
	  
	@Before
	protected void setUp() throws Exception {
			Properties props = new Properties();
			props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.core.LocalInitialContextFactory");
			EJBContainer.createEJBContainer(props).getContext().bind("inject", this);
	}
	  
	  
	@Test
	public void testMessage() throws Exception  {
		
			Connection connection = connectionFactory.createConnection();
			connection.start();
			final  Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
			final MessageProducer producer = session.createProducer(queue);
			producer.send(session.createTextMessage("XXXXXXXX"));
			Thread.sleep(10000);
		
	}
	
	
}






The only thing I have understood is that after producer sends message, if I
don't have any other line of code which in some way may be seen as a "wait",
the main thread dies..... preventing MDB to receive the message...



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663877.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by "vortex.alex" <co...@gmail.com>.
My doubt is:

do I have to run the test within a single Thread?

or I have to first start the container and then run the client test within
another thread?







--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663874.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by "vortex.alex" <co...@gmail.com>.
Hi,
I'll give a try with your code,
but did you declare connectionfactory and queue in openejb.xml or other
configuration places?

However,
maybe you have experimented a lot before obtaining your solution (also I
think that creating the message listener with "new" construct it's not an
elegant way).

instead I  just wanted to run the official samples, like

http://tomee.apache.org/examples-trunk/simple-mdb-with-descriptor/
<http://tomee.apache.org/examples-trunk/simple-mdb-with-descriptor/>  


Thanks for your help







--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663873.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi, my problem was because I didn’t  load the connection factory and connect the queue with message listener.  So you can try to add this in some listener to load it when you start the application.

            initCtx = new InitialContext();
            Context envContext = (Context) initCtx.lookup("java:comp/env");
            ConnectionFactory standardReport_cf = (ConnectionFactory) envContext.lookup("jms/ReportStandardJMSConnFactory");
            Connection standardReport_con = standardReport_cf.createConnection();
            Session standardReport_session = standardReport_con.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Queue standardReportQueue = (Queue) envContext.lookup("jms/ReportStandardJMSQueue");
            standardReport_session.createConsumer(standardReportQueue);
            standardReport_session.setMessageListener(new StandardReportsBean());
            standardReport_con.start();

From: vortex.alex [via OpenEJB] [mailto:ml-node+s979440n4663851h45@n4.nabble.com]
Sent: 2013年6月18日 8:53 下午
To: Guo Qiang (Consultant)
Subject: Re: MDB not invoked

Code is very simple....


MDB
------

@MessageDriven(
        mappedName = "ejb/FBMGMSListener",
        activationConfig = {
        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
            @ActivationConfigProperty(propertyName="destination", propertyValue="queGMS_FlightBoard"),
            @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
        }

)
public class QueueMessagesListener implements MessageListener {

        //log4j
        private static final Logger logger = Logger.getLogger(QueueMessagesListener.class);

        @Override
        public void onMessage(Message message) {
                logger.info("onMessage() - message received");
        }
}



CLIENT
----------------
public abstract class FlightBoardBaseTest extends TestCase {

        protected Context ctx = null;


        @Before
        protected void setUp() throws Exception {
                Properties props = new Properties();
                props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");


                props.put("MyJmsResourceAdapter", "new://Resource?type=ActiveMQResourceAdapter");
                props.put("MyJmsResourceAdapter.BrokerXmlConfig", "broker:(tcp://localhost:61616)");
                props.put("MyJmsResourceAdapter.ServerUrl", "tcp://localhost:61616");
                props.put("MyJmsConnectionFactory", "new://Resource?type=javax.jms.ConnectionFactory");
                props.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");
                props.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
                props.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
                props.put("queGMS_FlightBoard", "new://Resource?type=javax.jms.Queue");

                //EJBContainer container = EJBContainer.createEJBContainer(props);
                //ctx = container.getContext();
                ctx = new InitialContext(props);


        }
}



public class MDBTest extends FlightBoardBaseTest {

        @Test
        public void testMessage() throws Exception  {

                        Object obj1 = ctx.lookup("openejb:Resource/MyJmsConnectionFactory");
                        ConnectionFactory conn = (ConnectionFactory)obj1;
                        Connection connection = conn.createConnection();
                        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                        Object obj2 = ctx.lookup("openejb:Resource/queGMS_FlightBoard");
                        Queue queue = (Queue)obj2;
                        MessageProducer producer = session.createProducer(queue);

                        TextMessage message = session.createTextMessage("my test is going to fail");
                        producer.send(queue, message);

        }
}



MAVEN POM.XML FOR OPENEJB DEPENDENCY (errata corrige: version is it's 4.5.2)
---------
<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>

<dependency>
        <groupId>org.apache.openejb</groupId>
        <artifactId>openejb-core</artifactId>
        <version>4.5.2</version>
        <scope>test</scope>
</dependency>


I have no ejb-jar.xml and no other config files (openejb.xml etc)


________________________________
If you reply to this email, your message will be added to the discussion below:
http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663851.html
To unsubscribe from MDB not invoked, click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4548110&code=cWlhbmcuZ3VvQGNvbnN1bHRhbnQudm9sdm8uY29tfDQ1NDgxMTB8LTQ0OTE1ODIzNQ==>.
NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663868.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB not invoked

Posted by "vortex.alex" <co...@gmail.com>.
Code is very simple....


MDB
------

@MessageDriven(
        mappedName = "ejb/FBMGMSListener",
        activationConfig = {
        	@ActivationConfigProperty(propertyName="destinationType",
propertyValue="javax.jms.Queue"),
            @ActivationConfigProperty(propertyName="destination",
propertyValue="queGMS_FlightBoard"),
            @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge")
        }
  
)
public class QueueMessagesListener implements MessageListener {

        //log4j
	private static final Logger logger =
Logger.getLogger(QueueMessagesListener.class);
	
	@Override
	public void onMessage(Message message) {
		logger.info("onMessage() - message received");
        }
}



CLIENT
----------------
public abstract class FlightBoardBaseTest extends TestCase {

        protected Context ctx = null;


        @Before
	protected void setUp() throws Exception {
		Properties props = new Properties();
		props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
		
		
		props.put("MyJmsResourceAdapter",
"new://Resource?type=ActiveMQResourceAdapter");
		props.put("MyJmsResourceAdapter.BrokerXmlConfig",
"broker:(tcp://localhost:61616)");
	        props.put("MyJmsResourceAdapter.ServerUrl",
"tcp://localhost:61616");
		props.put("MyJmsConnectionFactory",
"new://Resource?type=javax.jms.ConnectionFactory");
		props.put("MyJmsConnectionFactory.ResourceAdapter",
"MyJmsResourceAdapter");
		props.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
		props.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
		props.put("queGMS_FlightBoard", "new://Resource?type=javax.jms.Queue");
		
		//EJBContainer container = EJBContainer.createEJBContainer(props);
		//ctx = container.getContext();
		ctx = new InitialContext(props);
		

	}
}



public class MDBTest extends FlightBoardBaseTest {

	@Test
	public void testMessage() throws Exception  {
	
			Object obj1 = ctx.lookup("openejb:Resource/MyJmsConnectionFactory");
			ConnectionFactory conn = (ConnectionFactory)obj1;
			Connection connection = conn.createConnection();
			Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
			
			Object obj2 = ctx.lookup("openejb:Resource/queGMS_FlightBoard");
			Queue queue = (Queue)obj2;
			MessageProducer producer = session.createProducer(queue);
			
			TextMessage message = session.createTextMessage("my test is going to
fail");
			producer.send(queue, message);
	
	}
}



MAVEN POM.XML FOR OPENEJB DEPENDENCY (errata corrige: version is it's 4.5.2)
---------
<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>

<dependency>
	<groupId>org.apache.openejb</groupId>
	<artifactId>openejb-core</artifactId>
	<version>4.5.2</version>
	<scope>test</scope>
</dependency>


I have no ejb-jar.xml and no other config files (openejb.xml etc)





--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663851.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB not invoked

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

is your sample shareable or close to it? would be easier to test

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/6/18 vortex.alex <co...@gmail.com>

> Hi,
> i've the same problem.
>
>
> My environment
> --------------------
> OpenEJB 4.5.1.
> 1 MDB
> 1 Client
>
>
>
> RELEVANT PART OF MDB
> --------------------------------
> @MessageDriven(
>         mappedName = "ejb/FBMGMSListener",
>         description = "Listener for GMS queue messages."
>         ,
>         activationConfig = {
>                 @ActivationConfigProperty(propertyName="destinationType",
> propertyValue="javax.jms.Queue"),
>             @ActivationConfigProperty(propertyName="destination",
> propertyValue="queGMS_FlightBoard"),
>
>
>
>
> RELEVANT PART OF CLIENT
> ----------------------------------------
> Properties props = new Properties();
> props.put("MyJmsResourceAdapter",
> "new://Resource?type=ActiveMQResourceAdapter");
> props.put("MyJmsResourceAdapter.BrokerXmlConfig",
> "broker:(tcp://localhost:61616)");
> props.put("MyJmsResourceAdapter.ServerUrl", "tcp://localhost:61616");
> props.put("MyJmsConnectionFactory",
> "new://Resource?type=javax.jms.ConnectionFactory");
> props.put("MyJmsConnectionFactory.ResourceAdapter",
> "MyJmsResourceAdapter");
> props.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
> props.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
> props.put("queGMS_FlightBoard", "new://Resource?type=javax.jms.Queue");
> Context ctx = new InitialContext(props);
>
> ......
>
> Object obj1 = ctx.lookup("openejb:Resource/MyJmsConnectionFactory");
> ConnectionFactory conn = (ConnectionFactory)obj1;
> Connection connection = conn.createConnection();
> Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>
> Object obj2 = ctx.lookup("openejb:Resource/queGMS_FlightBoard");
> Queue queue = (Queue)obj2;
> MessageProducer producer = session.createProducer(queue);
> TextMessage message = ....
> producer.send(queue, message);
>
>
> RELEVANT PART OF LOGS
> ---------------------------------------------
> INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
> INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt
> to create one for the beans deployed.
> INFO - Configuring Service(id=Default Security Service,
> type=SecurityService, provider-id=Default Security Service)
> INFO - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> INFO - Configuring Service(id=queGMS_FlightBoard, type=Resource,
> provider-id=Default Queue)
> INFO - Configuring Service(id=MyJmsResourceAdapter, type=Resource,
> provider-id=Default JMS Resource Adapter)
> INFO - Configuring Service(id=fbm_ds, type=Resource, provider-id=Default
> JDBC Database)
> INFO - Configuring Service(id=MyJmsConnectionFactory, type=Resource,
> provider-id=Default JMS Connection Factory)
> INFO - Configuring Service(id=MyJmsMdbContainer, type=Container,
> provider-id=Default MDB Container)
> INFO - Creating TransactionManager(id=Default Transaction Manager)
> INFO - Creating SecurityService(id=Default Security Service)
> INFO - Creating Resource(id=MyJmsResourceAdapter)
> INFO - ActiveMQ5Factory creating broker
> INFO - Using ActiveMQ startup timeout of 10000ms
> INFO - Starting ActiveMQ BrokerService
> INFO - Using Persistence Adapter: MemoryPersistenceAdapter
> INFO - JMX consoles can connect to
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
> INFO - Apache ActiveMQ 5.7.0 (localhost,
> ID:PC-COSENZA-36269-1371556220257-0:1) is starting
> INFO - Listening for connections at: tcp://127.0.0.1:61616
> INFO - Connector tcp://127.0.0.1:61616 Started
> INFO - Apache ActiveMQ 5.7.0 (localhost,
> ID:PC-COSENZA-36269-1371556220257-0:1) started
> INFO - For help or more information please see: http://activemq.apache.org
> INFO - Starting ActiveMQ checkpoint
> INFO - ActiveMQ broker started
> INFO - Creating Resource(id=fbm_ds)
> INFO - Creating Resource(id=queGMS_FlightBoard)
> INFO - Creating Resource(id=MyJmsConnectionFactory)
> INFO - Creating ConnectionManager for Resource(id=MyJmsConnectionFactory)
> INFO - No runtime TransactionSupport
> INFO - Creating Container(id=MyJmsMdbContainer)
> AVVERTENZA - Inspecting classpath for applications: 70 urls.
> AVVERTENZA - ADJUST THE EXCLUDE/INCLUDE!!!.  Current settings:
> openejb.deployments.classpath.exclude='',
> openejb.deployments.classpath.include='.*'
> INFO - Found EjbModule in classpath: d:\eclipse
>
> helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerejb\target\classes
> INFO - Found PersistenceModule in classpath: d:\eclipse
>
> helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerentities\target\classes
> INFO - Beginning load: d:\eclipse
>
> helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerejb\target\classes
> INFO - Beginning load: d:\eclipse
>
> helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerentities\target\classes
> INFO - Configuring enterprise application: D:\eclipse
>
> helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\FBM\FBM-MODULE\FlightBoardManagerEJB
> AVVERTENZA - Method 'lookup' is not available for
> 'javax.annotation.Resource'. Probably using an older Runtime.
> INFO - Auto-deploying ejb FBMFlightBoardEventsServiceBean:
> EjbDeployment(deployment-id=FBMFlightBoardEventsServiceBean)
> INFO - Auto-deploying ejb PlayerSummaryServiceBean:
> EjbDeployment(deployment-id=PlayerSummaryServiceBean)
> INFO - Auto-deploying ejb FlightBoardEventTypesServiceBean:
> EjbDeployment(deployment-id=FlightBoardEventTypesServiceBean)
> INFO - Auto-deploying ejb SystemEventsServiceBean:
> EjbDeployment(deployment-id=SystemEventsServiceBean)
> INFO - Auto-deploying ejb FlightBoardEventsServiceBean:
> EjbDeployment(deployment-id=FlightBoardEventsServiceBean)
> INFO - Auto-deploying ejb UpdateExpiredEventsLogic:
> EjbDeployment(deployment-id=UpdateExpiredEventsLogic)
> INFO - Auto-deploying ejb FBMSchedulerServiceBean:
> EjbDeployment(deployment-id=FBMSchedulerServiceBean)
> INFO - Auto-deploying ejb QueueMessagesListener:
> EjbDeployment(deployment-id=QueueMessagesListener)
> INFO - Configuring Service(id=Default Stateless Container, type=Container,
> provider-id=Default Stateless Container)
> INFO - Auto-creating a container for bean FBMFlightBoardEventsServiceBean:
> Container(type=STATELESS, id=Default Stateless Container)
> INFO - Creating Container(id=Default Stateless Container)
> INFO - Configuring Service(id=ejb/FBMGMSListener, type=Resource,
> provider-id=Default Queue)
> INFO - Auto-creating a Resource with id 'ejb/FBMGMSListener' of type
> 'javax.jms.Queue for 'QueueMessagesListener'.
> INFO - Creating Resource(id=ejb/FBMGMSListener)
> INFO - Configuring PersistenceUnit(name=FBM_PU,
> provider=org.hibernate.ejb.HibernatePersistence)
>
>
>
>
>
>
>
>
>
> Lookups don't fail but after sending message it seems the mdb is not
> invoked.
>
> I've tried to monitor active mq with jconsole.
> The result is that there is one queue but its name is equal to the
> mappedname attribute in my mdb (annotation style).
> Also I can't see the other queue i try to create in properties.
>
>
>
>
>
>
>
> Please help me
> Thanks in advance
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663848.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

RE: MDB not invoked

Posted by "vortex.alex" <co...@gmail.com>.
Hi,
i've the same problem.


My environment
--------------------
OpenEJB 4.5.1.
1 MDB
1 Client 



RELEVANT PART OF MDB
--------------------------------
@MessageDriven(
        mappedName = "ejb/FBMGMSListener",
        description = "Listener for GMS queue messages."
        ,
        activationConfig = {
        	@ActivationConfigProperty(propertyName="destinationType",
propertyValue="javax.jms.Queue"),
            @ActivationConfigProperty(propertyName="destination",
propertyValue="queGMS_FlightBoard"),




RELEVANT PART OF CLIENT
----------------------------------------
Properties props = new Properties();
props.put("MyJmsResourceAdapter",
"new://Resource?type=ActiveMQResourceAdapter");
props.put("MyJmsResourceAdapter.BrokerXmlConfig",
"broker:(tcp://localhost:61616)");
props.put("MyJmsResourceAdapter.ServerUrl", "tcp://localhost:61616");
props.put("MyJmsConnectionFactory",
"new://Resource?type=javax.jms.ConnectionFactory");
props.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");
props.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
props.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
props.put("queGMS_FlightBoard", "new://Resource?type=javax.jms.Queue");
Context ctx = new InitialContext(props);

......

Object obj1 = ctx.lookup("openejb:Resource/MyJmsConnectionFactory");
ConnectionFactory conn = (ConnectionFactory)obj1;
Connection connection = conn.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
			
Object obj2 = ctx.lookup("openejb:Resource/queGMS_FlightBoard");
Queue queue = (Queue)obj2;
MessageProducer producer = session.createProducer(queue);
TextMessage message = ....
producer.send(queue, message);


RELEVANT PART OF LOGS
---------------------------------------------
INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
INFO - Cannot find the configuration file [conf/openejb.xml].  Will attempt
to create one for the beans deployed.
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=queGMS_FlightBoard, type=Resource,
provider-id=Default Queue)
INFO - Configuring Service(id=MyJmsResourceAdapter, type=Resource,
provider-id=Default JMS Resource Adapter)
INFO - Configuring Service(id=fbm_ds, type=Resource, provider-id=Default
JDBC Database)
INFO - Configuring Service(id=MyJmsConnectionFactory, type=Resource,
provider-id=Default JMS Connection Factory)
INFO - Configuring Service(id=MyJmsMdbContainer, type=Container,
provider-id=Default MDB Container)
INFO - Creating TransactionManager(id=Default Transaction Manager)
INFO - Creating SecurityService(id=Default Security Service)
INFO - Creating Resource(id=MyJmsResourceAdapter)
INFO - ActiveMQ5Factory creating broker
INFO - Using ActiveMQ startup timeout of 10000ms
INFO - Starting ActiveMQ BrokerService
INFO - Using Persistence Adapter: MemoryPersistenceAdapter
INFO - JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO - Apache ActiveMQ 5.7.0 (localhost,
ID:PC-COSENZA-36269-1371556220257-0:1) is starting
INFO - Listening for connections at: tcp://127.0.0.1:61616
INFO - Connector tcp://127.0.0.1:61616 Started
INFO - Apache ActiveMQ 5.7.0 (localhost,
ID:PC-COSENZA-36269-1371556220257-0:1) started
INFO - For help or more information please see: http://activemq.apache.org
INFO - Starting ActiveMQ checkpoint
INFO - ActiveMQ broker started
INFO - Creating Resource(id=fbm_ds)
INFO - Creating Resource(id=queGMS_FlightBoard)
INFO - Creating Resource(id=MyJmsConnectionFactory)
INFO - Creating ConnectionManager for Resource(id=MyJmsConnectionFactory)
INFO - No runtime TransactionSupport
INFO - Creating Container(id=MyJmsMdbContainer)
AVVERTENZA - Inspecting classpath for applications: 70 urls.
AVVERTENZA - ADJUST THE EXCLUDE/INCLUDE!!!.  Current settings:
openejb.deployments.classpath.exclude='',
openejb.deployments.classpath.include='.*'
INFO - Found EjbModule in classpath: d:\eclipse
helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerejb\target\classes
INFO - Found PersistenceModule in classpath: d:\eclipse
helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerentities\target\classes
INFO - Beginning load: d:\eclipse
helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerejb\target\classes
INFO - Beginning load: d:\eclipse
helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\fbm\fbm-module\flightboardmanagerentities\target\classes
INFO - Configuring enterprise application: D:\eclipse
helios\workspace_lottomatica_gns_tns_branchgms4_flightboard\FBM\FBM-MODULE\FlightBoardManagerEJB
AVVERTENZA - Method 'lookup' is not available for
'javax.annotation.Resource'. Probably using an older Runtime.
INFO - Auto-deploying ejb FBMFlightBoardEventsServiceBean:
EjbDeployment(deployment-id=FBMFlightBoardEventsServiceBean)
INFO - Auto-deploying ejb PlayerSummaryServiceBean:
EjbDeployment(deployment-id=PlayerSummaryServiceBean)
INFO - Auto-deploying ejb FlightBoardEventTypesServiceBean:
EjbDeployment(deployment-id=FlightBoardEventTypesServiceBean)
INFO - Auto-deploying ejb SystemEventsServiceBean:
EjbDeployment(deployment-id=SystemEventsServiceBean)
INFO - Auto-deploying ejb FlightBoardEventsServiceBean:
EjbDeployment(deployment-id=FlightBoardEventsServiceBean)
INFO - Auto-deploying ejb UpdateExpiredEventsLogic:
EjbDeployment(deployment-id=UpdateExpiredEventsLogic)
INFO - Auto-deploying ejb FBMSchedulerServiceBean:
EjbDeployment(deployment-id=FBMSchedulerServiceBean)
INFO - Auto-deploying ejb QueueMessagesListener:
EjbDeployment(deployment-id=QueueMessagesListener)
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean FBMFlightBoardEventsServiceBean:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Creating Container(id=Default Stateless Container)
INFO - Configuring Service(id=ejb/FBMGMSListener, type=Resource,
provider-id=Default Queue)
INFO - Auto-creating a Resource with id 'ejb/FBMGMSListener' of type
'javax.jms.Queue for 'QueueMessagesListener'.
INFO - Creating Resource(id=ejb/FBMGMSListener)
INFO - Configuring PersistenceUnit(name=FBM_PU,
provider=org.hibernate.ejb.HibernatePersistence)









Lookups don't fail but after sending message it seems the mdb is not
invoked.

I've tried to monitor active mq with jconsole.
The result is that there is one queue but its name is equal to the
mappedname attribute in my mdb (annotation style).
Also I can't see the other queue i try to create in properties.







Please help me
Thanks in advance








--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4663848.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi David,

I'm not sure how to see the resources and binding in jmx-console, in fact, I don't know how to start jmx-console in openejb.


--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4553890.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB not invoked

Posted by David Blevins <da...@gmail.com>.
On Apr 12, 2012, at 6:19 PM, Johnny Guo wrote:
> 
> I did try to config it in openejb.xml like below as well, but it just didn't work for me.
> 
> <Resource id="ReportStandardJMSQueue" type="javax.jms.Queue"></Resource>
> <Connector id="jms/tdm-newjena/ReportStandardJMSConnFactory" type="javax.jms.ConnectionFactory">

Hi Johnny!

I did take a close look at your logs earlier and can verify this won't do anything (these things were being created already automatically).

I think what we need is a log line that says what the server understands is the Topic/Queue name of the MDB.  I had thought I added that as I've had this problem before as well.  I could be misremembering, though.

Anyway, once we get actual confirmation that the bean is truly tied to the queue/topic expected, then it's a simple act of using a JMX Console to see what the JMS broker is doing with the messages.  Via JMX you can see how many consumers (if any) there are for each Topic and Queue.  There should be at least one for the MDB itself.

Regardless of the logging, definitely do grab jconsole and attach to the broker's JVM and see what Topics and Queues there are and how many producers and consumers for each.

Let us know what you find and we can see what the next step might be.


-David



RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi Romain,

I did try to config it in openejb.xml like below as well, but it just didn't work for me.

<Resource id="ReportStandardJMSQueue" type="javax.jms.Queue"></Resource>
<Connector id="jms/tdm-newjena/ReportStandardJMSConnFactory" type="javax.jms.ConnectionFactory">


--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4553537.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB not invoked

Posted by Romain Manni-Bucau <rm...@gmail.com>.
didnt you try to configure jms resources in openejb.xml?

- Romain


2012/4/12 Johnny Guo <qi...@consultant.volvo.com>

> Hi,
>
> I have tried to setup it following the examples, but just not working for
> me.
> Here are some codes:
>
> 1)     No annotation in mdb , just a onMessage method. The ejb-jar.xml:
>
>
>  <enterprise-beans>
>
>    <message-driven>
>
>      <ejb-name>StandardReportsBean</ejb-name>
>
>  <ejb-class>se.it.newjena.reports.bean.receivers.StandardReportsBean</ejb-class>
>
>      <messaging-type>javax.jms.MessageListener</messaging-type>
>
>      <activation-config>
>        <activation-config-property>
>
>  <activation-config-property-name>destination</activation-config-property-name>
>
>  <activation-config-property-value>ReportStandardJMSQueue</activation-config-property-value>
>        </activation-config-property>
>        <activation-config-property>
>
>  <activation-config-property-name>destinationType</activation-config-property-name>
>
>  <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
>        </activation-config-property>
>      </activation-config>
>
>      <resource-ref>
>
>  <res-ref-name>jms/tdm-newjena/ReportStandardJMSConnFactory</res-ref-name>
>        <res-type>javax.jms.ConnectionFactory</res-type>
>      </resource-ref>
>
>      <resource-ref>
>        <res-ref-name>ReportStandardJMSQueue</res-ref-name>
>        <res-type>javax.jms.Queue</res-type>
>      </resource-ref>
>    </message-driven>
>
>  </enterprise-beans>
>
> 2)     The resources in the server.xml for tomcat in Eclipse:
>
> <Resource auth="Container" description="Report Standard JMSQueue"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> name="ReportStandardJMSQueue"  physicalName="ReportStandardJMSQueue"
> type="org.apache.activemq.command.ActiveMQQueue"/>
>           <Resource auth="Container" brokerName="LocalActiveMQBroker"
> brokerURL="tcp://localhost:61616" description="Report Standard JMS
> Connection Factory"
>  factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> name="jms/tdm-newjena/ReportStandardJMSConnFactory"
> type="org.apache.activemq.ActiveMQConnectionFactory"/>
>
> <Context docBase="C:\JavaDev\tools\apache-tomcat-6.0.29\webapps\openejb"
> path="/openejb" reloadable="true"/>
>
> 3)     The code to send message:
>                QueueConnection queueConnection = null;
>        QueueSession queueSession = null;
>        Queue queue = null;
>        QueueSender queueSender = null;
>        ObjectMessage message = null;
>
>        try {
>            // check if jndiContext and queueConnectionFactory are set if
> not
>            // throw an exception
>
>            if (jndiContext == null || queueConnectionFactory == null)
>                throw new Exception("InitialContext or
> QueueConnectionFactory is not set");
>
>            /*
>             * Look up queue.
>             */
>            queue = (Queue) jndiContext.lookup("ReportStandardJMSQueue");
>            queueConnection =
> queueConnectionFactory.createQueueConnection();
>            queueSession = queueConnection.createQueueSession(false,
> Session.AUTO_ACKNOWLEDGE);
>            queueSender = queueSession.createSender(queue);
>
>
>            /*
>             * Send message
>             */
>            message = queueSession.createObjectMessage();
>            message.setObject(wrapper);
>            queueSender.send(message);
>
>            logger.info("Jena reports - a message has been sent");
>
>        }
>
>      I also tried the below in ejb-jar.xml, but it will say the queue has
> binded to context, and if I removed the resource for this queue in
> server.xml, then it can't find the queue for sending messages.
>      <resource-env-ref>
>
>  <resource-env-ref-name>ReportStandardJMSQueue</resource-env-ref-name>
>        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
>      </resource-env-ref>
>
> Best Regards,
>
> Johnny Guo
> VIT Tianjin
> Mobile:   +86 13682195826
> E-mail:    qiang.guo@consultant.volvo.com
>
> From: Romain Manni-Bucau [via OpenEJB] [mailto:
> ml-node+s979440n4548744h28@n4.nabble.com]
> Sent: Wednesday, April 11, 2012 8:23 PM
> To: Guo Qiang (Consultant)
> Subject: Re: MDB not invoked
>
> Hi,
>
> how did you configure:
> 1) the mdb
> 2) the jmx resources (queue, connection factory, ...)
> 3) the client
> ?
>
> it sounds like a config error. If you can share some code we could help you
> more efficiently.
>
> Note: some JMS sample are here:
> http://openejb.apache.org/examples-trunk/index.html
>
> - Romain
>
>
> 2012/4/11 Johnny Guo <[hidden
> email]</user/SendEmail.jtp?type=node&node=4548744&i=0>>
>
> > Hi,
> >
> > I'm new to openejb. Now i'm working with openejb integrated with Tomcat
> in
> > Eclipse. Openejb can start successfully. One MDB was setup to listen to a
> > jms queue and the start log like this:
> > [INFO] Found ejb module EjbModule in war /newjena
> > [INFO] Found ejb module EjbModule in war /newjena
> > [INFO] Configuring enterprise application:
> >
> >
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> > [INFO] Auto-linking resource-ref
> > 'jms/tdm-newjena/ReportStandardJMSConnFactory' in bean
> StandardReportsBean
> > to Resource(id=jms/tdm-newjena/ReportStandardJMSConnFactory)
> > [INFO] Auto-linking resource-ref 'jms/tdm-newjena/ReportStandardJMSQueue'
> > in
> > bean StandardReportsBean to
> > Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> > [INFO] Configuring Service(id=jms/tdm-newjena/ReportStandardJMSQueue,
> > type=Resource, provider-id=Default Queue)
> > [INFO] Auto-creating a Resource with id
> > 'jms/tdm-newjena/ReportStandardJMSQueue' of type 'javax.jms.Queue for
> > 'StandardReportsBean'.
> > [INFO] Creating Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> > [INFO] Enterprise application
> >
> >
> "C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena"
> > loaded.
> > [INFO] Assembling app:
> >
> >
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> > [INFO] Jndi(name=StandardReportsBean) -->
> > Ejb(deployment-id=StandardReportsBean)
> > [INFO] Created Ejb(deployment-id=StandardReportsBean,
> > ejb-name=StandardReportsBean, container=My MDB Container)
> >
> > But when the message is sent to the queue, the MDB can not be invoked.
> >  What
> > is the problem and how can i get more detail information if something
> like
> > this happens?
> > Thanks
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548110.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548744.html
> To unsubscribe from MDB not invoked, click here<
> http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4548110&code=cWlhbmcuZ3VvQGNvbnN1bHRhbnQudm9sdm8uY29tfDQ1NDgxMTB8LTQ0OTE1ODIzNQ==
> >.
> NAML<
> http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4550730.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi,

I have tried to setup it following the examples, but just not working for me.
Here are some codes:

1)     No annotation in mdb , just a onMessage method. The ejb-jar.xml:


  <enterprise-beans>

    <message-driven>

      <ejb-name>StandardReportsBean</ejb-name>
      <ejb-class>se.it.newjena.reports.bean.receivers.StandardReportsBean</ejb-class>

      <messaging-type>javax.jms.MessageListener</messaging-type>

      <activation-config>
        <activation-config-property>
          <activation-config-property-name>destination</activation-config-property-name>
          <activation-config-property-value>ReportStandardJMSQueue</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>destinationType</activation-config-property-name>
          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>
      </activation-config>

      <resource-ref>
        <res-ref-name>jms/tdm-newjena/ReportStandardJMSConnFactory</res-ref-name>
        <res-type>javax.jms.ConnectionFactory</res-type>
      </resource-ref>

      <resource-ref>
        <res-ref-name>ReportStandardJMSQueue</res-ref-name>
        <res-type>javax.jms.Queue</res-type>
      </resource-ref>
    </message-driven>

  </enterprise-beans>

2)     The resources in the server.xml for tomcat in Eclipse:

<Resource auth="Container" description="Report Standard JMSQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="ReportStandardJMSQueue"  physicalName="ReportStandardJMSQueue" type="org.apache.activemq.command.ActiveMQQueue"/>
           <Resource auth="Container" brokerName="LocalActiveMQBroker" brokerURL="tcp://localhost:61616" description="Report Standard JMS Connection Factory"    factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="jms/tdm-newjena/ReportStandardJMSConnFactory" type="org.apache.activemq.ActiveMQConnectionFactory"/>

<Context docBase="C:\JavaDev\tools\apache-tomcat-6.0.29\webapps\openejb" path="/openejb" reloadable="true"/>

3)     The code to send message:
                QueueConnection queueConnection = null;
        QueueSession queueSession = null;
        Queue queue = null;
        QueueSender queueSender = null;
        ObjectMessage message = null;

        try {
            // check if jndiContext and queueConnectionFactory are set if not
            // throw an exception

            if (jndiContext == null || queueConnectionFactory == null)
                throw new Exception("InitialContext or QueueConnectionFactory is not set");

            /*
             * Look up queue.
             */
            queue = (Queue) jndiContext.lookup("ReportStandardJMSQueue");
            queueConnection = queueConnectionFactory.createQueueConnection();
            queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            queueSender = queueSession.createSender(queue);


            /*
             * Send message
             */
            message = queueSession.createObjectMessage();
            message.setObject(wrapper);
            queueSender.send(message);

            logger.info("Jena reports - a message has been sent");

        }

      I also tried the below in ejb-jar.xml, but it will say the queue has binded to context, and if I removed the resource for this queue in server.xml, then it can't find the queue for sending messages.
      <resource-env-ref>
        <resource-env-ref-name>ReportStandardJMSQueue</resource-env-ref-name>
        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
      </resource-env-ref>

Best Regards,

Johnny Guo
VIT Tianjin
Mobile:   +86 13682195826
E-mail:    qiang.guo@consultant.volvo.com

From: Romain Manni-Bucau [via OpenEJB] [mailto:ml-node+s979440n4548744h28@n4.nabble.com]
Sent: Wednesday, April 11, 2012 8:23 PM
To: Guo Qiang (Consultant)
Subject: Re: MDB not invoked

Hi,

how did you configure:
1) the mdb
2) the jmx resources (queue, connection factory, ...)
3) the client
?

it sounds like a config error. If you can share some code we could help you
more efficiently.

Note: some JMS sample are here:
http://openejb.apache.org/examples-trunk/index.html

- Romain


2012/4/11 Johnny Guo <[hidden email]</user/SendEmail.jtp?type=node&node=4548744&i=0>>

> Hi,
>
> I'm new to openejb. Now i'm working with openejb integrated with Tomcat in
> Eclipse. Openejb can start successfully. One MDB was setup to listen to a
> jms queue and the start log like this:
> [INFO] Found ejb module EjbModule in war /newjena
> [INFO] Found ejb module EjbModule in war /newjena
> [INFO] Configuring enterprise application:
>
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> [INFO] Auto-linking resource-ref
> 'jms/tdm-newjena/ReportStandardJMSConnFactory' in bean StandardReportsBean
> to Resource(id=jms/tdm-newjena/ReportStandardJMSConnFactory)
> [INFO] Auto-linking resource-ref 'jms/tdm-newjena/ReportStandardJMSQueue'
> in
> bean StandardReportsBean to
> Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> [INFO] Configuring Service(id=jms/tdm-newjena/ReportStandardJMSQueue,
> type=Resource, provider-id=Default Queue)
> [INFO] Auto-creating a Resource with id
> 'jms/tdm-newjena/ReportStandardJMSQueue' of type 'javax.jms.Queue for
> 'StandardReportsBean'.
> [INFO] Creating Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> [INFO] Enterprise application
>
> "C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena"
> loaded.
> [INFO] Assembling app:
>
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> [INFO] Jndi(name=StandardReportsBean) -->
> Ejb(deployment-id=StandardReportsBean)
> [INFO] Created Ejb(deployment-id=StandardReportsBean,
> ejb-name=StandardReportsBean, container=My MDB Container)
>
> But when the message is sent to the queue, the MDB can not be invoked.
>  What
> is the problem and how can i get more detail information if something like
> this happens?
> Thanks
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548110.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

________________________________
If you reply to this email, your message will be added to the discussion below:
http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548744.html
To unsubscribe from MDB not invoked, click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4548110&code=cWlhbmcuZ3VvQGNvbnN1bHRhbnQudm9sdm8uY29tfDQ1NDgxMTB8LTQ0OTE1ODIzNQ==>.
NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4550730.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: MDB not invoked

Posted by Johnny Guo <qi...@consultant.volvo.com>.
Hi,

I have tried to setup it following the examples, but just not working for me.
Here are some codes:

1)     No annotation in mdb , just a onMessage method. The ejb-jar.xml:


  <enterprise-beans>

    <message-driven>

      <ejb-name>StandardReportsBean</ejb-name>
      <ejb-class>se.it.newjena.reports.bean.receivers.StandardReportsBean</ejb-class>

      <messaging-type>javax.jms.MessageListener</messaging-type>

      <activation-config>
        <activation-config-property>
          <activation-config-property-name>destination</activation-config-property-name>
          <activation-config-property-value>ReportStandardJMSQueue</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>destinationType</activation-config-property-name>
          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>
      </activation-config>

      <resource-ref>
        <res-ref-name>jms/tdm-newjena/ReportStandardJMSConnFactory</res-ref-name>
        <res-type>javax.jms.ConnectionFactory</res-type>
      </resource-ref>

      <resource-ref>
        <res-ref-name>ReportStandardJMSQueue</res-ref-name>
        <res-type>javax.jms.Queue</res-type>
      </resource-ref>
    </message-driven>

  </enterprise-beans>

2)     The resources in the server.xml for tomcat in Eclipse:

<Resource auth="Container" description="Report Standard JMSQueue" factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="ReportStandardJMSQueue"  physicalName="ReportStandardJMSQueue" type="org.apache.activemq.command.ActiveMQQueue"/>
           <Resource auth="Container" brokerName="LocalActiveMQBroker" brokerURL="tcp://localhost:61616" description="Report Standard JMS Connection Factory"    factory="org.apache.activemq.jndi.JNDIReferenceFactory" name="jms/tdm-newjena/ReportStandardJMSConnFactory" type="org.apache.activemq.ActiveMQConnectionFactory"/>

<Context docBase="C:\JavaDev\tools\apache-tomcat-6.0.29\webapps\openejb" path="/openejb" reloadable="true"/>

3)     The code to send message:
                QueueConnection queueConnection = null;
        QueueSession queueSession = null;
        Queue queue = null;
        QueueSender queueSender = null;
        ObjectMessage message = null;

        try {
            // check if jndiContext and queueConnectionFactory are set if not
            // throw an exception

            if (jndiContext == null || queueConnectionFactory == null)
                throw new Exception("InitialContext or QueueConnectionFactory is not set");

            /*
             * Look up queue.
             */
            queue = (Queue) jndiContext.lookup("ReportStandardJMSQueue");
            queueConnection = queueConnectionFactory.createQueueConnection();
            queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            queueSender = queueSession.createSender(queue);


            /*
             * Send message
             */
            message = queueSession.createObjectMessage();
            message.setObject(wrapper);
            queueSender.send(message);

            logger.info("Jena reports - a message has been sent");

        }

      I also tried the below in ejb-jar.xml, but it will say the queue has binded to context, and if I removed the resource for this queue in server.xml, then it can't find the queue for sending messages.
      <resource-env-ref>
        <resource-env-ref-name>ReportStandardJMSQueue</resource-env-ref-name>
        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
      </resource-env-ref>



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4550743.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB not invoked

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

how did you configure:
1) the mdb
2) the jmx resources (queue, connection factory, ...)
3) the client
?

it sounds like a config error. If you can share some code we could help you
more efficiently.

Note: some JMS sample are here:
http://openejb.apache.org/examples-trunk/index.html

- Romain


2012/4/11 Johnny Guo <qi...@consultant.volvo.com>

> Hi,
>
> I'm new to openejb. Now i'm working with openejb integrated with Tomcat in
> Eclipse. Openejb can start successfully. One MDB was setup to listen to a
> jms queue and the start log like this:
> [INFO] Found ejb module EjbModule in war /newjena
> [INFO] Found ejb module EjbModule in war /newjena
> [INFO] Configuring enterprise application:
>
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> [INFO] Auto-linking resource-ref
> 'jms/tdm-newjena/ReportStandardJMSConnFactory' in bean StandardReportsBean
> to Resource(id=jms/tdm-newjena/ReportStandardJMSConnFactory)
> [INFO] Auto-linking resource-ref 'jms/tdm-newjena/ReportStandardJMSQueue'
> in
> bean StandardReportsBean to
> Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> [INFO] Configuring Service(id=jms/tdm-newjena/ReportStandardJMSQueue,
> type=Resource, provider-id=Default Queue)
> [INFO] Auto-creating a Resource with id
> 'jms/tdm-newjena/ReportStandardJMSQueue' of type 'javax.jms.Queue for
> 'StandardReportsBean'.
> [INFO] Creating Resource(id=jms/tdm-newjena/ReportStandardJMSQueue)
> [INFO] Enterprise application
>
> "C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena"
> loaded.
> [INFO] Assembling app:
>
> C:\TDM\workspace\was_migr\newjena2\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\newjena
> [INFO] Jndi(name=StandardReportsBean) -->
> Ejb(deployment-id=StandardReportsBean)
> [INFO] Created Ejb(deployment-id=StandardReportsBean,
> ejb-name=StandardReportsBean, container=My MDB Container)
>
> But when the message is sent to the queue, the MDB can not be invoked.
>  What
> is the problem and how can i get more detail information if something like
> this happens?
> Thanks
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-not-invoked-tp4548110p4548110.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>