Wildfly 33.0.2 and a custom datasource ConnectionListener

17 views
Skip to first unread message

Darius Gemini

unread,
Mar 20, 2026, 7:49:53 PM (yesterday) Mar 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,
3:07 AM (18 hours ago) 3:07 AM
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,
11:53 AM (10 hours ago) 11:53 AM
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,
1:33 PM (8 hours ago) 1:33 PM
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>
Reply all
Reply to author
Forward
0 new messages