次の pom 依存関係で spring boot 1.3.0.RELEASE を使用しています
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
JPAを機能させようとしていますが、application.propertiesの次のようにするとすべて正常に機能します
# Connection url for the database
spring.datasource.url = jdbc:oracle:thin:@**********
# Username and password
spring.datasource.username = **********
spring.datasource.password = *********
以下のように tomcat-jdbc の本格的な dbcp 設定に切り替えると:
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@**********
spring.datasource.username=*****
spring.datasource.password=*****
spring.datasource.initial-size=0
spring.datasource.max-active=10
spring.datasource.default-auto-commit=true
spring.datasource.default-transaction-isolation=2
spring.datasource.fair-queue=false
spring.datasource.jdbc-interceptors=ConnectionState;StatementFinalizer;ResetAbandonedTimer"
spring.datasource.jmx-enabled=true
spring.datasource.log-abandoned=true
spring.datasource.max-idle=1
spring.datasource.max-wait=30000
spring.datasource.min-evictable-idle-time-millis=60000
spring.datasource.min-idle=1
spring.datasource.remove-abandoned=true
spring.datasource.remove-abandoned-timeout=300
spring.datasource.test-on-borrow=true
spring.datasource.test-on-return=false
spring.datasource.test-while-idle=false
spring.datasource.time-between-eviction-runs-millis=10000
spring.datasource.use-equals=false
spring.datasource.validation-interval=60000
spring.datasource.validation-query=SELECT 2+2 FROM DUAL
次のスタックトレースを取得します
2015-11-20 16:58:18.788 ERROR 48307 --- [nio-8080-exec-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to inform interceptor of pool start.
java.lang.ClassNotFoundException: Unable to load class: org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer" from ClassLoader:java.net.URLClassLoader@5bbcaf22;ClassLoader:TomcatEmbeddedWebappClassLoader
context: ROOT
delegate: true
----------> Parent Classloader:
java.net.URLClassLoader@5bbcaf22
at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) ~[tomcat-jdbc-8.0.28.jar:na]
at org.apache.tomcat.jdbc.pool.PoolProperties$InterceptorDefinition.getInterceptorClass(PoolProperties.java:964) ~[tomcat-jdbc-8.0.28.jar:na]\
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:447) [tomcat-jdbc-8.0.28.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141) [tomcat-jdbc-8.0.28.jar:na]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115) [tomcat-jdbc-8.0.28.jar:na]
......
......
......
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:74) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_20]
at java.lang.Class.forName(Class.java:340) ~[na:1.8.0_20]
at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38) ~[tomcat-jdbc-8.0.28.jar:na]
... 147 common frames omitted
これは、Spring Boot のバージョンが異なっていても当てはまるようです.... 私の設定 (すでに使用している Spring データソース Bean から取得) は、ブートが期待するものではありませんか?
乾杯