• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

messageListenerInterface doubt

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB 3.0 Core Specification
If the message-driven bean class implements more than one interface other than java.io.Serializable,
java.io.Externalizable, or any of the interfaces defined by the javax.ejb package,the message listener interface must be specified by the messageListenerInterface element of the MessageDriven annotation or the messaging-type element of the message-driven
deployment descriptor element.

Well i had this inherant feeling like my most of the quesions on Session beans, that the above statement will again contradict my code experience
and it did.

I have a MDB as shown below




ShippingRequestProcessorMDB MDB implements javax.ejb.SessionBean and javax.ejb.MessageDriven interface and it does not specify the message listener
via messageListenerInterface element of MessageDriven nor through any elements in DD. Still things worked perfectly fine.

22:52:34,750 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=chapter4.ear,jar=chapter4-ejb.jar,name=ShippingRequestMessageConsumer,service=EJB3 with dependencies:
22:52:34,812 INFO [EJBContainer] STARTED EJB: com.ejb3inaction.actionbazaar.buslogic.ShippingRequestProcessorMDB ejbName: ShippingRequestMessageConsumer
22:52:34,812 WARN [MessagingContainer] Could not find the queue destination-jndi-name=queue/ShippingRequestQueue
22:52:34,812 WARN [MessagingContainer] destination not found: queue/ShippingRequestQueue reason: javax.naming.NameNotFoundException: ShippingRequestQueue not bound
22:52:34,828 WARN [MessagingContainer] creating a new temporary destination: queue/ShippingRequestQueue
22:52:34,843 INFO [ShippingRequestQueue] Bound to JNDI name: queue/ShippingRequestQueue
22:52:34,906 INFO [EJB3Deployer] Deployed: file:/E:/DJ/Certifications/Java/SCBCD/Application Servers/JBOSS/jboss-4.2.3.GA/server/default/tmp/deploy/tmp37578chapter4.ear-contents/chapter4-ejb.jar
22:52:35,109 INFO [EARDeployer] Started J2EE application: file:/E:/DJ/Certifications/Java/SCBCD/Application Servers/JBOSS/jboss-4.2.3.GA/server/default/deploy/chapter4.ear
22:52:35,265 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
22:52:35,296 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
22:52:35,343 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 27s:781ms
22:53:26,250 INFO [STDOUT] INSERT INTO SHIPPING_REQUESTS(ITEM, SHIPPING_ADDRESS, SHIPPING_METHOD, INSURANCE_AMOUNT) VALUES ( 10101, '101 Easy Street', ' Snail mail', 101.0)
22:53:26,250 INFO [STDOUT] Shipping request processed.


Have i done something wrong??? Why is this contradicting behavior?
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please take time to respond to this question.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Experts/Ranchers, Please take time and reply.
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Jain wrote:Experts/Ranchers, Please take time and reply.



Please give time to reply

About your issue?

1. Seems you have not created the specified destination. Before you deploy a MDB, queue or topic which mdb is listening should be available.
1. Dont implemetn SessionBean
2. Did you implemented onMessage correctly?

Regards
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My whole idea here was to test this sentence from EJB 3.0 specification.


f the message-driven bean class implements more than one interface other than java.io.Serializable, java.io.Externalizable, or any of the interfaces defined by the javax.ejb package,the message listener interface must be specified by the messageListenerInterface element of the MessageDriven annotation or the messaging-type element of the message-driven deployment descriptor element.



As i said "ShippingRequestProcessorMDB MDB implements javax.ejb.SessionBean and javax.ejb.MessageDriven interface and it does not specify the message listener via messageListenerInterface element of MessageDriven or through any elements in DD. Still things worked perfectly fine."
I was expecting the MDB not to work, but still everything worked perfectly.
I even tried the below code


In the above MDB it implements MyInterface1 and MyInterface2, which do not belong to javax.ejb. package. Which means according to Spec , I should have specfied the message listener interface MessageListener in the messageListenerInterface element of MessageDriven, which i did not. And still everything worked perfectly.
The above code is violating EJB Spec.

Again i have used JBoss to test the code. And like most of other questions that i have posted on spec violation, I think Jboss is violating the Spec left and right. I think i should not have started using JBoss as a novice EJB developer.
 
reply
    Bookmark Topic Watch Topic
  • New Topic