我正在 Spring启动应用程序中使用 HikariCP 和 Gemfire XD 。我的版本低于ClassCastException:`
10:29:04.757 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Started.
10:29:04.791 [main] WARN c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=com.pivotal.gemfirexd.internal.jdbc.ClientConnectionPoolDataSource was not found, trying direct instantiation.
10:29:04.794 [main] WARN c.z.hikari.util.DriverDataSource - Failed to create instance of driver class com.pivotal.gemfirexd.internal.jdbc.ClientConnectionPoolDataSource, trying jdbcUrl resolution
java.lang.ClassCastException: com.pivotal.gemfirexd.internal.jdbc.ClientConnectionPoolDataSource cannot be cast to java.sql.Driver
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:71)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:298)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:91)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:101)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:94)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)
我在application.properties文件中指定了以下配置:
spring.datasource.url=jdbc:gemfirexd://192.168.162.141:1527/
spring.datasource.username=APP
spring.datasource.password=APP
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=com.pivotal.gemfirexd.internal.jdbc.ClientConnectionPoolDataSource
spring.datasource.schema=APP
spring.datasource.transaction-isolation=0
spring.datasource.auto-commit=true`**
按照BlogPost我尝试改为 的 spring.datasource.driver类名= com.pivotal.gemfirexd.internal.jdbc.ClientDataSource
但它仍然不起作用并抛出相同的异常。
Gemfire XD版本:1.4.1 HikariCP版本:2.4.6 Spring boot版本:1.3.5 Spring JDBC版本:4.2.6 Java版本:1.7