0

在本地 Eclipse IDE 和远程 CentOS 服务器中使用 TomEE+ 8.0 (Tomcat 9.0.12)。应用程序在本地正常启动,之前在远程服务器上正常启动。现在,在添加 javascript WebSocket 的更改后,会在部署到远程服务器时引发 NPE。

关于从哪里开始寻找的任何建议?这是一个令人头疼的问题。

谢谢你,泰德 S。

堆栈跟踪:

SEVERE [http-nio-9086-exec-119] sun.reflect.NativeMethodAccessorImpl.invoke Creation of the naming context failed: [javax.naming.OperationNotSupportedException: Context is read only]
SEVERE [http-nio-9086-exec-119] org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Error merging Java EE JNDI entries in to war /o-test: Exception: null
 java.lang.NullPointerException
        at org.apache.catalina.core.NamingContextListener.createSubcontexts(NamingContextListener.java:1253)
        at org.apache.catalina.core.NamingContextListener.addEnvironment(NamingContextListener.java:785)
        at org.apache.catalina.core.NamingContextListener.processGlobalResourcesChange(NamingContextListener.java:432)
        at org.apache.catalina.core.NamingContextListener.propertyChange(NamingContextListener.java:382)
        at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
        at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
        at org.apache.catalina.deploy.NamingResourcesImpl.addEnvironment(NamingResourcesImpl.java:303)
        at org.apache.tomee.catalina.OpenEJBNamingResource.addEnvironment(OpenEJBNamingResource.java:78)
        at org.apache.tomee.catalina.TomcatJndiBuilder.mergeRef(TomcatJndiBuilder.java:403)
        at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJndi(TomcatJndiBuilder.java:125)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1394)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5007)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1651)
        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 org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1571)
    at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:294)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:212)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:607)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:685)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
4

1 回答 1

0

此应用程序使用元素中的条目从 Web 应用程序根目录之外的目录提供图像文件,以供此处引用的 tomcat 的 server.xml 应用程序从 Tomcat 提供静态文件

<Host name="www.example.com" appBase="webapps"
                 unpackWARs="true" autoDeploy="true" >
    <Alias>example.com</Alias>
    <Valve className="org.apache.catalina.valves.AccessLogValve" 
        directory="logs"
        prefix="oneme_access_log." suffix=".txt"
        pattern="%h %l %u %t &quot;%r&quot; %s %b" />

    <Context docBase="/var/www/html/example/media" 
            path="/myapp/media" 
            reloadable="true" />
</Host>

问题已解决(按此顺序)

  1. 删除应用程序战争文件
  2. 清理在 sprint 期间输入的不必要的 Maven 依赖项
  3. 注释掉元素
  4. 停止并重新启动 Tomcat
  5. 取消注释元素
  6. 停止并重新启动 Tomcat

在上述每个步骤之后都尝试了部署。我没有解释为什么会这样。该应用程序先前已正确部署,然后在 sprint 之后,它会给出上述错误。我怀疑 Maven 添加的冲突 jar 以某种方式扰乱了 Tomcat 的状态。

希望分享这有助于某人。

于 2019-03-29T14:01:22.247 回答