Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Deployment of postgresql datasource is failing

59 views
Skip to first unread message

John Himpel

unread,
Apr 16, 2025, 7:41:28 PMApr 16
to WildFly
I am a newbie at defining and connecting a datasource in wildfly.

I am running postgresql16-16.8-1 on Fedora F42.
I am running wildfly v35.
Wildfly v35 requires Jakarta EE 10.
My wildfly base config file is standalone.xml

When I attempt to start wildfly, I get the following:
2025-04-16 16:03:35,656 INFO  [org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 7.3.1.Final (Apache CXF 4.0.5)
2025-04-16 16:03:35,659 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "manchesterDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.postgresql"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "service org.wildfly.data-source.manchesterDS is missing [jboss.jdbc-driver.postgresql]",
        "service jboss.driver-demander.java:jboss/datasources/manchesterDS is missing [jboss.jdbc-driver.postgresql]"
    ]
}
2025-04-16 16:03:35,685 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "manchesterDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.jdbc-driver.postgresql",
        "jboss.jdbc-driver.postgresql"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "service org.wildfly.data-source.manchesterDS is missing [jboss.jdbc-driver.postgresql]",
        "service jboss.driver-demander.java:jboss/datasources/manchesterDS is missing [jboss.jdbc-driver.postgresql]",
        "service org.wildfly.data-source.manchesterDS is missing [jboss.jdbc-driver.postgresql]"
    ]
}
2025-04-16 16:03:35,689 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.jdbc-driver.postgresql (missing) dependents: [service org.wildfly.data-source.manchesterDS, service jboss.driver-demander.java:jboss/datasources/manchesterDS]
WFLYCTL0448: 2 additional services are down due to their dependencies being missing or failed
2025-04-16 16:03:35,716 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server

The following is the datasources snippet from standalone.xml:
        <subsystem xmlns="urn:jboss:domain:datasources:7.2">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=${wildfly.h2.compatibility.mode:REGULAR}</connection-url>
                    <driver>h2</driver>
                    <security user-name="sa" password="sa"/>
                </datasource>
                <datasource jndi-name="java:jboss/datasources/manchesterDS" pool-name="manchesterDS">
                        <connection-url>jdbc:postgresql://localhost:5432/postgresql</connection-url>
                    <driver>postgresql</driver>
                    <security user-name="<redacted>" password="redacted"/>
                </datasource>
                <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">
                        <driver-class>org.postgresql.Driver</driver-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

My /opt/wildfly/modules/system/layers/base/org/postgresql/main/module.xml follows:
<?xml version="1.0"/>

<module xmlns="url:jboss:module:1.0"
        name="org.postgresql"
>
    <resources>
        <resource-root path="postgresql.jar"/>
    </resources>
    <dependencies>
        <module name="jakarta.api"/>
        <module name="jakarta.transaction.api"/>
        <module name="jakarta.servlet.api"
                optional="true"
        />
    </dependencies>
</module>

ls /opt/wildfly/modules/system/layers/base/org/postgresql/main
module.xml  postgresql.jar  postgresql-jdbc.jar

Any suggestions would be greatly appreciated.


Stephen Sill II

unread,
Apr 17, 2025, 10:27:33 AMApr 17
to WildFly
I just had a case to do this recently.

I'd use the jboss-cli like this.  

echo Creating Postgresql driver module
# create postgresql jdbc driver module
module add --name=com.postgresql --resources=/opt/bitnami/wildfly/stage/postgresql-42.7.5.jar --dependencies=wildflyee.api

echo Creating Postgresql jdbc driver
/subsystem=datasources/jdbc-driver=postgresql:add(driver-name="postgresql",driver-module-name="com.postgresql",driver-class-name=org.postgresql.Driver)

echo Configuring credential store
# Add a credential store
/subsystem=elytron/credential-store=wfcreds:add(path="/opt/bitnami/wildfly/standalone/configuration/credential.store", credential-reference={clear-text="${CRED_STORE_PW}"},create=true)

# Put db credentials in credential store
echo Adding db credentials to credential store
/subsystem=elytron/credential-store=wfcreds:add-alias(alias=dbpw, secret-value="${LOGI_MASTER_DB_PASS}")

# add and configure datasources
echo Adding datasources
# PostgreSQL driver should have already been deployed by being copied to deployments dir
# Add the JTA datasource
data-source add --name=jlogiDS --max-pool-size=${JLOGI_DB_POOL_SIZE} --jndi-name=java:jboss/datasources/jlogiDS --driver-name=postgresql --connection-url=jdbc:postgresql://${LOGI_MASTER_DB_HOST}:${LOGI_MASTER_DB_PORT}/${LOGI_MASTER_DB_NAME} --user-name=${LOGI_MASTER_DB_USER} --credential-reference={store=wfcreds, alias=dbpw} --jta

echo Configuring datasources
# configure db connection validation
/subsystem=datasources/data-source=jlogiDS:write-attribute(name=validate-on-match, value=true)
/subsystem=datasources/data-source=jlogiDS:write-attribute(name=use-fast-fail, value=false)
/subsystem=datasources/data-source=jlogiDS:write-attribute(name=check-valid-connection-sql,value="SELECT 1")
/subsystem=datasources/data-source=jlogiDS:write-attribute(name=max-pool-size,value=${JLOGI_DB_POOL_SIZE})

Hantsy Bai

unread,
Apr 17, 2025, 9:16:19 PMApr 17
to WildFly
The newest Jakarta EE, datasource declaration. jdbc drivers can be packaged in the application package directly.

Check the Jakarta official reference application, https://github.com/eclipse-ee4j/cargotracker

Alexander Belya (AlexSW)

unread,
Apr 20, 2025, 12:33:07 AMApr 20
to WildFly
John, before these logs, are there any messages related to loading the jdbc-driver? Judging by the configuration block, there should be no problems. But it's confusing how module.xml looks like, or rather hyphenation in some lines. Is the information inside the file really presented in this way? If yes, you should correct this file. Namely: in the line “<module xmlns=”url:jboss:module:1.0“ return attribute name=”org.postgresql“ and closing tag ‘>’; also in the line ”<module name=’jakarta.servlet.api” return attribute optional=“true” and closing tag “/>”. Maybe WF can't read this XML because of incorrect syntax.

пятница, 18 апреля 2025 г. в 11:16:19 UTC+10, Hantsy Bai:

John W. Himpel

unread,
Apr 20, 2025, 7:07:12 PMApr 20
to WildFly
I followed the suggestions from Stephen Sill II, and got past this error.  Only to find another error during deployment, but that's for another thread next week.

Thanks to all who responded with suggestions.

PS:  Hantsy Ball,  I don't see the hyphens (dashes) you describe in either the original text or in the the my copy of the original email from Google Groups.

John
--
You received this message because you are subscribed to a topic in the Google Groups "WildFly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wildfly/zVHp5pYjqCg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wildfly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wildfly/c153890c-db6c-4c18-b3e3-f9d82da6f68dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages