@DataSourceDefinition 在 Wildfly 上的使用

问题描述

在 Java EE 7 中,@DataSourceDeFinition 应该是直接在应用程序中声明自定义 DataSource 的可移植解决方案。

在我的应用程序中,我像这样声明了一个 DataSourceDeFinition

@DataSourceDeFinition(
        name = "java:app/jdbc/CargoTrackerDatabase",className = "org.postgresql.xa.PGXADataSource",url = "jdbc:postgresql://localhost:5432/cargotracker",user = "user",password = "password"
)

并在项目依赖项中包含 pg 驱动程序。

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.18</version>
            <scope>runtime</scope>
        </dependency>

此数据源在Payara 5.2020.7自动注册,但在WildFLy 22.0.0.Final失败。

12:41:56,490 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0003: Could not index class org/postgresql/jdbc/PgConnection$1.class at /D:/hantsylabs/cargotracker/content/cargo-tracker.war/WEB-INF/lib/postgresql-42.2.18.jar: java.lang.IllegalStateException: required class information is missing
        at org.jboss.jandex@2.1.4.Final//org.jboss.jandex.Indexer.rebuildnestedType(Indexer.java:932)
        at org.jboss.jandex@2.1.4.Final//org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:792)
        at org.jboss.jandex@2.1.4.Final//org.jboss.jandex.Indexer.resolveTypeAnnotation(Indexer.java:711)
        at org.jboss.jandex@2.1.4.Final//org.jboss.jandex.Indexer.resolveTypeAnnotations(Indexer.java:619)
        at org.jboss.jandex@2.1.4.Final//org.jboss.jandex.Indexer.index(Indexer.java:1613)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...