0 Replies Latest reply on Jun 9, 2014 10:47 AM by Darryl Miles

    @Resource ConnectionFactory injection into WAR under WildFly8.1

    Darryl Miles Novice

      I have written a JCA project to attempt to both exercise the new JCA features, prove how they work in various containers, whilst illustrating in the project how to test.

      The project is will a work-in-progress as various hurdles/issues/understanding are resolved over time.

      This is available at dlmiles/full-example-ee7-jca-eis · GitHub  (see commit-id:206000c)

      With help from the Arquallian folks it does attempt to unit test but fails with NoClassDefFoundError (as there is no access to interface class from WAR) or when it is provided in WEB-INF/classes a ClassCastException (as the ClassLoader's are not identical) as the RAR interface (for ConnectionFactory) is widened.

       

      The JCA ConnectionFactory and Connection can they be used directly from inside a WAR ?  or can they only be used from EJB (which can then have the EJB client interface injected into WAR) ?

      The injected ConnectionFactory object is not proxied into the WAR.

       

      I would like to improve this project to demonstrate (via testing) various deployment (standalone, inside-EAR) and activation (XML, Annotation, programmatic) permutations available with WildFly/JBossAS.

       

       

       

      Also an issue I noticed with WildFly and the IronJacamar adapter is that is swallows useful exceptions when performing JCA validation, such as NoClassDefFoundError: com/foo/ClassName instead it reports there is no "public int hashCode()" method as required by spec.  The validation test classes should probably check the one of the specific reflection exception, if another exception is thrown that should be the cause in the DeploymentException.

       

      Maybe the first test that is performed is a check to make sure the class file itself successfully loads before validation via reflection begins.  This validates packaging/classloader mistakes.