【问题标题】:wildfly - installing postgres driver jarwildfly - 安装 postgres 驱动程序 jar
【发布时间】:2017-07-06 11:29:42
【问题描述】:

我在安装 postgres 驱动程序时遇到了困难。我已经尝试了很多东西:

  1. https://docs.jboss.org/author/display/WFLY10/Application+deployment

    一个。尝试“部署” JAR(来自 CLI 和管理控制台 UI)

  2. https://sites.google.com/site/jmdstips/jboss-wildfly/postgresql-on-wildfly---xa-datasource

    一个。尝试将模块定义放在 modules/org/postgresql ...

    b.尝试将模块定义放入 modules/system/layers/base/org/postgresql

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgres">
    <resources>
        <resource-root path="postgresql-9.4.1212.jre7.jar" />
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>

还有:

<drivers>
    <driver name="h2" module="com.h2database.h2">
        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
    </driver>
        <driver name="postgresql" module="org.postgresql">
                <datasource-class>org.postgresql.Driver</datasource-class>
                <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
        </driver>
</drivers>

在所有这些之后,我得到了这个错误。所以,我认为 wildfly 可以“看到”该模块,但有些不对劲。

23:24:15,889 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "postgresql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [org.postgresql]"

【问题讨论】:

  • 请检查您的日志,据我所知,应该有更详细的信息(例如异常堆栈跟踪)说明模块无法加载的原因。
  • 注意&lt;datasource-class&gt;org.postgresql.Driver&lt;/datasource-class&gt;是错误的:org.postgresql.Driver不是javax.sql.DataSource;查看副本。
  • 我希望修复它,这是有道理的,但我得到了同样的结果。我再次尝试移动驱动程序,但无济于事。它的设置与工作的 H2 驱动程序相同...
  • 您是否将 JAR 和 module.xml 放入 modules/org/postgresqlmodules/org/postgresql/main 中?它应该在main 目录中。

标签: jdbc wildfly wildfly-10


【解决方案1】:

简答:将驱动放在/wildfly/standalone/deployments文件夹中,它会自动部署驱动

【讨论】:

  • 与 Wildfly 21 和 Postgres JDBC 驱动程序 42.x 一起工作就像一个魅力。
  • 谢谢,我找了很久。这并直接在standalone.xml 的 中引用 JDBC 驱动程序文件名为我修复了它。
【解决方案2】:

原来我在standalone.xml 中使用“org.postgres”作为模块名称,而不是我在module.xml 中声明的“org.postgresql”

【讨论】:

    【解决方案3】:

    我也遇到了这个错误,这是由于 module.xml 没有正确的资源根目录

    【讨论】:

      猜你喜欢
      • 2016-07-13
      • 1970-01-01
      • 2017-04-13
      • 2015-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-03
      相关资源
      最近更新 更多