When using @EJB for a session bean in a servlet i get a NullPointerException -
Am I missing something (new to Jee5 and Injections)
HelloWorldSession is the interface for HelloWorldSessionBean
|
| public class HelloWorldCallingSessionEJBServlet extends HttpServlet
| {
| @EJB
| private HelloWorldSession helloWorldSession;
|
| public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
| {
| this.doWork(request, response);
|
| }//end method doGet
|
| public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
| {
| this.doWork(request, response);
|
| }//end method doPost
|
| private void doWork(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
| {
| ;
| String helloString = "empty string";
|
| helloString = this.helloWorldSession.sayHello();
|
| response.setContentType("text/html");
| PrintWriter out = response.getWriter();
|
| out.println("<html><head><title>HelloWorld</title></head><body>");
| out.println("<h3>" + helloString + "</h3>");
| out.println("</body></html>");
|
|
| }//end method doWork
|
|
| }//end class HelloWorldCallingSessionEJBServlet
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187110#4187110
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187110
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user