web-dev-qa-db-ja.com

接続例外を開くことができません:一般的なJDBC例外

ojdbc14.jar内に<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
5
AppSensei

ここでの問題は:

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

これは通常、データベースサーバーが使用できないか、jbossサーバーとデータベースサーバー間の基になるネットワークの問題が原因で、データベース接続に失敗したことを意味します。

8
CoolBeans

問題は、サーバーが接続を拒否している理由で、db構成、jdbc、url、user、pass、driverをどのように宣言するかです...

3
elopez

通常、この問題は、クエリの準備が失敗した場合、つまり、誤ったデータ型の文字列を連結してプログラムでクエリを構築している場合(または)データベースがダウンしている場合(または)クエリがなんらかの例外で実行に失敗した場合、GenericJDBCExceptionを取得するために使用しました。最初に接続を確認し、後で準備したクエリが正しいかどうかを確認します。または、可能であれば、データベースクライアントでクエリを実行することもできます。乾杯...

0
SatyaMylavarapu

「MaxConnectionPoolSize」と同じ「InUSeConnectionCount」が見つかるJBossサーバー設定ファイルを確認してください。これが発生した場合、これはすべての接続が使い果たされており、現在リクエストを処理できる接続が存在しないことを意味します。接続プールをフラッシュして、再試行してください。それはきっと動作します:)。

0
Manoj Pal