Bug 1094394 - MDBs do not deploy if they inherit MessageListener interface
Summary: MDBs do not deploy if they inherit MessageListener interface
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: EJB
Version: 6.2.0
Hardware: All
OS: Windows
unspecified
medium
Target Milestone: ---
: ---
Assignee: David M. Lloyd
QA Contact: Jan Martiska
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-05 15:03 UTC by Jamie Beznoski
Modified: 2016-09-14 08:39 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-08 13:49:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Sample program that illustrates the issue. Based on helloworld-mdb quickstart (44.82 KB, application/zip)
2014-05-05 15:03 UTC, Jamie Beznoski
no flags Details
Solution working for me (13.94 KB, application/zip)
2016-09-14 05:20 UTC, Jan Martiska
no flags Details

Description Jamie Beznoski 2014-05-05 15:03:45 UTC
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.

Comment 1 Jan Martiska 2014-07-08 13:49:27 UTC
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.

Comment 2 Tom Ross 2016-09-13 15:21:52 UTC
I tried that But I still get the same exception.

Comment 3 Jan Martiska 2016-09-14 05:20:45 UTC
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.

Comment 4 Tom Ross 2016-09-14 08:39:42 UTC
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


Note You need to log in before you can comment on or make changes to this bug.