0

当我启动 glassfish 应用程序服务器时,我看到以下错误:

exception

javax.servlet.ServletException: An error occurred performing resource injection on managed bean user
root cause

com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean user
root cause

com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=com.tsystems.demail.Beans.User/first_name,Remote 3.x interface =java.lang.String,ejb-link=null,lookup=,mappedName=,jndi-name=java.lang.String,refType=Session into class com.tsystems.demail.Beans.User: Lookup failed for 'java:comp/env/com.tsystems.demail.Beans.User/first_name' 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

com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=com.tsystems.demail.Beans.User/first_name,Remote 3.x interface =java.lang.String,ejb-link=null,lookup=,mappedName=,jndi-name=java.lang.String,refType=Session into class com.tsystems.demail.Beans.User: Lookup failed for 'java:comp/env/com.tsystems.demail.Beans.User/first_name' 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/com.tsystems.demail.Beans.User/first_name' 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=com.tsystems.demail.Beans.User/first_name,Remote 3.x interface =java.lang.String,ejb-link=null,lookup=,mappedName=,jndi-name=java.lang.String,refType=Session' .  Actual (possibly internal) Remote JNDI name used for lookup is 'java.lang.String#java.lang.String' [Root exception is javax.naming.NamingException: Lookup failed for 'java.lang.String#java.lang.String' 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: java.lang.String#java.lang.String not found]]]
root cause

javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=com.tsystems.demail.Beans.User/first_name,Remote 3.x interface =java.lang.String,ejb-link=null,lookup=,mappedName=,jndi-name=java.lang.String,refType=Session' .  Actual (possibly internal) Remote JNDI name used for lookup is 'java.lang.String#java.lang.String' [Root exception is javax.naming.NamingException: Lookup failed for 'java.lang.String#java.lang.String' 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: java.lang.String#java.lang.String not found]]
root cause

javax.naming.NamingException: Lookup failed for 'java.lang.String#java.lang.String' 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: java.lang.String#java.lang.String not found]
root cause

javax.naming.NameNotFoundException: java.lang.String#java.lang.String not found

在堆栈跟踪中,我看到以下错误:

[#|2013-07-01T23:53:14.447+0400|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=100;_ThreadName=Thread-2;|StandardWrapperValve[FacesServlet]: PWC1406: Servlet.service() for servlet FacesServlet threw exception
javax.naming.NameNotFoundException: java.lang.String#java.lang.String not found 

我的豆类的一部分:

@ManagedBean
@SessionScoped
public class User {

    public static EntityManagerFactory emf = Persistence.createEntityManagerFactory("NewPersistenceUnit");

    @EJB
    private String first_name;
    private String last_name;
    private String mobile_phone;
    private String password;
    private String rtPassword;
    private Date birth_day;
    private String username;
    private List data;
    private Map<String,Object> userList;
    private String temp;
    private UIComponent phoneLogin;
    private UIComponent profileReg;
    .....
    //logic with methods

如何解决?请帮忙。

4

1 回答 1

0

private String first_name;不是 EJB,但您正在使用@EJB注释对其进行标记。删除注释,错误应该消失。有关注释功能的更多信息,请参阅此链接

于 2013-07-01T20:49:49.077 回答