[jboss-jira] [JBoss JIRA] Created: (JBAS-4189) @EJB doesn't work inside a servlet

Juergen Zimmermann (JIRA) jira-events at lists.jboss.org
Thu Mar 8 21:57:34 EST 2007


@EJB doesn't work inside a servlet
----------------------------------

                 Key: JBAS-4189
                 URL: http://jira.jboss.com/jira/browse/JBAS-4189
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: EJB3
    Affects Versions: JBossAS-4.2.0.CR1
         Environment: JBossAS 4.2.0CR1, JDK 5.0_11, WinXP SP2, Eclipse WTP 1.5.3
            Reporter: Juergen Zimmermann
         Assigned To: Bill Burke


When a servlet tries to invoke a proxa referencing a stateless session bean I get a null pointer.

1) Stateless session bean:
@Stateless
@Local(EjbRefLocal.class)
public class EjbRefBean implements EjbRefLocal {
	public String foo() {
		return "ok";
	}
}

2) Local interface
public interface EjbRefLocal {
	String foo();
}

3) Servlet
public class MyServlet extends HttpServlet {
	@EJB
	private EjbRefLocal proxy;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		final String result = proxy.foo();
		System.out.println("RESULT = " + result);
	}
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list