无法在 Websphere 上使用 PostgreSQL 配置 EJB 计时器

Can't configure EJB Timers with PostgreSQL on Websphere

我在 Websphere 容器上部署了一个应用程序,并通过容器配置了 EJB Timer 调度程序。

我配置了 oracle 数据库,一切正常。

现在我正在尝试将数据库从 Oracle 更改为 postgres SQL 并完成所有需要的工作,包括创建新的数据源、驱动程序等。 Websphere 确实设法通过数据源连接到数据库。 我使用与我的 oracle 数据库相同的 Jndi,因此代码中不需要额外的工作。

当我尝试启动应用程序并安装新的 EAR 文件时,出现以下异常:

WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=localhostNode01,version=8.5.5.10,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=localhostNode01Cell,spec=1.0 exception is: javax.management.MBeanException: Exception thrown in RequiredModelMBean while trying to invoke operation startApplication at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1304) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814) at com.ibm.ws.management.AdminServiceImpl.run(AdminServiceImpl.java:1350) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243) at com.ibm.ws.management.application.AppManagementImpl._startApplication(AppManagementImpl.java:1482) at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1371) at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1320) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:88) at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:292) at javax.management.modelmbean.RequiredModelMBean.run(RequiredModelMBean.java:1261) at java.security.AccessController.doPrivileged(AccessController.java:422) at java.security.ProtectionDomain.doIntersectionPrivilege(ProtectionDomain.java:88) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1093) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:832) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:814) at com.ibm.ws.management.AdminServiceImpl.run(AdminServiceImpl.java:1350) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243) at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:488) at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:324) at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:65) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:733) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:522) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892) Caused by: com.ibm.ws.exception.RuntimeError: com.ibm.websphere.csi.EJBContainerException: EJB Timer Service not started at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.startModule(AbstractEJBRuntime.java:731) at com.ibm.ws.ejbcontainer.runtime.SharedEJBRuntimeImpl.startModule(SharedEJBRuntimeImpl.java:338) at com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:3588) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1179) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1390) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:979) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:778) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1381) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2192) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access0(CompositionUnitMgrImpl.java:126) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.run(CompositionUnitMgrImpl.java:653) at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5396) at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5612) at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:667) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:611) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1271) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:88) at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:292) at javax.management.modelmbean.RequiredModelMBean.run(RequiredModelMBean.java:1261) at java.security.AccessController.doPrivileged(AccessController.java:422) at java.security.ProtectionDomain.doIntersectionPrivilege(ProtectionDomain.java:88) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1255) ... 38 more Caused by: com.ibm.websphere.csi.EJBContainerException: EJB Timer Service not started at com.ibm.ws.runtime.component.EJBContainerImpl.getSchedulerInstance(EJBContainerImpl.java:2082) at com.ibm.ws.runtime.component.EJBContainerImpl.initializeTimerService(EJBContainerImpl.java:1827) at com.ibm.ws.runtime.component.WASEJBRuntimeImpl.initializeTimerService(WASEJBRuntimeImpl.java:540) at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.startModule(AbstractEJBRuntime.java:575) ... 71 more Caused by: com.ibm.ws.scheduler.exception.SchedulerDataStoreException: com.ibm.ws.extensionhelper.exception.UnknownDatabaseException: Could not detect database vendor. Vendor string was PostgreSQL at com.ibm.ws.scheduler.WASSchedulerCfgHelper.createTables(WASSchedulerCfgHelper.java:546) at com.ibm.ws.runtime.component.EJBContainerImpl.createTimerTables(EJBContainerImpl.java:2712) at com.ibm.ws.runtime.component.EJBContainerImpl.getSchedulerInstance(EJBContainerImpl.java:2025) ... 74 more Caused by: com.ibm.ws.extensionhelper.exception.UnknownDatabaseException: Could not detect database vendor. Vendor string was PostgreSQL at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.connect(DatabaseHelperImpl.java:672) at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.initialize(DatabaseHelperImpl.java:501) at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.(DatabaseHelperImpl.java:261) at com.ibm.ws.extensionhelper.impl.ExtensionHelperServiceImpl.getDatabaseHelper(ExtensionHelperServiceImpl.java:116) at com.ibm.ws.scheduler.DBHelperImpl.(DBHelperImpl.java:108) at com.ibm.ws.scheduler.WASSchedulerCfgHelper.getDatabaseHelper(WASSchedulerCfgHelper.java:959) at com.ibm.ws.scheduler.WASSchedulerCfgHelper.createTables(WASSchedulerCfgHelper.java:541) ... 76 more

[10/3/17 16:19:42:601 IDT] 00000067 ServletWrappe

我认为在摆脱 IBM 调度程序并移动 EJB 标准计时器后,我不会得到这个异常。

知道我该如何克服这个问题吗?

EJB 持久性计时器的实现仍然由数据库支持,因此能力受到应用服务器与哪些数据库供应商具有内置互操作性的限制(SQL 命令在不同数据库供应商之间差异很大) .传统的 WebSphere Application Server 没有为 EJB 持久计时器(或其调度程序)内置与 PostgreSQL 的互操作性,这就是您看到错误的原因:

UnknownDatabaseException: Could not detect database vendor. Vendor string was PostgreSQL

就是说,您可以让 PostgreSQL 为 WebSphere Application Server Liberty 上的 EJB 持久性计时器工作(而不是传统的),因为 Liberty 实现是基于 JPA 而不是 SQL.