0 Replies Latest reply on Aug 16, 2006 7:34 AM by Chongyan Ren

    no local jndi binding for a simple ejb3 session bean

    Chongyan Ren Newbie

      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;
      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;
      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 {
       private static token t;
       private String key = null ;
       protected void doPost(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException,
       IOException {
       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...