ResourceAdapter (JCA) from EJB, in EAR
Currently I am having some difficulties with using a resource adapter (JCA) from an EJB inside an EAR file. I need to get this working in Sun AppServer 9 or GlassFish v2.
I succesfully tested the following setup:
Remote Client <-> Stateless Session Bean (EJB) <-> JCA <-> File system
It works for me when I deploy the EJB as EJB Module and the JCA as Connector.
The problem is that I need to deploy my application as Enterprise Application Project since both the EJB Module and JCA share some libraries. I do not want to put those libraries in the lib folder of my domain to prevent ClassLoader problems.
I read the documentation "Deploying and Configuring an Embedded Resource Adapter" in the Sun Java System Application Server Platform Edition 9 Developer's Guide. (http://docs.sun.com/app/docs/doc/819-3659/bealq?a=view). The documentation says The association between the physical JNDI name for the connector module in the Application Server and the logical JNDI name used in the application component is specified in the Application Server specific XML descriptor sun-ejb-jar.xml.
I am looking for a code example of how to use the sun-ejb-jar in my example. When I deploy the Connector (JCA) stand alone I need to create a connection pool and resource. This works very fine. I just cannot get it working inside the EAR. Do I also need to create the connection pool and resource when I deploy my connector (resource adapter) inside an EAR?
All the examples I see are related to MDb but I am using a Stateless Session Bean and my JCA reads some file from the file system, something I would like to avoid in my EJB.
Does anybody have an idea or code example?
Thanks and merry christmas to all of you!