Wildfly 33.0.2 and a custom datasource ConnectionListener

51 views
Skip to first unread message

Darius Gemini

unread,
Mar 20, 2026, 7:49:53 PMMar 20
to WildFly
Hello, everyone.

I am a brand new user to Wildfly, and I'm attempting to use the maven plugin to create a bootable jar that uses a custom ConnectionListener. 

I've managed to deploy my application and the datasource, but it fails when trying to find my connection-listener as defined in my ds.xml file.

My connection listener is packaged as a jar, and the module is loaded using a cli script.

This is the error I'm receiving: 

Caused by: java.lang.ClassNotFoundException: com.listener.UserRoleConnectionListener from [Module "org.jboss.ironjacamar.jdbcadapters" version 3.0.9.Final from local module loader @3571b748 (finder: local module finder @3e96bacf (roots: /tmp/wildfly-bootable-server11399799577643252378/modules,/tmp/wildfly-bootable-server11399799577643252378/modules/system/layers/base))]

Module add command:
module add --name=com.example.connectionlistener --resources=src/main/wildfly/config/modules/connection-listener.jar

WEB-INF/jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name=" com.example.connectionlistener"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

What am I missing, and what other information do you fine folks need to help me?

Thank you!



Wolfgang

unread,
Mar 21, 2026, 3:07:06 AMMar 21
to WildFly
Hi,

do you use the "provision" goal of the wildfly-maven-plugin (https://docs.wildfly.org/wildfly-maven-plugin/provision-mojo.html)? If yes: how do you bundle your module? Could you post the relevant snippet of the maven config that pulls in your module?

Best regards

Wolfgang

Darius Gemini

unread,
Mar 21, 2026, 11:53:53 AMMar 21
to WildFly
Hi, Wolfgang!

No, I wasn't using the provision goal. I'm wasn't even using the wildfly-maven-plugin. 
I was using the wildfly-jar-maven-plugin. 
Everything I've cobbled together is from 20 different documentation sources, so I'm a little overwhelmed.

I realize I haven't provided the information you've asked for regarding bundling/pulling the module but that's because I've switched over to the wildfly-maven-plugin  .
But now I'm hitting a different issue that's preventing me from even getting to the provision goal.

I'm including the microprofile-reactive-messaging-kafka layer, and it's trying to bring in kafka-clients v3.7.1, which is quarantined by my organization.
Previously, with the wildfly-jar-maven-plugin, I was using <overridden-server-artifacts> to exclude it, which was working.

I'm attempting the same thing now with <excluded-dependencies>, but it's still trying to bring it in.
In the excluded tag, I've tried: 
org.apache.kafka:kafka-clients:jar:3.7.1
org.apache.kafka:kafka-clients
org.apache.kafka:kafka-clients::3.7.1
:kafka-clients
... etc.

I've got the version of kafka-clients I want to use defined in dependency management, and as a dependency in the pom.

Thanks again!

PS. What's the proper etiquette around here for an evolving issue like this? Keep responding to this thread? Create a new conversation after you pointed out using the wildfly-maven-plugin?

Darius Gemini

unread,
Mar 21, 2026, 1:33:08 PMMar 21
to WildFly

PPS. I'm using wildfly-maven-plugin 5.1.5.Final

Also, here's my plugin config, with the changes I made to attempt the solution to the original issue.

<plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>5.1.5.Final</version>
                <executions>
                    <execution>
                        <id>deploy-jar</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-artifact</goal>
                        </goals>
                        <configuration>
                            <groupId>com.example.connectlistener</groupId>
                            <artifactId>connection-listener</artifactId>
                            <version>${connection-listener.version}</version>
                            <name>connection-listener.jar</name>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-jar</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <bootableJar>true</bootableJar>
                            <bootableJarInstallArtifactClassifier></bootableJarInstallArtifactClassifier>
                            <boot-logging-config>src/main/wildfly/config/logging.properties</boot-logging-config>
                            <cli-sessions>
                                <cli-session>
                                    <script-files>
                                        <!--script>src/main/wildfly/scripts/add-modules.cli</script-->
                                        <script>src/main/wildfly/scripts/bind-address.cli</script>
                                    </script-files>
                                    <resolve-expressions>true</resolve-expressions>
                                </cli-session>
                            </cli-sessions>
                            <displayCliScriptsOutput>true</displayCliScriptsOutput>
                            <excluded-dependencies>
                                <excluded>org.apache.kafka:kafka-clients</excluded>
                            </excluded-dependencies>

                            <extraServerContentDirs>
                                <extraServerContentDir>
                                    ${project.basedir}/src/main/wildfly/extra-server-content/
                                </extraServerContentDir>
                            </extraServerContentDirs>
                            <feature-packs>
                                <feature-pack>
                                    <location>wildfly@maven(org.jboss.universe:community-universe)#${version.wildfly}</location>
                                </feature-pack>
                                <feature-pack>
                                    <groupId>org.wildfly</groupId>
                                    <artifactId>wildfly-datasources-galleon-pack</artifactId>
                                    <version>${version.wildfly.datasources.galleon-pack}</version>
                                </feature-pack>
                            </feature-packs>
                            <layers>
                                <layer>ejb</layer>
                                <layer>jpa</layer>
                                <layer>jaxrs</layer>
                                <layer>logging</layer>
                                <layer>messaging-activemq</layer>
                                <layer>microprofile-platform</layer>
                                <layer>microprofile-reactive-messaging-kafka</layer>
                                <layer>observability</layer>
                                <layer>postgresql-driver</layer>
                                <layer>remote-activemq</layer>
                                <layer>resource-adapters</layer>
                                <layer>web-console</layer>
                            </layers>
                            <outputFileName>${project.build.directory}/${project.build.finalName}.jar</outputFileName>
                            <!--overridden-server-artifacts>
                                <artifact>
                                    <groupId>org.apache.kafka</groupId>
                                    <artifactId>kafka-clients</artifactId>
                                </artifact>
                            </overridden-server-artifacts-->
                            <plugin-options>
                                <jboss-fork-embedded>${plugin.fork.embedded}</jboss-fork-embedded>
                            </plugin-options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Wolfgang

unread,
Mar 23, 2026, 4:46:28 AMMar 23
to WildFly
Hi,

I fear I cannot help much further, I have only superficial knowledge of provisioning ;-). It should be OK to continue this thread with further questions if they are related to the original question (which is the case here ;-).

I think "wildfly-jar-maven-plugin" and "wildfly-maven-plugin" both just wrap Galeon under the hood, so hopefully the results for your use case should be the same. "wildfly-maven-plugin" has further capabilities, e.g. start/stop a server.

It gives this limitation:
An artifact present in the overridden-server-artifacts set must be present in the dependencies section
(see also sample snippet on this page)

For further analysis you could check whether the kafka module is a candiate for upgrade:
The set of artifacts that can be upgraded can be retrieved by setting the parameter <dump-original-artifacts>true</dump-original-artifacts> or the system property `bootable.jar.dump.original.artifacts to true when building a bootable JAR. The file target/bootable-jar-build-artifacts/bootable-jar-server-original-artifacts.xml is generated
If it does not appear in this list, something is wrong.

jde...@redhat.com

unread,
Mar 23, 2026, 4:58:46 AMMar 23
to Wolfgang, WildFly
Hi,
The ability to override artifacts with WildFly Maven Plugin is based on WildFly channels.
Change the plugin configuration to contain:

<channels>
  <channel>
    <manifest>
      <url>file://${project.basedir}/manifest.yaml</url>
     </manifest>
   </channel>
</channels>

Create a file named manifest at the root of your project containing the Kafka GAV you want to use (let’s say 3.7.0):

schemaVersion: "1.1.0"
streams:
  - groupId: "org.apache.kafka"
    artifactId: "kafka-clients"
    version: "3.7.0."

At provisioning time the 3.7.0 version will be provisioned.

JF


From: wil...@googlegroups.com <wil...@googlegroups.com> on behalf of Wolfgang <his-me...@freenet.de>
Date: Monday, 23 March 2026 at 09:53
To: WildFly <wil...@googlegroups.com>
Subject: Re: Wildfly 33.0.2 and a custom datasource ConnectionListener

Sent from Outlook for Mac

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wildfly/0a24f66b-2966-4e8e-8fe8-0ff44bb112dcn%40googlegroups.com.

Darius Gemini

unread,
Mar 23, 2026, 12:12:15 PMMar 23
to WildFly
First off, thank you for trying to help me, Wolfgang!

Secondly, that did the trick, JF. 
Is there a way to tell the plugin to allow expression evaluation in the manifest.yaml file? Specifically,  Maven properties?

But more importantly, I'm back to my original problem.

I have a jar I've built with a single class in it that extends org.jboss.jca.adapters.jdbc.spi.listener.ConnectionListener.
I'm building a bootable Wildfly 33.0.2 jar, and I want my datasource to be able to use it.

This is the exception I'm getting:

Caused by: java.lang.ClassNotFoundException: com.listener.UserRoleConnectionListener from [Module "org.jboss.ironjacamar.jdbcadapters" version 3.0.9.Final from local module loader @70325e14 (finder: local module finder @37ceb1df (roots: /tmp/wildfly-bootable-server16999847687996086175/modules,/tmp/wildfly-bootable-server16999847687996086175/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:396)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:115)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:536)
at java.base/java.lang.Class.forName(Class.java:515)
at org.jboss.ironjac...@3.0.9.Final//org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.loadConnectionListenerPlugin(BaseWrapperManagedConnectionFactory.java:1001)

As stated previously, here's what I have so far:

Module add command:
module add --name=com.example.connectionlistener --resources=src/main/wildfly/config/modules/connection-listener.jar

WEB-INF/jboss-deployment-structure.xml:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name=" com.example.connectionlistener"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Maven configuration:

<version.wildfly>33.0.2.Final</version.wildfly>
<version.wildfly.datasources.galleon-pack>8.0.1.Final</version.wildfly.datasources.galleon-pack>

<plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>5.1.5.Final</version>
                <executions>
                    <execution>
                        <id>package-jar</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <!--dryrun>true</dryrun-->

                            <bootableJar>true</bootableJar>
                            <bootableJarInstallArtifactClassifier></bootableJarInstallArtifactClassifier>
                            <boot-logging-config>src/main/wildfly/config/logging.properties</boot-logging-config>
                            <!--Manifest.yaml is used to override Wildfly provided versions of artifacts-->
                            <channels>
                                <channel>
                                    <manifest>
                                         <url>file://${project.basedir}/src/main/wildfly/config/manifest.yaml</url>    
                                    </manifest>
                                </channel>
                                </channels>
                            <cli-sessions>
                                <cli-session>
                                    <script-files>
                                        <script>src/main/wildfly/scripts/add-modules.cli</script>

                                        <script>src/main/wildfly/scripts/bind-address.cli</script>
                                    </script-files>
                                    <resolve-expressions>true</resolve-expressions>
                                </cli-session>
                            </cli-sessions>
                            <displayCliScriptsOutput>true</displayCliScriptsOutput>
                            <plugin-options>
                                <jboss-fork-embedded>${plugin.fork.embedded}</jboss-fork-embedded>
                            </plugin-options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

jde...@redhat.com

unread,
Mar 23, 2026, 2:25:02 PMMar 23
to Darius Gemini, WildFly
Hi,
I suspect that we need some more, ideally a gihub project reproducer.
For the properties resolution:
you can use the resource Maven plugin to apply filtering/replacement to the manifest file (that would be a resource in your project).
JF 
Reply all
Reply to author
Forward
0 new messages