2 Replies Latest reply on Jul 23, 2013 8:44 AM by stonesoft

    @EJB NullPointerException Jboss EAP 6.1

    stonesoft

      This worked in AS 7.1.1.  Can anyone tell me what I need to do?  All three files are in the same jar.

       

       

      -----------------------------------------------------------------------------------------------------------------------

      The EJB interface ReportTypesHomeLocal.java:

       

      import javax.ejb.Local;

       

      @Local

      public interface ReportTypesHomeLocal {

           public List<ReportTypes> findByCode(Integer code);

      }

       

      -----------------------------------------------------------------------------------------------------------------------

      The EJB ReportTypesHome.java:

       

      @Stateless

      public class ReportTypesHome implements ReportTypesHomeLocal {

           public List<ReportTypes> findByCode(Integer code) {

                .

                .

                .

           }

      }

       

      ------------------------------------------------------------------------------------------------------------------------

      The MDB that calls the EJB:

       

      @MessageDriven(name=ReportingRequestQueueMDB" activiationConfig= {

           @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),

           @ActivationConfigProperty(propertyName="destination", propertyValue="queue/ReportingRequestQueue"),

           @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-Acknowledge") } )

       

      public class ReportingRequestQueueMDB implements MessageListener {

       

           @EJB private static ReportTypesHomeLocal reportTypesHome;

       

           public void onMessage(Message message) {

                ObjectMessage om = (ObjectMessage) message;

                try {

                     ReportingRequest request = (ReportingRequest) om.getObject();

                     List<ReportTypes> reportTypesList = reportTypesHome.findByCode(request.getCode());   <--- NullPointerException reportTypesHome is null

                     .

                     .

                     .

                }

                catch (Exception ex) {

                }

      }