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); }
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; } }
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); } }