2016-03-26 40 views
4

最終的に誰かが私を助けることができます。現在のところ私は起動時に本当に奇妙な問題がありますwildfly 10 final postgresドライバで、同じ設定でwildfly 10 CR4が起動します。Wildfly 10最終的なpostgresドライバClassCastException

私が手例外は以下の通りです:

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 

奇妙なことは、それが最終版wildfly 10決勝にwildfly 10 CR4ではなく、上の作品です。何か案が? 私にとっては、クラスローダーの問題のように見えますが、私はそれを追跡するためにwildflyの専門家ではありません。

モジュール/ ORG/postgresの/メイン/ 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> 

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> 

のJava JDKは次のとおりです。jdk1.8.0_73

私の問題を解決する助けに本当に感謝します。事前に

Thxを

/デヴィッド・

答えて

11

DataSourceを実装するクラス名はいずれかです:

org.postgresql.ds.PGSimpleDataSource 

または

org.postgresql.ds.PGPoolingDataSource 

https://jdbc.postgresql.org/documentation/head/ds-ds.html

私はあなたがおそらくプールDataSourceを必要としないので、Wildflyだけの単純な、接続を管理すると仮定: だから、

<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> 
+1

'ConnectionPoolDataSource'ではない(またはすべきではない)'データソースでなければなりません'。 'PGConnectionPoolDataSource'の場合、' ConnectionPoolDataSource'だけが実装されています。限り、私はWildFlyがここで 'DataSource'を期待すると言うことができます。 –

+0

@ MarkRotteveel:そうです。これを修正しました。 –

+1

ありがとうございました!あなたの応答を読んで共鳴すると思う;)_datasource-class_はデータソースを期待しています。 とにかく、たくさん! –

関連する問題