RE: MDB not invoked

2012-04-12 Thread Johnny Guo
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

2012-04-12 Thread David Blevins

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.
> 
> 
>  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

2012-04-12 Thread Johnny Guo
Hi Romain,

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





--
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

2012-04-12 Thread Johnny Guo
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:


  



  StandardReportsBean
  
se.it.newjena.reports.bean.receivers.StandardReportsBean

  javax.jms.MessageListener

  

  
destination
  
ReportStandardJMSQueue


  
destinationType
  
javax.jms.Queue

  

  

jms/tdm-newjena/ReportStandardJMSConnFactory
javax.jms.ConnectionFactory
  

  
ReportStandardJMSQueue
javax.jms.Queue
  


  

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


   



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.
  
ReportStandardJMSQueue
javax.jms.Queue
  

Best Regards,

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

From: Romain Manni-Bucau [via OpenEJB] 
[mailto:ml-node+s979440n4548744...@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]>

> 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

RE: MDB not invoked

2012-04-12 Thread Johnny Guo
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:


  



  StandardReportsBean
  
se.it.newjena.reports.bean.receivers.StandardReportsBean

  javax.jms.MessageListener

  

  
destination
  
ReportStandardJMSQueue


  
destinationType
  
javax.jms.Queue

  

  

jms/tdm-newjena/ReportStandardJMSConnFactory
javax.jms.ConnectionFactory
  

  
ReportStandardJMSQueue
javax.jms.Queue
  


  

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


   



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.
  
ReportStandardJMSQueue
javax.jms.Queue
  



--
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

2012-04-11 Thread Romain Manni-Bucau
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 

> 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.
>