[jboss-user] [EJB 3.0] - no local jndi binding for a simple ejb3 session bean

jason_rency do-not-reply at jboss.com
Wed Aug 16 07:34:09 EDT 2006


hi all, 
I got java.lang.NullPointerException when I was calling a simple ejb3 staless session been (deployed to jboss4.04GA) from my servlet, my web application and the ejb were packeged in the same ear. during the deployment I can't see a local jndi binding for this bean as well.

just wodering, do I need to configure something for this bean in ejb-jar.xml or jndi.properties as I think by default session beans will bind to JNDI in the form ejbName/remote for remote interfaces and ejbName/local in the case of local interfaces


here is the ejb interface:

package src.reg.server;
  | import javax.ejb.Local;
  |  
  | @Local()
  | public interface token {
  | 	
  | 	 public String issue(String uid, String PIN);
  | }


here is the implementation:

package src.reg.server;
  |  
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  |  
  | @Stateless()
  | public class tokenAction implements token {
  | public String issueKey(String username,String pin) 
  | 	{
  |                        String temp = username +pin;
  | 	  return temp;
  | 	}
  | }



this is the servlet where I invoke the EJB bean;


  | package src.reg.server;
  |  
  | import java.text.*;
  | import javax.servlet.*;
  | import javax.servlet.http.*;
  | import java.io.*;
  | import javax.ejb.EJB;
  |  
  | public class myservlet extends HttpServlet {
  | 	
  | 	@EJB
  | 	private static token t; 
  | 	private String key = null ;
  | 		
  | 	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
  | 		throws ServletException,
  | 		IOException {
  | 		resp.setContentType("text/plain");
  | 		PrintWriter out = resp.getWriter();
  | 		String uid = req.getParameter("uid");
  | 		String Pin = req.getParameter("passwd");
  | 		key = t.issueKey(uid, Pin);//(here is the exception was thrown)          out.println(key);
  | 	}
  |  
  | }


thanks a lot...



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

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



More information about the jboss-user mailing list