[jboss-user] [JBoss Messaging] - How to setup context when accessing SLSB from MDB?

alllle do-not-reply at jboss.com
Mon Oct 29 14:56:45 EDT 2007


I am consistently getting this exception with my deployed application. 

I have a MDB that accesses other local EJB. I coded the MDB to lookup the other EJB using the InitialContext with its own username and password. The code looks like this:

  | Hashtable<String, Object> env = new Hashtable<String, Object> ();
  | env.put(Context.SECURITY_PRINCIPAL, username);
  | env.put(Context.SECURITY_CREDENTIALS, password);
  | env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
  | 
  | InitialContext context = new InitialContext(env);
  | 

However, when the LoginModule.login() method is invoked by the JBoss AS on behalf of the MDB code during the process of invoking the EJB methods, the LoginModule does not see the username and password specified in the InitialContext. It gets null values and hence failed to proceed with the EJB invocation. 

With the similar code, I can invoke the local EJB from Servlet code and I don't know what is the problem when used inside the MDB. Please help if you have any idea!

Thanks,



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

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



More information about the jboss-user mailing list