bash status.sh =============================================================================================== Server com.webank.webase.front.Application Port 5002 is running PID(4587) ===============================================================================================
yjm@yjm-VMware-Virtual-Platform:~/webase-front$ sudo netstat -anlp | grep 5002 没有端口信息输出
此时可以查看log文件夹下的WeBASE-front.log,找到报错信息如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-04-09 19:51:16.519 [main] ERROR SpringApplication() - Application run failed java.lang.IllegalStateException: Failed to execute CommandLineRunner Caused by: org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement: INFO LocalContainerEntityManagerFactoryBean() - Closing JPA EntityManagerFactory for persistence unit 'default' 2025-04-09 19:51:16.563 [main] INFO HikariDataSource() - HikariPool-1 - Shutdown initiated... 2025-04-09 19:51:16.570 [main] INFO HikariDataSource() - HikariPool-1 - Shutdown completed.
解决方案:(注意更换自己问件路径,我的webase-front目是在/home/yjm文件夹下)
# 强制停止残留进程
sudo pkill -9 -f "com.webank.webase.front.Application"
# 确认无相关进程
ps -ef | grep webase-front
# 删除锁文件(关键步骤) sudo rm -f /home/yjm/webase-front/h2/*.lock.db sudo rm -f /home/yjm/webase-front/h2/*.trace.db
修改配置文件sudo nano /home/yjm/webase-front/conf/application.yml
spring:
datasource:
url: jdbc:h2:file:/home/yjm/webase-front/h2/webasefront;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE # 添加AUTO_SERVER
hikari:
connection-init-sql: "SET MODE MySQL" # 添加此配置
再启动服务
bash start.sh
# 实时查看日志
tail -f log/Webase-Front.log