Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wrong PostgreSQL version in Wildfly build

Error on build

Code Block
breakoutModewide
[ERROR] Errors: 
3062[ERROR]   TaskanaWildflyTest » Deployment Cannot deploy taskana.war: {"WFLYCTL0062: Comp...
3063[ERROR]   TaskanaWildflyWithHistoryLoggerEnabledTest » Deployment Cannot deploy taskana....
3064[ERROR]   TaskanaWildflyWithSimpleHistoryAndHistoryLoggerEnabledTest » Deployment Cannot...
3065[ERROR]   TaskanaWildflyWithSimpleHistoryEnabledTest » Deployment Cannot deploy taskana....
3066[ERROR] Tests run: 4, Failures: 0, Errors: 4, Skipped: 0
3067[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (integration-tests) on project taskana-rest-spring-example-wildfly: There are test failures.

Further details on error

If you scroll up the log you can find the following error during startup of Wildly in the integration tests:

Code Block
breakoutModewide
12:39:38,381 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 36) WFLYCTL0013: Operation ("add") failed - address: ([
547    ("subsystem" => "datasources"),
548    ("jdbc-driver" => "postgresql")
549]) - failure description: "WFLYJCA0041: Failed to load module for driver [org.postgresql]"

Cause and Resolution

To add the PostgreSQL driver to the Wildly configuration, a module.xml file containing the driver details is required in the folder ${project.build.directory}/wildfly-${version.wildfly}/modules/system/layers/base/org/postgresql/main. This file is maintained the src/test/resources folder and will be copied the the target directory during the build.

This xml-file contains the version of the PostgreSQL driver. If the version of the driver changes, this file needs to be changed as well. This could for example happen if a new Spring Boot version contains a new PostgreSQL version.

Code Block
<?xml version='1.0' encoding='UTF-8'?>

<module xmlns="urn:jboss:module:1.1" name="org.postgresql">

    <resources>
    <!--the name of your driver -->
        <resource-root path="postgresql-42.2.16.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>