各路大神,小弟近日遇到个比较棘手的问题。在window中部署了应用,使用undertow作为服务器。
将启动脚本配置到了 service 服务中,并且设置了自动启动。
服务器停电重启后,yhis2自动启动失败,原因是数据库连接失败,日志报错如下:
2021-03-09 08:28:40 Apache Commons Daemon procrun stderr initialized. java.lang.RuntimeException: Plugin start error: com.jfinal.plugin.activerecord.ActiveRecordPlugin. java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress at com.jfinal.core.Config.startPlugins(Config.java:137) at com.jfinal.core.Config.configPluginWithOrder(Config.java:71) at com.jfinal.core.Config.configJFinal(Config.java:59) at com.jfinal.core.JFinal.init(JFinal.java:61) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:64) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:111) at io.undertow.servlet.core.ManagedFilter.createFilter(ManagedFilter.java:80) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:594) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:559) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:601) at com.jfinal.server.undertow.UndertowServer.configHttp(UndertowServer.java:287) at com.jfinal.server.undertow.UndertowServer.doStart(UndertowServer.java:265) at com.jfinal.server.undertow.UndertowServer.start(UndertowServer.java:158) at com.zshsoft.application.Application.main(Application.java:18) Caused by: com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:55) at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226) at com.jfinal.core.Config.startPlugins(Config.java:128) ... 15 more Caused by: java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382) at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:441) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:404) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:385) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:787) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1646) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710) at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:939) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1376) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1372) at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:109) at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43) ... 17 more
百度了下,说服务可以设置依赖关系,先启动A服务,再启动B服务,但也有一个缺点,如果A服务停止,B也会受影响。
Tomcat服务没有这个情况,请问下大家,undertow如何配置,用法也能跟Tomcat一样,可顺利自动重启?