为什么在ubuntu 14.04 aws VM上1-2小时后,嵌入式tomcat上运行的spring boot应用程序会自动关闭?

时间:2016-08-13 06:34:35

标签: java spring tomcat spring-boot

我部署了我的spring-boot应用程序 mvn spring-boot:run>server.log&java -jar target/myapp.jar>server.log&

我在一个实例上遇到此问题,在我启动应用程序后,一切正常,几小时后应用程序自动关闭。 java.lang.NoSuchFieldError: IS_SECURITY_ENABLED开始显示我将pom从使用underow改为tomcat。但除了这个错误,我的应用程序也启动,一切正常。如下面的日志所示,应用程序在11:42开始运行并且运行正常,直到13:11然后在14:01自动关闭

在这个实例中唯一不同的是我在这个实例中启用了MongoDB身份验证,但是我能够使用Spring应用程序成功连接并执行操作。所以这似乎不是问题。

2016-08-12 11:42:06.334  INFO 10655 --- [           main] c.m.s.s.ApiListingReferenceScanner       : Created resource listing Path: /v1/store-test-controller Description: store-test-controller Position: 0
2016-08-12 11:42:06.726  INFO 10655 --- [           main] c.m.s.core.SwaggerApiResourceListing     : Added a resource listing with (4) api resources: 
2016-08-12 11:42:06.728  INFO 10655 --- [           main] c.m.s.core.SwaggerApiResourceListing     :   Basic Error Controller at location: /api-docs/v1/basic-error-controller
2016-08-12 11:42:06.728  INFO 10655 --- [           main] c.m.s.core.SwaggerApiResourceListing     :   Store Admin Controller at location: /api-docs/v1/store-admin-controller
2016-08-12 11:42:06.728  INFO 10655 --- [           main] c.m.s.core.SwaggerApiResourceListing     :   Store Controller at location: /api-docs/v1/store-controller
2016-08-12 11:42:06.728  INFO 10655 --- [           main] c.m.s.core.SwaggerApiResourceListing     :   Store Test Controller at location: /api-docs/v1/store-test-controller
2016-08-12 11:42:06.782  INFO 10655 --- [           main] org.mortbay.log                          : Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
2016-08-12 11:42:06.799 ERROR 10655 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : StandardWrapper.Throwable

java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
    at org.apache.jasper.compiler.JspRuntimeContext.(JspRuntimeContext.java:197)
    at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:150)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:68)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:217)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
    at com.XXXXXXXXX.XXXXXXXXXXXApplication.main(XXXXXXXXXXXXXXApplication.java:27)
    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.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
    at java.lang.Thread.run(Thread.java:745)

2016-08-12 11:42:06.800 ERROR 10655 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Servlet [jsp] in web application [] threw load() exception

java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
    at org.apache.jasper.compiler.JspRuntimeContext.(JspRuntimeContext.java:197)
    at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:150)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:68)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:217)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
    at XXXXXXXXXXXXXXXXXXApplication.main(XXXXXXXXXXXXXXXXApplication.java:27)
    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.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
    at java.lang.Thread.run(Thread.java:745)

2016-08-12 11:42:06.800  INFO 10655 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-08-12 11:42:06.804  INFO 10655 --- [           main] XXXXXXXXXXXXXXXApplication    : Started XXXXXXXXXXApplication in 9.466 seconds (JVM running for 15.018)
2016-08-12 11:42:12.464  INFO 10655 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-08-12 11:42:12.465  INFO 10655 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-08-12 11:42:12.475  INFO 10655 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 10 ms
2016-08-12 11:46:25.459  INFO 10655 --- [nio-8080-exec-7] c.n.s.s.impl.StoreCustomerServiceImpl    : UPDATE:: Customer Found Updating
2016-08-12 11:47:05.382  INFO 10655 --- [nio-8080-exec-3] c.n.s.s.impl.StoreCustomerServiceImpl    : UPDATE:: Customer Found Updating
2016-08-12 11:47:41.494  INFO 10655 --- [nio-8080-exec-6] c.n.s.s.impl.StoreCustomerServiceImpl    : UPDATE:: Customer Found Updating
2016-08-12 13:11:02.357  INFO 10655 --- [nio-8080-exec-3] c.n.s.s.impl.StoreCustomerServiceImpl    : UPDATE:: Customer Found Updating
2016-08-12 14:01:55.661  INFO 10655 --- [       Thread-4] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@a68229f: startup date [Fri Aug 12 11:41:57 UTC 2016]; root of context hierarchy
2016-08-12 14:01:55.664  INFO 10655 --- [       Thread-4] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2016-08-12 14:01:55.677  INFO 10655 --- [       Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:20:02.877s
[INFO] Finished at: Fri Aug 12 14:01:55 UTC 2016

的pom.xml

<modelVersion>4.0.0</modelVersion>

<groupId>XXXXXXXX</groupId>
<artifactId>XXXXXXXXX</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.6.RELEASE</version>
    <relativePath />
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>com.mangofactory</groupId>
        <artifactId>swagger-springmvc</artifactId>
        <version>1.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.7</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp</groupId>
        <artifactId>okhttp</artifactId>
        <version>2.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-ws</artifactId>
    </dependency>
    <dependency>
        <groupId>net.jcip</groupId>
        <artifactId>jcip-annotations</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-core</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-cypher-compiler-2.1</artifactId>
        <version>2.1.8</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-cypher-compiler-2.2</artifactId>
        <version>2.2.5</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案