Wildfly 10 - How to setup JCA connector to work with a Session EJB
rsoika Jul 22, 2017 5:33 AMHi I need some help how to setup a JCA connector in Wildfly 10.
I try to implement a JCA connector for Hadoop. The deployment of the connector seems to be ok. I can see the connector in the web admin console and I used the following configuration in my standalone.xml:
<subsystem xmlns="urn:jboss:domain:resource-adapters:4.0"> <resource-adapters> <resource-adapter id="imixs.hadoop"> <archive> imixs-archive-hadoop-jca-1.0.0-SNAPSHOT.rar </archive> <transaction-support>LocalTransaction</transaction-support> <connection-definitions> <connection-definition class-name="org.imixs.workflow.archive.hadoop.jca.spi.HadoopManagedConnection" jndi-name="java:/jca/HadoopFactory" enabled="true" use-java-context="false" pool-name="java:/jca/HadoopFactory"> </connection-definition> <connection-definition class-name="org.imixs.workflow.archive.hadoop.jca.spi.HadoopManagedConnection" jndi-name="java:/jca/HadoopFactory2" enabled="true" use-java-context="true" pool-name="HadoopFactory2"> </connection-definition> </connection-definitions> </resource-adapter> </resource-adapters> </subsystem>
My problem is that I can't figure out how to inject the resource into my Stateless Session EJB.
@Stateless @LocalBean @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS") public class HadoopService { @Resource(mappedName = "jca/HadoopFactory") private DataSource dataSource; @Resource private SessionContext context; //.... }
During deployment I got the following exception:
imixs-archive-office_1 | 09:21:20,732 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "imixs-office-workflow-ear-3.0.5-SNAPSHOT.ear" (runtime-name : "imixs-office-workflow-ear-3.0.5-SNAPSHOT.ear") imixs-archive-office_1 | 09:21:20,734 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report imixs-archive-office_1 | WFLYCTL0184: New missing/unsatisfied dependencies: imixs-archive-office_1 | service jboss.naming.context.java.jca.HadoopFactory (missing) dependents: [service jboss.naming.context.java.comp.imixs-office-workflow."imixs-office-workflow-ejb-3.0.5-SNAPSHOT".HadoopService.env.jca.HadoopFactory]
To me it looks like I do something wrong with the JNDI names (which is one of the biggest mystery of Java EE)
I tried also to setup a resource ref via the ejb-jar..xml file.
<session> <ejb-name>HadoopService</ejb-name> <ejb-class>org.imixs.workflow.archive.hadoop.HadoopService</ejb-class> <session-type>Stateless</session-type> <resource-ref> <res-ref-name>jca/HadoopFactory</res-ref-name> <res-type>javax.resource.cci.ConnectionFactory</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> <mapped-name>java:/jca/HadoopFactory</mapped-name> </resource-ref> </session>
But this all did not work.
Can anybody help how to fit the things together? It seems to be impossible to find a example for Wildfly 10 and JCA
Thanks for any help