How to access JBoss-specific classes in EAP 6

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 6

Issue

We need to access org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 in our application, but get a ClassNotFoundError. How can we get access to it?

Resolution

  1. Find out which module(s) contain the classes you need.
  2. Add a META-INF/jboss-deployment-structure.xml to your top-level deployment (or WEB-INF/jboss-deployment-structure.xml if it is a standalone WAR). If you have a WAR within an EAR, this must go into the EAR.

If you want to depend on org.jboss.ironjacamar.jdbcadapters for example, use the contents:

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

If you wish to add dependencies to a WAR within an EAR, or other embedded deployment, use:

<jboss-deployment-structure>
    <sub-deployment name="mywebapp.war">
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" />
        </dependencies>
    </sub-deployment>
</jboss-deployment-structure>

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.