Search code examples
javawildflyjaybird

Use WildFly module both datasource and connectionFactory


I have a module in Wildfly to use as my datasource to Firebird. It works great

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.firebirdsql">
    <resources>
        <resource-root path="jaybird-2.2.13.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.resource.api"/>
        <module name="javax.xml.bind.api"/> <!-- Jaybird 3.0 onwards doesn't need this -->
        <module name="org.antlr4"/>
    </dependencies>
</module>

and the jar is put inside the directory of module.xml.

But I want to use the driver both with data source and also to create a pure JDBC connection in connectionfactory like Class.forName("org.firebirdsql.jdbc.FBDriver");, not using data source provided by the server.

If I put jaybird in pom.xml I got errors. I think because this is duplicating the libs. How can I solve this?


Solution

  • I just added the below code under <subsystem xmlns="urn:jboss:domain:ee:4.0">

    <global-modules>
        <module name="org.firebirdsql" slot="main"/>
    </global-modules>
    

    Thanks, Mark Rotteveel for answer on the Jaybird bug tracker.