サーブレットにこのような @EJB アノテーションがあります
import javax.ejb.EJB;
import stateless.Staff;
public class DisplayStaff extends HttpServlet
{
private static final long serialVersionUID = 1L;
@EJB
private StaffBean Staff_bean;
....
}
その注釈とその宣言がなければ、サーブレットは機能し、呼び出されます。注釈を使用すると、エラーが発生します
root cause
com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class controllers.DisplayStaff
root cause
com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=controllers.DisplayStaff/Stud_bean,Remote 3.x interface =stateless.StaffBean,ejb-link=null,lookup=,mappedName=,jndi-name=stateless.StaffBean,refType=Session into class controllers.DisplayStaff: Lookup failed for 'java:comp/env/controllers.DisplayStaff/Stud_bean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
root cause
javax.naming.NamingException: Lookup failed for 'java:comp/env/controllers.DisplayStaff/Stud_bean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=controllers.DisplayStaff/Stud_bean,Remote 3.x interface =stateless.StaffBean,ejb-link=null,lookup=,mappedName=,jndi-name=stateless.StaffBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'stateless.StaffBean#stateless.StaffBean' [Root exception is javax.naming.NamingException: Lookup failed for 'stateless.StaffBean#stateless.StaffBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: stateless.StaffBean#stateless.StaffBean not found]]]
root cause
javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=controllers.DisplayStaff/Stud_bean,Remote 3.x interface =stateless.StaffBean,ejb-link=null,lookup=,mappedName=,jndi-name=stateless.StaffBean,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'stateless.StaffBean#stateless.StaffBean' [Root exception is javax.naming.NamingException: Lookup failed for 'stateless.StaffBean#stateless.StaffBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: stateless.StaffBean#stateless.StaffBean not found]]
root cause
javax.naming.NamingException: Lookup failed for 'stateless.StaffBean#stateless.StaffBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: stateless.StaffBean#stateless.StaffBean not found]
root cause
javax.naming.NameNotFoundException: stateless.StaffBean#stateless.StaffBean not found
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.2 logs.