You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/08/17 14:14:37 UTC

[GitHub] [servicecomb-java-chassis] lioil9 opened a new issue #2514: 以springboot外置tomcat, REST over Servlet形式指定cse监听器,会报空指针异常然后直接退出服务

lioil9 opened a new issue #2514:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2514


   错误信息:
   ```log
   17-Aug-2021 22:07:40.707 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath
   17-Aug-2021 22:07:43.395 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
   17-Aug-2021 22:08:03.800 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart 异常将上下文初始化事件发送到类的侦听器实例.[org.apache.servicecomb.transport.rest.servlet.RestServletContextListener]
   	java.lang.Error: java.lang.**NullPointerException**
   		at org.apache.servicecomb.transport.rest.servlet.RestServletContextListener.contextInitialized(RestServletContextListener.java:33)
   		at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768)
   		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230)
   		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
   		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
   		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
   		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
   		at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1783)
   		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:293)
   		at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
   		at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
   		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:460)
   		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:408)
   		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:293)
   		at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
   		at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
   		at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
   		at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
   		at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
   		at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
   		at java.security.AccessController.doPrivileged(Native Method)
   		at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
   		at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
   		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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
   		at sun.rmi.transport.Transport$1.run(Transport.java:200)
   		at sun.rmi.transport.Transport$1.run(Transport.java:197)
   		at java.security.AccessController.doPrivileged(Native Method)
   		at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
   		at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
   		at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
   		at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
   		at java.security.AccessController.doPrivileged(Native Method)
   		at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
   		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   		at java.lang.Thread.run(Thread.java:748)
   	Caused by: java.lang.NullPointerException
   		at org.apache.servicecomb.transport.rest.servlet.RestServletInjector.inject(RestServletInjector.java:56)
   		at org.apache.servicecomb.transport.rest.servlet.RestServletInjector.defaultInject(RestServletInjector.java:38)
   		at org.apache.servicecomb.transport.rest.servlet.ServletUtils.init(ServletUtils.java:176)
   		at org.apache.servicecomb.transport.rest.servlet.CseXmlWebApplicationContext.invokeBeanFactoryPostProcessors(CseXmlWebApplicationContext.java:60)
   		at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
   		at org.apache.servicecomb.transport.rest.servlet.RestServletContextListener.initSpring(RestServletContextListener.java:39)
   		at org.apache.servicecomb.transport.rest.servlet.RestServletContextListener.contextInitialized(RestServletContextListener.java:31)
   		... 47 more
   17-Aug-2021 22:08:03.800 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
   ```
   
   web.xml配置
   ```xml
   <context-param>
           <param-name>contextConfigLocation</param-name>
           <param-value>classpath*:META-INF/spring/*.bean.xml</param-value>
       </context-param>
       <listener>
           <listener-class>org.apache.servicecomb.transport.rest.servlet.RestServletContextListener</listener-class>
       </listener>
   ```
   
   springboot启动类配置
   ```
   @SpringBootApplication()
   @EnableServiceComb
   public class CseTestApplication extends SpringBootServletInitializer {
       public static void main(String[] args) {
           SpringApplication.run(CseTestApplication.class, args);
       }
   
       @Override
       protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
           return builder.sources(this.getClass());
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2514: 以springboot外置tomcat, REST over Servlet形式指定cse监听器,会报空指针异常然后直接退出服务

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2514:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2514#issuecomment-900744712


   可以看看这个例子: https://github.com/apache/servicecomb-samples/tree/master/java-chassis-deployment-samples/spring-boot-external-tomcat
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2514: 以springboot外置tomcat, REST over Servlet形式指定cse监听器,会报空指针异常然后直接退出服务

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2514:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2514#issuecomment-900744712


   可以看看这个例子: https://github.com/apache/servicecomb-samples/tree/master/java-chassis-deployment-samples/spring-boot-external-tomcat
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org