Bug 1094394
| Summary: | MDBs do not deploy if they inherit MessageListener interface | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Jamie Beznoski <jamie.beznoski> | ||||||
| Component: | EJB | Assignee: | David M. Lloyd <david.lloyd> | ||||||
| Status: | CLOSED NOTABUG | QA Contact: | Jan Martiska <jmartisk> | ||||||
| Severity: | medium | Docs Contact: | Russell Dickenson <rdickens> | ||||||
| Priority: | unspecified | ||||||||
| Version: | 6.2.0 | CC: | tom.ross | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Windows | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2014-07-08 13:49:27 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
EJB 3.1 spec, section 5.4.2:
The message-driven bean class must implement the appropriate message listener interface for the mes-
saging type that the message-driven bean supports or specify the message listener interface using the
MessageDriven metadata annotation or the messaging-type deployment descriptor element.
Therefore, if the MDB implements the MessageListener interface through another one, you need to specify the message listener interface manually in your @MessageDriven annotation or the deployment descriptor:
@MessageDriven(name = "HelloWorldQueueMDB", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/HELLOWORLDMDBQueue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") },
messageListenerInterface = MessageListener.class
)
Then it will work.
I tried that But I still get the same exception. Created attachment 1200726 [details]
Solution working for me
Adding a project which demonstrates how the solution I proposed works (tried with EAP 6.4.0). Tom, please take a look at whether this is different from what you tried. This is run by simply doing mvn package and deploying it.
OK I think I understand now the purpose of messageListenerInterface. For JMS it will always be MessageListener. All my confusion came out of my misunderstanding hte meaning of messageListenerInterface. Thanks for your help |
Created attachment 892576 [details] Sample program that illustrates the issue. Based on helloworld-mdb quickstart Description of problem: If MDB implementations implement an interface that extends the MessageListener interface, they do not deploy. If your implementation class implements MessageListener directly, or extends a class that implements MessageListener, the bean deploys without issue. Stack trace snippet: 14:47:41,774 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC000001: Failed to start service jboss.deployment.unit."jboss-helloworld-mdb.war".component.HelloWorldQueueMDB.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-helloworld-mdb.war".component.HelloWorldQueueMDB.CREATE: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26] Caused by: java.lang.IllegalStateException: JBAS014521: No message listener of type org.jboss.as.quickstarts.mdb.HelloWorldQueue found in resource adapter hornetq-ra at org.jboss.as.ejb3.component.EJBUtilities.createActivationSpecs(EJBUtilities.java:105) Version-Release number of selected component (if applicable): JBoss EAP 6.2.0 How reproducible: Here's a simple code example that illustrates the issue (this is a small modification of the "helloworld-mdb" quickstart example): Interface: import javax.jms.MessageListener; public interface HelloWorldQueue extends MessageListener { } Implementation: @MessageDriven(name = "HelloWorldQueueMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/HELLOWORLDMDBQueue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") }) public class HelloWorldQueueMDB implements HelloWorldQueue { public void onMessage(Message rcvMessage) { // method body goes here.... } } Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: See attachment for a sample program that illustrates this issue.