Dav*_* M. 4 jdbc postgresql-9.4 wildfly-10
最终有人可以帮助我.目前我在使用postgres驱动程序启动wildfly 10 Final时遇到了一个非常奇怪的问题,但是使用相同的设置,wildfly 10 CR4将启动.
我得到的例外是:
Caused by: javax.resource.ResourceException: IJ031089: Failed to load datasource: org.postgresql.Driver
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getDataSource(LocalManagedConnectionFactory.java:650)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:311)
... 6 more
Caused by: java.lang.ClassCastException: org.postgresql.Driver cannot be cast to javax.sql.DataSource
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getDataSource(LocalManagedConnectionFactory.java:633)
... 7 more
Run Code Online (Sandbox Code Playgroud)
奇怪的是,它适用于wildfly 10 CR4,但不适用于最终版本wildfly 10 Final.任何的想法?对我来说,它看起来像一个类加载器问题,但我不是那个使用wildfly追踪它的专家.
我的modules/org/postgres/main/module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgres">
<resources>
<resource-root path="postgresql-9.4.1208.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Run Code Online (Sandbox Code Playgroud)
我在standalone.xml中的驱动程序定义
<driver name="postgres" module="org.postgres">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.Driver</datasource-class>
</driver>
Run Code Online (Sandbox Code Playgroud)
Java JDK是:jdk1.8.0_73
非常感谢任何帮助解决我的问题.
Thx提前
/大卫
a_h*_*ame 17
实现DataSource的类名是:
org.postgresql.ds.PGSimpleDataSource
Run Code Online (Sandbox Code Playgroud)
要么
org.postgresql.ds.PGPoolingDataSource
Run Code Online (Sandbox Code Playgroud)
https://jdbc.postgresql.org/documentation/head/ds-ds.html
我假设Wildfly将管理连接,所以你可能不需要池化DataSource,只需要简单:所以它应该是
<driver name="postgres" module="org.postgres">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
</driver>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3669 次 |
| 最近记录: |