javax.naming.NamingException:intellij

时间:2017-11-07 22:22:48

标签: java exception java-ee ejb jndi

GlassFish Logs向我提供了路径。 我正在尝试启动应用程序,但它会抛出错误。

服务器日志:

[2017-11-07T18:56:06.161 + 0100] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid:_ThreadID = 43 _ThreadName = admin-listener (4)] [timeMillis:1510077366161] [levelValue:800] [[   EJB UserSessionBean的可移植JNDI名称:[java:global / Chat_ejb_EJB_exploded / UserSessionBean!com.chat.interfaces.session.UserSessionRemote,java:global / Chat_ejb_EJB_exploded / UserSessionBean!com.chat.interfaces.session.UserSessionLocal]]]

[2017-11-07T18:56:06.162 + 0100] [glassfish 4.1] [INFO] [AS-EJB-00055] [javax.enterprise.ejb.container] [tid:_ThreadID = 43 _ThreadName = admin-listener (4)] [timeMillis:1510077366162] [levelValue:800] [[   EJB UserSessionBean的Glassfish特定(非可移植)JNDI名称:[com.chat.interfaces.session.UserSessionRemote#com.chat.interfaces.session.UserSessionRemote,com.chat.interfaces.session.UserSessionRemote]]

[2017-11-07T18:56:11.198 + 0100] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid:_ThreadID = 43 _ThreadName = admin-listener (4)] [timeMillis:1510077371198] [levelValue:800] [[   EJB UserManagementBean的可移植JNDI名称:[java:global / Chat_ejb_EJB_exploded / UserManagementBean!com.chat.interfaces.management.UserManagementRemote,java:global / Chat_ejb_EJB_exploded / UserManagementBean!com.chat.interfaces.management.UserManagementLocal]]]

[2017-11-07T18:56:11.198 + 0100] [glassfish 4.1] [INFO] [AS-EJB-00055] [javax.enterprise.ejb.container] [tid:_ThreadID = 43 _ThreadName = admin-listener (4)] [timeMillis:1510077371198] [levelValue:800] [[   EJB UserManagementBean的Glassfish特定(非可移植)JNDI名称:[com.chat.interfaces.management.UserManagementRemote,com.chat.interfaces.management.UserManagementRemote#com.chat.interfaces.management.UserManagementRemote]]

代码:

private ServiceHandlerImpl() {
        try {
            ctx = new InitialContext();

            this.userManagement = (UserManagementRemote) ctx.lookup(
                    "java:global/Chat_ejb_EJB_exploded/UserManagementBean!com.chat.interfaces.management.UserManagementRemote");

            this.userSessionBean = (UserSessionRemote) ctx.lookup(
                    "java:global/Chat_ejb_EJB_exploded/UserSessionBean!com.chat.interfaces.session.UserSessionRemote");

        } catch (NamingException e) {
            e.printStackTrace();
        }
    }

堆栈跟踪:

java.lang.NullPointerException
    at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:347)
    at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:354)
    at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:384)
    at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:329)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:477)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.chat.impl.ServiceHandlerImpl.<init>(ServiceHandlerImpl.java:31)
    at com.chat.impl.ServiceHandlerImpl.getInstance(ServiceHandlerImpl.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at de.fh_dortmund.inf.cw.chat.client.ui.ServiceHandlerHelper.<init>(ServiceHandlerHelper.java:69)
    at de.fh_dortmund.inf.cw.chat.client.ui.ServiceHandlerHelper.getInstance(ServiceHandlerHelper.java:151)
    at de.fh_dortmund.inf.cw.chat.client.ui.Window$1.run(Window.java:83)
    at java.lang.Thread.run(Thread.java:748)
javax.naming.NamingException: Lookup failed for 'java:global/Chat_ejb_EJB_exploded/UserManagementBean!com.chat.interfaces.management.UserManagementRemote' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is java.lang.NullPointerException]]
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.chat.impl.ServiceHandlerImpl.<init>(ServiceHandlerImpl.java:31)
    at com.chat.impl.ServiceHandlerImpl.getInstance(ServiceHandlerImpl.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at de.fh_dortmund.inf.cw.chat.client.ui.ServiceHandlerHelper.<init>(ServiceHandlerHelper.java:69)
    at de.fh_dortmund.inf.cw.chat.client.ui.ServiceHandlerHelper.getInstance(ServiceHandlerHelper.java:151)
    at de.fh_dortmund.inf.cw.chat.client.ui.Window$1.run(Window.java:83)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is java.lang.NullPointerException]
    at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:334)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:477)
    ... 12 more
Caused by: java.lang.NullPointerException
    at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:347)
    at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:354)
    at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:384)
    at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:329)
    ... 13 more

0 个答案:

没有答案