欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

springBoot生成jar包,部署linux系统(一)

程序员文章站 2024-02-02 10:55:22
...

1、配置pom.xml文件
springBoot生成jar包,部署linux系统(一)
2、生成jar包
springBoot生成jar包,部署linux系统(一)
3、拷贝jar包到linux服务器进行解压
1)首先查看端口有没有被占用

[root@localhost demo]# netstat -lanp|grep 8888
tcp        0      0 :::8888                     :::*                        LISTEN      4601/java

发现被占用,解决方式有两种
一、杀进程

[root@localhost demo]# kill -9 4601

二、修改application.properties的端口号

2)启动jar包

[root@localhost demo]# nohup java -jar demo-1.0.1.jar >springboot.log 2>&1 &

3)查看日志

[root@localhost demo]# tail -f springboot.log
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::  (v1.5.14.BUILD-SNAPSHOT)

2018-08-15 02:09:12.456  INFO 4897 --- [           main] com.example.DemoApplication              : Starting DemoApplication v1.0.1 on localhost with PID 4897 (/opt/project/demo/demo-1.0.1.jar started by root in /opt/project/demo)
2018-08-15 02:09:12.471  INFO 4897 --- [           main] com.example.DemoApplication              : The following profiles are active: demo
2018-08-15 02:09:12.776  INFO 4897 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@77a567e1: startup date [Wed Aug 15 02:09:12 PDT 2018]; root of context hierarchy
2018-08-15 02:09:18.002  INFO 4897 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5e9d3438] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-08-15 02:09:19.630  INFO 4897 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8888 (http)
2018-08-15 02:09:19.750  INFO 4897 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-08-15 02:09:19.757  INFO 4897 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.31
2018-08-15 02:09:20.050  INFO 4897 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-08-15 02:09:20.051  INFO 4897 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 7286 ms
2018-08-15 02:09:20.788  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-08-15 02:09:20.809  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'statViewServlet' to [/druid/*]
2018-08-15 02:09:20.819  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-08-15 02:09:20.819  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-08-15 02:09:20.823  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-08-15 02:09:20.826  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-08-15 02:09:20.827  INFO 4897 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webStatFilter' to urls: [/*]
2018-08-15 02:09:20.971  INFO 4897 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2018-08-15 02:09:23.316  INFO 4897 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
2018-08-15 02:09:23.819  INFO 4897 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-08-15 02:09:23.888  INFO 4897 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default

4)在浏览器地址栏输入项目地址,访问项目检查是否部署成功