1 Reply Latest reply on Apr 29, 2014 9:45 AM by Jesper Pedersen

    Where to put a custom ConnectionListener?

    Mike Hostetler Newbie

      So I was digging into the code we need to port over, wondering why allow-multiple-user pooling wasn't working, and discovered that we need to run some SQL when the connection is opened and destroyed.

       

      I found the pool configuration document and it talked about a "connection-listener" tag in the pool configuration. I went around and found some documentation for the ConnectionListener interface in ironjacamar-jdbc and found this post:

       

      https://community.jboss.org/message/808900

       

      I'm not sure what Jesper meant by "You can link your database module with the module where your implementation is located" and the documentation seemed a bit . . . obtuse.

       

      This is what my driver pool sections look like:

       

           <driver>sqljdbc4-20120306.jar</driver>

           <pool>

             <min-pool-size>0</min-pool-size>

             <max-pool-size>32</max-pool-size>

             <prefill>false</prefill>

              <use-strict-min>true</use-strict-min>

               <flush-strategy>AllConnections</flush-strategy>

               <allow-multiple-users>true</allow-multiple-users>

               <connection-listener class-name="com.foo.jdbc.SqlServerConnectionListener"/>

             </pool>

       

      What I have tried:

       

      • Putting my jar with SqlServerConnectionListener as a Wildfly module.
      • Deploying my jar with the ConnectionListener in standalone/deployments (along with my app and the SQLServer driver)
      • Putting Dependencies: myJar.jar in the MANIFEST.MF of my dao jar.

       

      All of them has resulted in the same error:

       

       

      Caused by: java.lang.ClassNotFoundException: com.foo.jdbc.SqlServerConnectionListener from [Module "org.jboss.ironjacamar.jdbcadapters:main" from local module loader...

       

       

      What can I do to get IronJacamar/WildFly to see my custom ConnectionListener?