Done with the Java classes. We will now add into the META-INF folder the ironjacamar.xml file which contains the connection definition which will be used by the resource adapter clients:


In order to build the project, we will add the required dependencies to the pom.xml, including the RAR Maven plugin which will generate a RAR file, including the ironjacamar.xml descriptor:

<project xmlns="" xmlns:xsi=""













Build and deploy the project with:

$ mvn clean install rar:rar wildfly:deploy

Finally, here's a Test Servlet which can be used to test our resource adapter:

package com.sample;


import javax.annotation.Resource;
import javax.resource.ResourceException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

 import com.sample.adapter.HelloWorldConnection;
 import com.sample.adapter.HelloWorldConnectionFactory;

public class TestRA extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@Resource(mappedName = "java:/eis/HelloWorld")
	private HelloWorldConnectionFactory connectionFactory;

	 public TestRA() {
	     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    	  String result = null;
	  	  HelloWorldConnection connection = null;
	        try {
	         	 connection = connectionFactory.getConnection();	  	       
		         result = connection.helloWorld();
	        } catch (ResourceException e) {
	            // TODO Auto-generated catch block

	        PrintWriter out = response.getWriter();

	      //  connection.close();

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);


In order to be able to run your client application provide a dependency through the WEB-INF/jboss-deployment-structure.xml file as follows:

      <module name="deployment.jca-demo-1.0.rar" />

Now test your application:

$ curl http://localhost:8080/raclient/TestRA

HelloWorld WildFly!

Build the Project with Eclipse

If you are not using Maven to build your projects, you can still use a Wizard which is built-in with Eclipse. All you have to do is creating a new Connector Project from Eclipse (You can also use an ordinary Java Project, however the Connector project has the advantage of automatically publishing the project as RAR archive to WildFly ):

jca tutorial jboss rar resource adapter 

Your Connector classes will be, by default, placed into the connectorModule folder:

jca tutorial jboss rar resource adapter

Finally, the last screenshot allows you to include or not the standard descriptor for the resource adapter (ra.xml). This is not a mandatory step as we will use the custom resource adapter from the IronJacamer project named ironjacamar.xml.

jca tutorial jboss rar resource adapter

Finish by copying the source from guthub into the connectorModule folder and you are done!