2016-08-03 9 views
1

Eclipse NeonでTomEE 7.0.1を実行しています。私は "tomee.xml"ファイルにDataSourceリソースを定義しました。 DataSourceはOracle DBに接続し、ローカルのMavenリポジトリからドライバを取得しています。TomEE DataSourceリソースが "NoWait:Pool empty。接続をフェッチできません。使用できません[使用中]"。

TomEEが起動すると、私はコンソールに次のエラーを取得:

org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use]. 
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679) 
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468) 
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143) 
at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221) 

はここに私のリソースの定義である:私はホスト、ユーザー、およびパスワードを省かまし

<Resource id="global/foo/bar" type="DataSource" classpath="mvn:oracle:ojdbc6:11.2.0.3"> 
    JdbcDriver = oracle.jdbc.driver.OracleDriver 
    MaxActive = 5 
    MinIdle = 2 
    MaxIdle = 2 
    MaxWait = 10000 
    JdbcUrl = jdbc:oracle:thin:@<host>:1521:sus2 
    UserName = <userid> 
    Password = <password> 
</Resource> 

、 idは書かれているとおりです。私はまだJNDIルックアップについては確信していますが、それは明らかに別の問題です。

ここに私の春のコンテキストで私のJNDIルックアップリファレンスです:私は、サーバーを起動して、MBeanのエクスプローラを使用し

INFO: Configuring Service(id=global/foo/bar, type=Resource, provider-id=Default JDBC Database) 
... 
INFO: Creating Resource(id=global/foo/bar) 
Aug 03, 2016 11:08:27 AM org.apache.tomcat.jdbc.pool.ConnectionPool checkPoolConfiguration 
WARNING: initialSize is larger than maxActive, setting initialSize to: 5 
Aug 03, 2016 11:08:27 AM org.apache.tomcat.jdbc.pool.ConnectionPool init 
SEVERE: Unable to create initial connections of pool. 
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use]. 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679) 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468) 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143) 
    at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221) 
... 

Aug 03, 2016 11:08:27 AM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource <init> 
SEVERE: Can't create DataSource 
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use]. 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679) 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468) 
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143) 
    at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221) 
... 

... 
2016-08-03 11:08:30,080 WARN [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:549) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found. 
2016-08-03 11:08:30,084 ERROR [localhost-startStop-1] context.ContextLoader (ContextLoader.java:351) - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found. 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) 
... 
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found. 
    at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199) 
    at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151) 
    at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:828) 
... 
Aug 03, 2016 11:08:30 AM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found. 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) 
... 
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found. 
    at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199) 
    at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151) 
    at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291) 
    at org.apache.naming.NamingContext.lookup(NamingContext.java:828) 
... 

答えて

0

、または:

<jee:jndi-lookup jndi-name="java:global/foo/bar" id="sus2ds"/> 

そしてここでは、Tomcatのコンソール出力の詳細ですJNDIツリーを見て、正しい名前を取得するために、JNDIエクスプローラwebappを使用します。私の疑問は、id="global/foo/bar"ではなく、id="foo/bar"が必要で、あなたのSpringコードで同じ参照を保持しているということです。

関連する問題