Problem solved!For all who run into the same problems, here's my solution:
1) Download the IronJacamar package (for me it was 'IronJacamar 1.2.6.Final released').
2) Run the 'codegenerator.bat'. Here are my input values:
Profile version (1.7/1.6/1.5/1.0) [1.7]: 1.5
Type (O/Outbound/I/Inbound/B/Bidirectional) [O]:
Package name: com.jca.myadapter
Transaction support (N/NoTransaction/L/LocalTransaction/X/XATransaction) [N]:
Reauthentication (Y/Yes/N/No) [N]:
Include a ResourceAdapter (Y/Yes/N/No) [Y]:
Resource adapter class name [AcmeResourceAdapter]: MyResourceAdapter
Should the resource adapter class be Serializable (Y/Yes/N/No) [Y]:
Resource adapter config properties [enter to quit]:
Name:
Managed connection factory class name [MyManagedConnectionFactory]:
Managed connection factory config properties [enter to quit]:
Name:
Use ResourceAdapterAssociation (Y/Yes/N/No) [Y]:
Managed connection class name [MyManagedConnection]:
Use CCI (Y/Yes/N/No) [N]:
Connection factory interface class name [MyConnectionFactory]:
Connection factory implementation class name [MyConnectionFactoryImpl]:
Connection interface class name [MyConnection]:
Connection implementation class name [MyConnectionImpl]:
Add methods to connection interface (Y/Yes/N/No) [N]: Y
Method name [enter to quit]: getHelloWorld
Return type: String
Parameter name [enter to quit]:
Exception type:
Method name [enter to quit]:
Additional managed connection factory (Y/Yes/N/No) [N]:
Include an admin object (Y/Yes/N/No) [N]:
Generate a MBean class (Y/Yes/N/No) [Y]: N
Integrate EIS test server (Y/Yes/N/No) [N]:
Use JBoss Logging (Y/Yes/N/No) [N]: Y
Build environment [A/Ant/I/Ant+Ivy/M/Maven/G/Gradle] [A]:
Code generated
3) Step into the 'out' directory and edit 'MyManagedConnection.java' to add some output to the method 'getHelloWorld()':
String getHelloWorld()
{
log.trace("getHelloWorld()");
return "Hello World from My JCA Resource Adapter!";
}
4) Run ant within the 'out' directory to build the classfiles and the RAR
5) Step into your <jboss_home>/modules directory and create beneeth the following path: com/jca/myadapter/main, so your path should like this '<jboss_home>/modules/com/jca/myadapter/main'
6) Copy the file 'myadapter.rar' from out/target of the codegenerator to '<jboss_home>/modules/com/jca/myadapter/main'
7) Unpack the RAR on the same level! So the myadapter.jar and META-INF should appear within '<jboss_home>/modules/com/jca/myadapter/main'.
You may remove the myadapter.rar.
8) Within '<jboss_home>/modules/com/jca/myadapter/main' create a file named 'module.xml' with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.jca.myadapter">
<resources>
<resource-root path="."/>
<resource-root path="myadapter.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="org.jboss.logging"/>
</dependencies>
</module>
9) NOTE: This entry in module.xml is very important: <resource-root path="."/>
10) Open the file 'standard.xml' from <jboss_home>/standalone/configuration'
11) Introduce your resource adapter as global module:
<subsystem xmlns="urn:jboss:domain:ee:1.2">
<global-modules>
<module name="com.jca.myadapter" slot="main"/>
</global-modules>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<annotation-property-replacement>false</annotation-property-replacement>
</subsystem>
12) Add also a resource adapter definition in 'standalone.xml':
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
<resource-adapters>
<resource-adapter id="MyResourceAdapter">
<module slot="main" id="com.jca.myadapter"/> <transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="
com.jca.myadapter.MyManagedConnectionFactory" jndi-name="java:/eis/MyConnectionFactory" enabled="true" pool-name="MyAdapter">
<security>
<application/>
</security>
<validation>
<background-validation>false</background-validation>
</validation>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
...
13) Start your JBoss instance and check, whether the adapter was registered as module:
13:13:58,108 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) JBWEB003000: Coyote HTTP/1.1 starting on: http-/
127.0.0.1:808013:13:58,264 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) JBAS010406: Registered connection factory java:/eis/MyConnectionFactory
13:13:58,280 INFO [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-3) IJ020002: Deployed: file:/E:/JBoss/jboss-eap-6.4.0/jboss-eap-6.4/modules/com/jca/myadapter/main/
13:13:58,295 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) JBAS010401: Bound JCA ConnectionFactory [java:/eis/MyConnectionFactory]
14) Now you can create your own EAR accessing the resource adapter. Add the 'myadapter.jar' to your library path of your project.
15) add the following imports to your project:
import com.jca.myadapter.MyConnection;
import com.jca.myadapter.MyConnectionFactory;
16) add the follwoing code to test the adapter:
try {
log.debug("--- before InitialContext ---");
InitialContext ctx = new InitialContext();
log.debug("--- before (MyConnectionFactory) ctx.lookup ---");
MyConnectionFactory mycf = (MyConnectionFactory) ctx.lookup("java:/eis/MyConnectionFactory");
log.debug("--- before mycf.getConnection() ---");
MyConnection myConnection = (MyConnection)mycf.getConnection();
log.debug("--- before myConnection.getHelloWorld() ---");
strWorld = myConnection.getHelloWorld();
log.debug("From myConnection: " + strWorld);
log.debug("--- before myConnection.close() ---");
myConnection.close();
log.debug("--- DONE! ---");
} catch (Exception ex) {
log.debug("################## START EXCEPTION ##############################");
log.debug(ex.getMessage());
log.debug("################## END EXCEPTION ##############################");
}
I hope I can help with this steps anyone who has the same troubles.
Best Regards
Peter