1 Reply Latest reply on Feb 24, 2017 11:19 AM by Heinz Erhard

    How to use Message-Driven-Bean module together with a war-application sharing the spring application context

    Heinz Erhard Newbie



      I have difficulties migrating to JBoss EAP 7.0.0.


      Theres a EJB-module containing three message driven beans.

      Theres a war-module containing the web app doing all the stuff.

      Both are packed into an ear-file.


      We use spring in both modules for injection etc.



      In general most things works fine.

      Except for an injection into the MDB.


      I think the problem is that the MDB cannot access the application context which was initialized by the war-module.

      Due to existing code and some hits on google I seems to be working on later versions of JBoss.

      Because of the MDB cannot access the application context the desired autowiring does not take place.


      Im am now looking for any way to get this working, may by reorganizing or reconfiguring something.

      This I where I request some help.


      In the following I will share my codes:


      one of those MDBs:


      MessageDriven(name = "MyProjectIntern-Bean", activationConfig = {
         @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
         @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/q_myproject_intern") })
      public class MyprojectInternMDB extends BaseMDB implements MessageListener {
         public void setMessageHandler(@Qualifier("myprojectInternalMessageHandler") MessageHandler messageHandler) {
         this.messageHandler = messageHandler;


      this is the ears-pom definition:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <name>MyProject EAR</name>
          <description>MyProject 03.500</description>




      Due to debugging I can see that the onMessage method of my MDB is reached after sending one message to a queue. But the desired messageHandler which shall be set by autowiring is still null.

      Also a debug point into the auto wired set-method is never reached.


      Autowiring on my web module works pretty fine.


      If you need any further information please ask fot it.


      Thanks in advance.