0

我只想在 web.xml 中添加一个 servlet,如下所示:

<servlet>
        <display-name>AxisJMSServlet</display-name>
        <servlet-name>JMSListener</servlet-name>    
        <servlet-class>com.sinosoft.prpall.web.jms.JMSListenServlet</servlet-class>
        <load-on-startup>110</load-on-startup>
  </servlet>

一切都很好,当我开始我的程序时,我得到了这个:

javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable [Root exception is java.lang.NullPointerException]
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:258)
        at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:318)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:348)
        at javax.naming.InitialContext.internalInit(InitialContext.java:286)
        at javax.naming.InitialContext.<init>(InitialContext.java:211)
        at org.apache.axis.components.jms.JNDIVendorAdapter.getConnectionFactory(JNDIVendorAdapter.java:85)
        at org.apache.axis.components.jms.JNDIVendorAdapter.getQueueConnectionFactory(JNDIVendorAdapter.java:55)
        at org.apache.axis.transport.jms.JMSConnectorFactory.createConnector(JMSConnectorFactory.java:227)
        at org.apache.axis.transport.jms.JMSConnectorFactory.createServerConnector(JMSConnectorFactory.java:156)
        at com.sinosoft.prpall.web.jms.JMSListenServlet.init(JMSListenServlet.java:60)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1981)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1955)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1874)

谁能告诉我发生了什么事?

4

1 回答 1

0

在某处您尝试创建 InitialContext,但尚未为其提供适当的参数。这是在 Weblogic 上创建 InitialContext 的示例:

http://docs.oracle.com/cd/E15051_01/wls/docs103/javadocs/weblogic/jndi/WLInitialContextFactory.html

如果您不是手动创建 InitialContext,那么您需要从管理控制台配置 JNDI 设置。

于 2013-07-03T05:33:46.937 回答