EbサービスクラスからOracle
データベースに接続するJava EEアプリケーションを開発しようとしていますが、
SQLException: No suitable driver found for jdbc:Oracle:thin:@//localhost:1521/orcl
私が持っています ojdbc6.jar
はクラスパスにあり、JBoss
展開フォルダーにあることも確認しました。
私のアプリケーションEAR
はWAR
で構成されています。これの何が問題なのですか(根本的な原因)?助けてください。
Persistence.xmlの接続URL:
> "jdbc:Oracle:thin:@//localhost:1521/orcl"
スタックトレース:
16:06:32,687 WARN [com.arjuna.ats.arjuna] (default-workqueue-1) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a80106:-3e8b2d6f:5037338f:15, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@4d1082 >: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.Java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at
Caused by: Java.sql.SQLException: No suitable driver found for jdbc:Oracle:thin:@//localhost:1521/orcl
at Java.sql.DriverManager.getConnection(DriverManager.Java:602) [rt.jar:1.6.0_26]
at Java.sql.DriverManager.getConnection(DriverManager.Java:154) [rt.jar:1.6.0_26]
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.Java:173) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.Java:276) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.Java:297) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 70 more
16:06:32,796 ERROR [org.jboss.ejb3.invocation] (default-workqueue-1) JBAS014134: EJB Invocation failed on component CreditcardFacade for method public abstract void com.peter.ejb.CreditcardFacadeLocal.addCreditCard(com.peter.entity.Creditcard): javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.Java:115) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.Java:95) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.Java:232) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.Java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.Java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.Java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.Java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.Java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.Java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.Java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.Java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.Java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.Java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.Java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.Java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at com.peter.ejb.CreditcardFacadeLocal$$$view2.addCreditCard(Unknown Source) [classes:]
com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.Java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.Java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.Java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.Java:1165)
... 46 more
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.Java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.Java:47) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.Java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.Java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.Java:304) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.Java:169) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.Java:82) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.Java:138) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.Java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at $Proxy96.prepareStatement(Unknown Source) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.buildBatchStatement(AbstractBatchImpl.Java:144) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.getBatchStatement(AbstractBatchImpl.Java:127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.Java:2827) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.Java:3290) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.Java:80) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.Java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.Java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.Java:186) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.Java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.Java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.Java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.Java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.Java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 52 more
Caused by: Java.sql.SQLException: No suitable driver found for jdbc:Oracle:thin:@//localhost:1521/orcl
at Java.sql.DriverManager.getConnection(DriverManager.Java:602) [rt.jar:1.6.0_26]
at Java.sql.DriverManager.getConnection(DriverManager.Java:154) [rt.jar:1.6.0_26]
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.Java:173) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.Java:276) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.Java:297) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 70 more
16:06:32,953 WARNING [org.Apache.cxf.phase.PhaseInterceptorChain] (default-workqueue-1) Application {http://service.peter.com/}CreditCardServiceService#{http://service.peter.com/}addCreditCard has thrown exception, unwinding now: org.Apache.cxf.interceptor.Fault: Transaction rolled back
at org.Apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.Java:155) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.Java:86) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.Java:121) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.Java:61) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.Java:75) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.Java:58) [cxf-2.4.1.jar:2.4.1]
at Java.util.concurrent.Executors$RunnableAdapter.call(Executors.Java:441) [rt.jar:1.6.0_26]
at Java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.Java:303) [rt.jar:1.6.0_26]
at Java.util.concurrent.FutureTask.run(FutureTask.Java:138) [rt.jar:1.6.0_26]
at org.Apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.Java:37) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.Java:106) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.Java:263) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.Java:232) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.interceptor.OneWayProcessorInterceptor$1.run(OneWayProcessorInterceptor.Java:109) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.Java:332) [cxf-2.4.1.jar:2.4.1]
at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.Java:886) [rt.jar:1.6.0_26]
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:908) [rt.jar:1.6.0_26]
at Java.lang.Thread.run(Thread.Java:662) [rt.jar:1.6.0_26]
Caused by: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.Java:115) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.Java:95) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.Java:232) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.Java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.Java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.Java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.Java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.Java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.Java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.Java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.Java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.Java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.Java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.Java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.Java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.Java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at com.peter.ejb.CreditcardFacadeLocal$$$view2.addCreditCard(Unknown Source) [classes:]
at com.peter.service.CreditCardService.addCreditCard(CreditCardService.Java:56) [classes:]
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:39) [rt.jar:1.6.0_26]
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:25) [rt.jar:1.6.0_26]
at Java.lang.reflect.Method.invoke(Method.Java:597) [rt.jar:1.6.0_26]
at org.Apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.Java:173) [cxf-2.4.1.jar:2.4.1]
at org.Apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.Java:89) [cxf-2.4.1.jar:2.4.1]
... 15 more
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.Java:1177)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.Java:117)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.Java:75)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.Java:92) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
... 43 more
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.Java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.Java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.Java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.Java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.Java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.Java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.Java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.Java:273)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.Java:93)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.Java:164)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.Java:1165)
... 46 more
Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.Java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.Java:47) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.Java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.Java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.Java:304) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.Java:169) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.Java:82) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.Java:138) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.Java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at $Proxy96.prepareStatement(Unknown Source) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.buildBatchStatement(AbstractBatchImpl.Java:144) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.getBatchStatement(AbstractBatchImpl.Java:127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.Java:2827) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.Java:3290) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.Java:80) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.Java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.Java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.Java:186) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.Java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.Java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.Java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.Java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.Java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 52 more
Caused by: Java.sql.SQLException: No suitable driver found for jdbc:Oracle:thin:@//localhost:1521/orcl
at Java.sql.DriverManager.getConnection(DriverManager.Java:602) [rt.jar:1.6.0_26]
at Java.sql.DriverManager.getConnection(DriverManager.Java:154) [rt.jar:1.6.0_26]
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.Java:173) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.Java:276) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.Java:297) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
... 70 more
Oracleデータベースのバージョン:11.2.0。
ドライバーのバージョンはデータベースのバージョンと一致する必要がありますか?
編集:
プログラムがドライバーをロードするファイルパスをトレースする方法は?これにより、根本原因を見つけることができます。ありがとう。
Ojdbc6-gロギングを有効にする方法私はこれに従うことを試みました Oracle_JDBC しかし、私はそれを完了する方法がわかりません。 Javaシステムプロパティをグローバルに設定する方法は?環境変数は適切な選択ではないかもしれないことを知っています。他の考えはありますか?このJavaを使用する場合、jvm作成用のutil.logging.config.file。起動時にOracleデータベースをセットアップしますか?
休止状態のログを有効にする方法
Hibernate-4.1.1およびJBoss 7.1を使用しています。
助けてください。
ありがとう。
「ojdbc.jar」は、アプリケーションサーバーのCLASSPATH
にありません。
どのアプリケーションサーバーであるかを教えてください。ドライバーをどこに配置するかを説明します。
編集:タグ jboss を見たので、フォルダ"$JBOSS_HOME/server/default/lib/"
に配置する必要があります
「適切なドライバーがない」とは、通常、接続するために提供したJDBC
URLの構文が正しくないか、ドライバーがまったくロードされていないことを意味します。
メソッドgetConnectionが呼び出されると、DriverManager
は、初期化時にロードされたドライバーと、現在のアプレットまたはアプリケーションと同じクラスローダーを使用して明示的にロードされたドライバーの中から適切なドライバーを見つけようとします(Class.forName()
を使用)
例えば
import Oracle.jdbc.driver.OracleDriver;
Class.forName("Oracle.jdbc.driver.OracleDriver");
また、ojdbc6.jar
クラスパス。 .jar
JBossへの物理的な場所で"$JBOSS_HOME/server/default/lib/"
プロジェクトのディレクトリ。
編集:
最近hibernate
に言及しました。
hibernate.cfg.xml
ファイルには、次のような接続プロパティがあります。
<property name="hibernate.connection.driver_class">Oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:Oracle:thin:@localhost:1521:orcl</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
時にはそれは単純なものです。私の場合、無効なURLがありました。アットマーク(@)の前にコロンを省略しました。私は「jdbc:Oracle:thin:@ // localhost」の代わりに「jdbc:Oracle:thin @ // localhost」を持っていました。これがこの問題で他の誰かを助けることを願っています。
私にとっては、次のような無効なURLを入力しました:jdbc:Oracle:thin:@//localhost:1521/orcl
の代わりにorcl
のみ
こうする
set classpath=%classpath%(ur jarfile);
JDBCドライバーをダウンロードして、ライブラリーに追加します。ダウンロードリンク http://www.Oracle.com/technetwork/apps-tech/jdbc-112010-090769.html
まず、サーバー(JBoss)内でJava EE 6を使用してアプリケーションを開発する場合、 DataSource を使用することをお勧めします。その後、このDataSourceから接続を取得できます。接続プールを使用することをお勧めします。
次に、JBoss AS 7以降、JDBCドライバーをモジュールとして宣言する必要があります。これは here と記述されています。
OJDBC 6(11.x)では、ドライバーの名前は「Oracle.jdbc.OracleDriver」である必要があります。これは、SPIモードで登録された名前です(このファイルの内容を参照してください:META-INF/services/Java.sql.Driver)。
Java 6およびJDBC 4.0以降、JDBCドライバーは自動登録)です。
最後に、JBoss内でDataSourceを宣言する必要があります: DataSource configuration 。
参考文献: