当前位置: 首页 > 知识库问答 >
问题:

Sping引导Java后端应用程序进程被杀死

赵健柏
2023-03-14

日志:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.2.RELEASE)

2020-01-26 07:40:36.423  INFO 8144 --- [           main] d.c.c.CarorderprocessApplication         : Starting CarorderprocessApplication v0.0.1-SNA
PSHOT on dedi1055.your-server.de with PID 8144 (/usr/www/users/waqfek/software_backend/carorderprocess-0.0.1-SNAPSHOT.jar started by waqfek in /us
r/www/users/waqfek/software_backend)
2020-01-26 07:40:36.426  INFO 8144 --- [           main] d.c.c.CarorderprocessApplication         : No active profile set, falling back to default
 profiles: default
2020-01-26 07:40:36.487  INFO 8144 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servle
t.context.AnnotationConfigServletWebServerApplicationContext@5cbc508c: startup date [Sun Jan 26 07:40:36 CET 2020]; root of context hierarchy
2020-01-26 07:40:37.614  INFO 8144 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotati
on.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerB
ySpringCGLIB$$d289c8bd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-01-26 07:40:37.915  INFO 8144 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2020-01-26 07:40:37.939  INFO 8144 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-01-26 07:40:37.940  INFO 8144 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.31
2020-01-26 07:40:37.949  INFO 8144 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library whi
ch allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib/x86_64-lin
ux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
2020-01-26 07:40:38.014  INFO 8144 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationCon
text
2020-01-26 07:40:38.014  INFO 8144 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization com
pleted in 1530 ms
2020-01-26 07:40:38.159  INFO 8144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to:
[/*]
2020-01-26 07:40:38.159  INFO 8144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [
/*]
2020-01-26 07:40:38.159  INFO 8144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to:
 [/*]
2020-01-26 07:40:38.159  INFO 8144 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*
]
2020-01-26 07:40:38.160  INFO 8144 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to
: [/*]
2020-01-26 07:40:38.160  INFO 8144 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2020-01-26 07:40:38.302  INFO 8144 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-01-26 07:40:38.306  WARN 8144 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2020-01-26 07:40:38.491  INFO 8144 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-01-26 07:40:38.534  INFO 8144 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2020-01-26 07:40:38.548  INFO 8144 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
        name: default
        ...]
2020-01-26 07:40:38.625  INFO 8144 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.17.Final}
2020-01-26 07:40:38.627  INFO 8144 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2020-01-26 07:40:38.661  INFO 8144 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2020-01-26 07:40:38.824  INFO 8144 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2020-01-26 07:40:39.086  INFO 8144 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-01-26 07:40:39.172  INFO 8144 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-01-26 07:40:39.406  INFO 8144 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5cbc508c: startup date [Sun Jan 26 07:40:36 CET 2020]; root of context hierarchy
2020-01-26 07:40:39.444  WARN 8144 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-01-26 07:40:39.492  INFO 8144 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-01-26 07:40:39.494  INFO 8144 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-01-26 07:40:39.526  INFO 8144 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-01-26 07:40:39.526  INFO 8144 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-01-26 07:40:39.867  INFO 8144 --- [           main] .s.s.UserDetailsServiceAutoConfiguration :

Using generated security password: 8167df1e-24d1-4ebf-bb03-53e2385a1229

2020-01-26 07:40:40.030  INFO 8144 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@d2de489, org.springframework.security.web.context.SecurityContextPersistenceFilter@28cda624, org.springframework.security.web.header.HeaderWriterFilter@5340477f, org.springframework.security.web.csrf.CsrfFilter@6f15d60e, org.springframework.security.web.authentication.logout.LogoutFilter@71687585, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@66ea810, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@5276d6ee, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@2f953efd, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@7eecb5b8, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@475c9c31, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@14bdbc74, org.springframework.security.web.session.SessionManagementFilter@7139992f, org.springframework.security.web.access.ExceptionTranslationFilter@446a1e84, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@169bb4dd]
2020-01-26 07:40:40.112  INFO 8144 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2020-01-26 07:40:40.113  INFO 8144 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'dataSource' has been autodetected for JMX exposure
2020-01-26 07:40:40.118  INFO 8144 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2020-01-26 07:40:40.142  INFO 8144 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2020-01-26 07:40:40.145  INFO 8144 --- [           main] d.c.c.CarorderprocessApplication         : Started CarorderprocessApplication in 4.002 seconds (JVM running for 4.521)
Killed

...

top - 08:51:43 up 137 days, 11:30,  2 users,  load average: 0.86, 0.39, 0.30
Tasks:   4 total,   1 running,   3 sleeping,   0 stopped,   0 zombie
%Cpu(s): 30.7 us,  0.9 sy,  0.0 ni, 68.1 id,  0.2 wa,  0.0 hi,  0.1 si,  0.0 st
KiB Mem : 16119112 total,  4416660 free,  7332300 used,  4370152 buff/cache
KiB Swap:  4194300 total,  3625572 free,   568728 used.  8221460 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
20338 waqfek    20   0 7069792 299952  16808 S 247.5  1.9   0:07.45 java
16765 waqfek    20   0   38960   3032   2704 R   0.0  0.0   0:00.57 top
27373 waqfek    20   0   14092   3600   3048 S   0.0  0.0   0:00.16 bash
28746 waqfek    20   0   14072   3524   2988 S   0.0  0.0   0:00.00 bash

我的项目中只有三个文件:

package ...

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class CarorderprocessApplication {
    public static void main(String[] args) {
        SpringApplication.run(CarorderprocessApplication.class, args);
    }
}
<dependencyManagement>
    <dependencies>

    </dependencies>
</dependencyManagement>


<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-jdbc</artifactId>
       <version>2.2.1.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.17</version>
    </dependency>

    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0.2</version>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.5.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

共有1个答案

陈松
2023-03-14

一些需要检查的想法:

  1. 尝试独立运行:java-jar yourapp.jar&
  2. 尝试(仅一次)在root下运行
  3. 查看logs:journalctl-ex以了解到底是谁杀死了您的应用程序。

取决于结果,可以计划下一步-通常是调整哪些设置。

 类似资料:
  • 问题内容: 我想知道如何“杀死”已启动的过程。我知道Process API,但是不确定,是否可以使用它来杀死已经运行的进程,例如firefox.exe等。如果可以使用Process API,可以请您指向正确的方向?如果没有,还有哪些其他可用选项?谢谢。 问题答案: 如果你从Java应用程序中以从头开始处理(例如,通过调用或),那么你将对其具有有效的引用,并且可以在Process类中调用该方法以终止

  • 错误: 内存不足,Java运行时环境无法继续。本机内存分配(mmap)无法映射71827456字节以提交保留内存。可能的原因:系统在32位模式下没有物理RAM或交换空间,遇到了进程大小限制。可能的解决方案:减少系统上的内存负载增加物理内存或交换空间检查交换备份存储是否已满在64位OS上使用64位Java减少Java堆大小(-xmx/-xms)减少Java线程数量减少Java线程堆栈大小(-xs)设

  • 我正试图通过后台获取从url获取数据。My func尝试获取数据,如果有新数据,它会发送本地通知。当我最小化应用程序时,背景提取在大约10-20分钟后工作。但当我关闭应用程序(双击home按钮并关闭应用程序)时,它就不起作用了。我等了大约一个小时,但没有成功。我正在Android系统中使用后台服务,它正在成功运行。当应用程序关闭时,有没有办法从url获取数据并发送本地通知?我使用的是Xcode 6

  • 问题内容: 在生产环境中运行Express应用程序时,我想在服务器进程被杀死(即,发送SIGTERM或SIGINT)时正常关闭服务器。 这是我的代码的简化版本: 当我运行它并在浏览器中调用URL http:// localhost:3000 / 时,setInterval函数中的log语句将一直打印“当前打开1个连接”,直到我真正关闭浏览器窗口为止。显然,即使关闭选项卡也会使连接保持打开状态。 因

  • 我刚下载了Android Studio,所以所有的东西都是新安装的,但我一直在得到AVD的错误仿真程序被杀死,: null