5

我以为我收到了这个错误,因为我没有ojdbc14.jar部署 inside <jbossas.home>/common/lib。即使我这样做了,问题仍然存在。

堆栈跟踪

    HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
    org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
    gov.medicaid.services.impl.RegistrationServiceBean.findByUsername(RegistrationServiceBean.java:156)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

root cause

org.hibernate.exception.GenericJDBCException: Cannot open connection
    org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
    org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
    org.hibernate.loader.Loader.doQuery(Loader.java:696)

root cause

org.jboss.util.NestedSQLException: Unable to get managed connection for MitaDS; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for MitaDS)
    org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
    org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)

root cause

javax.resource.ResourceException: Unable to get managed connection for MitaDS
    org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:441)
    org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
    org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
    org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
    org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
    org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
    org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)

root cause

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception: The Network Adapter could not establish the connection)
    org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
    org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
    org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
    org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
    org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
    org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
    org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
    org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
    org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
    org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
    org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
    org.hibernate.loader.Loader.doQuery(Loader.java:696)
    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    org.hibernate.loader.Loader.doList(Loader.java:2228)
    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    org.hibernate.loader.Loader.list(Loader.java:2120)
    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)

root cause

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
    oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
    oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
    oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:207)
    org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
    org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
    org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
    org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
    org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
    org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
    org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
    org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
    org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
    org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
    org.hibernate.loader.Loader.doQuery(Loader.java:696)
    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    org.hibernate.loader.Loader.doList(Loader.java:2228)
    org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    org.hibernate.loader.Loader.list(Loader.java:2120)
    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
    org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
    org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
    gov.medicaid.services.impl.RegistrationServiceBean.findByUsername(RegistrationServiceBean.java:156)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

note The full stack trace of the root cause is available in the JBoss Web/2.1.3.GA logs.

JBoss Web/2.1.3.GA
4

4 回答 4

8

这里的问题是:

org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception: The Network Adapter could not establish the connection)

这通常意味着由于数据库服务器不可用或 jboss 服务器和数据库服务器之间的基础网络问题,您的数据库连接失败。

于 2013-04-15T16:52:35.600 回答
3

问题是你如何声明你的数据库配置,jdbc,url,用户,通行证,驱动程序......因此服务器拒绝连接......

于 2013-04-15T18:52:06.717 回答
0

请检查您的 JBoss 服务器配置文件,您可以在其中找到与“MaxConnectionPoolSize”相同的“InUSeConnectionCount”。如果发生这种情况,这意味着您的所有连接都已用完,并且当前没有可以处理您的请求的连接。请刷新您的连接池,然后重试。它肯定会工作:)。

于 2014-03-24T07:30:10.207 回答
0

通常,当您的查询准备出错时,即当您通过连接错误数据类型的字符串以编程方式构建查询时(或)数据库已关闭(或)如果查询因某些异常而执行失败,则通常会出现此问题,然后我们曾经得到 GenericJDBCException。首先尝试检查您的连接,然后验证您准备的查询是否正确。或者,如果可能,您可以在数据库客户端中运行查询。干杯...

于 2015-12-01T17:13:25.043 回答