当应用程序中的负载非常高时,我从jboss服务器收到以下错误。当出现此错误时,应用程序在几次连接重置和应用程序恢复后都没有处理任何请求。
DEBUG Periodic recovery - first pass <Tue, 7 Feb 2017 13:01:59>
[Thread-12] [2017-02-07 13:01:59,029] DEBUG StatusModule: first pass
[Thread-12] [2017-02-07 13:01:59,029] DEBUG [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
[Thread-12] [2017-02-07 13:01:59,030] DEBUG [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
[Thread-12] [2017-02-07 13:02:09,030] DEBUG Periodic recovery - second pass <Tue, 7 Feb 2017 13:02:09>
[Thread-12] [2017-02-07 13:02:09,030] DEBUG AtomicActionRecoveryModule: Second pass
[Thread-12] [2017-02-07 13:02:09,030] DEBUG [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
[Thread-12] [2017-02-07 13:02:09,030] DEBUG [com.arjuna.ats.internal.jta.recovery`enter code here`.info.secondpass] Local XARecoveryModule - second pass
[Thread-12] [2017-02-07 13:02:09,030] DEBUG Recover java:/DefaultJMSProvider
[Thread-12] [2017-02-07 13:02:09,031] DEBUG ********************************Failed to connect to server
javax.naming.NameNotFoundException: XAConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.util.naming.Util.lookup(Util.java:222)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getConnectionFactory(MessagingXAResourceWrapper.java:393)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.connect(MessagingXAResourceWrapper.java:339)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:261)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.recover(MessagingXAResourceWrapper.java:108)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:773)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecovery(XARecoveryModule.java:665)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:200)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:799)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:412)
[Thread-12] [2017-02-07 13:02:09,031] DEBUG Cannot get delegate XAResource
javax.transaction.xa.XAException: Error trying to connect to provider java:/DefaultJMSProvider
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:271)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.recover(MessagingXAResourceWrapper.java:108)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:773)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecovery(XARecoveryModule.java:665)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:200)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:799)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:412)
Caused by: javax.naming.NameNotFoundException: XAConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.util.naming.Util.lookup(Util.java:222)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getConnectionFactory(MessagingXAResourceWrapper.java:393)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.connect(MessagingXAResourceWrapper.java:339)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:261)
在观察到以下警告后
WARN Destroying connection that is not valid, due to the following exception: oracle.jdbc.driver.T4CConnection@43017c6e
java.sql.SQLException: pingDatabase failed status=-2
at org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker.isValidConnection(OracleValidConnectionChecker.java:74)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:560)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:323)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:402)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:225)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:424)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
at com.infosys.fdc.util.ConnectionManager.getConnectionFromPool(ConnectionManager.java:382)
at com.infosys.fdc.util.ConnectionManager.getConnection(ConnectionManager.java:507)
at com.infosys.fdc.ejb.CommonEJBBean.execute(CommonEJBBean.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:100)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:84)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1092)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
at $Proxy125.execute(Unknown Source)
答案 0 :(得分:5)
java.sql.SQLException: pingDatabase failed status=-2
这意味着Oracle数据库本身或网络存在“某些”错误。
pingDatabase是oracle.jdbc.OracleConnection的一种方法,JBoss OracleValidConnectionChecker使用它来检查与数据库的连接是否仍然有效并正常工作。
根据Oracle Database JBDC Driver API doc - 常量字段值,返回码为:
DATABASE_OK = 0; //未关闭物理数据库连接,并且可以访问数据库。 (不会被记录)
DATABASE_CLOSED = -1; //物理数据库连接已关闭。
DATABASE_NOTOK = -2; //物理数据库连接未关闭,但无法访问数据库。
DATABASE_TIMEOUT = -3 //在收到任何肯定或否定确认之前,通话已超时。
使用ping,telnet,ssh等连接测试等常用方法测试网络。
检查您的DNS名称解析是否正常;如有疑问,请使用IP地址而不是主机名。
使用Oracle tnsping实用程序或SQL * plus测试与Oracle数据库的连接是否正常。 注意:需要安装本机Oracle客户端。
JBoss仅报告来自Oracle JDBC驱动程序的此错误。根本原因可能是Oracle数据库本身,也可能是网络。
升级Oracle JDBC驱动程序。我们已经看到很多报道解决了这个问题。似乎旧驱动程序有一个错误,可能导致返回代码“-2”。
要找到根本原因,需要使用Oracle,因为此错误来自Oracle驱动程序,并且仅由JBoss报告。 该错误表明JBoss应用程序服务器和数据库
这很可能是由于网络或数据库服务器本身的问题。有时,此类问题是暂时的,但是,如果此问题仍然存在,您将需要让您的网络和/或DBA小组参与审核问题。
强烈建议您使用TRACE日志与Oracle联系并从中获取输入。
答案 1 :(得分:2)
计算机科学101.减轻服务器的负担。我的团队开发了一些演示来显示大量连接对您的数据库的影响,您可以在此处看到它的视频:https://www.youtube.com/watch?v=XzN8Rp6glEo