1、以守护进程方式运行SpringBoot项目
问题:
如果使用java -jar
启动项目,当前窗口被占用,无法退出,而且若关闭远程连接窗口,启动的项目又会关闭
解决方法:
以守护进程方式运,把产生的日志记录在logs.txt
文件中
nohup java -jar bookstoreAPI.jar >logs.txt &
自动生成logs.txt
文件,可使用cat logs.txt
命令查看日志
查看进程命令jobs
:
结束进程方法:
netstat -anp | grep 8081
kill 9 3327
2、部署到Linux上的SpringBoot项目,登录接口里Session创建时间太长
问题:
访问登录接口,request.getSession()
方法卡住,很慢,并且报错:
Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [239,389] milliseconds.
解决方法:
打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:
securerandom.source=file:/dev/random
将其改成:
securerandom.source=file:/dev/./urandom
参考文章:tomcat启动慢, Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil