[jboss-user] [JBoss Seam] - Email Listening MDB Accessing Seam Components

djeverson do-not-reply at jboss.com
Sun Mar 4 13:53:46 EST 2007


We are getting a Null Pointer Exception in an MDB that is listening for emails.  

It appears that the Seam components are not being properly injected.  We get errors when we attempt to use @Logger.  We have changed these for the time being to System.out.printlns.   Our service EJB components are not getting injected either.  

Our environment is Seam 1.1.7RC1, JBoss 4.0.5.  The mail-ra.rar file has been placed in the server\default\deploy folder.  

The following is our MDB that is throwing the NPEs:


  | package us.crimnet.iss.listeners;
  | 
  | import javax.ejb.ActivationConfigProperty;
  | import javax.ejb.MessageDriven;
  | import javax.ejb.Stateless;
  | import javax.mail.Message;
  | 
  | import org.jboss.annotation.ejb.ResourceAdapter;
  | import org.jboss.mail.MailException;
  | 
  | import org.jboss.resource.adapter.mail.inflow.MailListener;
  | import org.jboss.seam.Component;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.ScopeType;
  | 
  | import us.crimnet.iss.services.HistoryManagement;
  | import us.crimnet.iss.services.impl.HistoryManagementImpl;
  | 
  | @MessageDriven(activationConfig={
  |         @ActivationConfigProperty(propertyName="mailServer", propertyValue="domain.com"),
  |         @ActivationConfigProperty(propertyName="mailFolder", propertyValue="INBOX"),
  |         @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="pop3"),
  |         @ActivationConfigProperty(propertyName="userName", propertyValue="uid"),
  |         @ActivationConfigProperty(propertyName="password", propertyValue="pwd")
  | })
  | 
  | @ResourceAdapter("mail-ra.rar")
  | @Name("requestEmailListener")
  | 
  | public class RequestEmailListener implements MailListener {
  | 
  |   @In(create=true)
  |   private HistoryManagement historyManagement;
  | 
  |   public void onMessage(Message message) {
  | 	  System.out.println("Can we inject the @Logger here???");
  | 	  System.out.println("RequestEmailListener.onMessage()");
  | 	  try {
  |      Long id = Long.parseLong(message.getSubject());
  |      System.out.println("History id [" + id + "]");
  |      //TODO : dj : The following line threw an NPE
  |      // was it not properly injected by Seam?
  |      historyManagement.sendRequest(id);
  |     
  |      System.out.println("back from HistoryManagement");
  | 	  } catch (Exception e) {
  | 		  e.printStackTrace();
  | 	  }
  |   }  
  | }
  | 

Any suggestions as to what the causing the Seam Components not to be injected or initialized?

Thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024920#4024920

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024920



More information about the jboss-user mailing list