Deploying XADisk as a JCA Resource Adapter in JBoss As 7.1.1

1,347 views
Skip to first unread message

Andreas Wurm

unread,
Apr 7, 2012, 12:16:35 PM4/7/12
to XADisk
Hello,

I just managed to get XADisk working on Jboss 7.1.1 and like to share
me findings.

The current release of XADisk (1.2) is not working out of the box.
You have to make slight modifications.

Implement equals and hashCode in
org.xadisk.connector.XADiskResourceAdapter.
Ensure every Class in org.xadisk.filesystem.workers implements run()
and release().
If a method is not present add it like this:

public void run() {
super.run();
}

Now the modified XADisk.rar is ready for deployment. Put in in jboss-
as-7.1.1.Final/standalone/deployments.

Configure the resource adapter:
Open jboss-as-7.1.1.Final/configuration/standalone.xml.
Search for <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>
and replace it with something like this:

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
<resource-adapters>
<resource-adapter>
<archive>
XADisk.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<config-property name="xaDiskHome">
/opt/xadisk/xadisk1
</config-property>
<config-property name="instanceId">
xadisk1
</config-property>
<connection-definitions>
<connection-definition class-
name="org.xadisk.connector.outbound.XADiskManagedConnectionFactory"
jndi-name="java:global/XADiskCF" pool-
name="XADiskConnectionFactoryPool">
<config-property name="instanceId">
xadisk1
</config-property>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
</xa-pool>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>

Make sure to modify the property xaDiskHome according to your system.
Start Jboss. XADisk should now be successfully deployed.

To use the resource have a look at the servlet example.
You dont want to bundle the xadisk.jar into your servlet.war.
Instead add filejboss-deployment-structure.xml to the WEB-INF
directory with the following content:

<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.XADisk.rar" />
</dependencies>
</deployment>
</jboss-deployment-structure>

This will allow your servlet to use the XADisk classes. More details
at
https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

Nitin Verma

unread,
Apr 7, 2012, 1:17:56 PM4/7/12
to XADisk
Hi Andreas,

Many Thanks for sharing the useful information.

For the first change in XADisk which you mentioned, there is a
tracking bug: http://java.net/jira/browse/XADISK-106. I have made a
note to fix it by next release.

The second one is an issue in JBoss/iron-jacamar. One can either use
the workaround you mentioned ("Ensure every Class in
org.xadisk.filesystem.workers implements run()
and release().") and create a new xadisk binary locally or hopefully
it will be fixed soon in a JBoss release. Also, thanks for filing the
iron-jacamar bug: https://community.jboss.org/message/728756.

Regards,
Nitin
Message has been deleted

Nitin Verma

unread,
Apr 10, 2012, 1:41:44 PM4/10/12
to XADisk
FYI...

The second issue, which was in JBoss/iron-jacamar, has been fixed
through bug - https://issues.jboss.org/browse/JBJCA-789. This fix is
available in iron-jacamar version 1.0.10.Final. Though, the latest
version of JBoss AS, which is 7.1.1.Final as of today, uses iron-
jacamar version 1.0.9.Final as per https://community.jboss.org/wiki/AS711FinalReleaseNotes.
So, from the JBoss side, we will still have to wait till JBoss
upgrades its iron-jacamar version further.

Thanks,
Nitin

my.ra...@gmail.com

unread,
Jan 28, 2013, 5:18:21 AM1/28/13
to xad...@googlegroups.com
New Jboss 7.2 has all those updated JARs needed to run XADisk., XADISK.rar deployed using Manage deployment from Admin console.

you can config XADISK on jboss using jboss cli as described on below blog. http://rvsoni.wordpress.com/2013/01/25/xadisk-resource-adapter-configuration-in-jboss-7-2/

I am successfully  able to load XADISk resource adapter in it. when i try to get connection from it. i am getting Exception as below.

Caused by: java.lang.NoClassDefFoundError: org/xadisk/connector/outbound/XADiskConnectionImpl
    at org.xadisk.connector.outbound.XADiskManagedConnection.getConnection(XADiskManagedConnection.java:62) [xadisk-1.2.1.jar:]
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:473)
    ... 91 more

I am able to get object of XADiskConnectionFactory successfully.

@Resource(lookup ="java:/XADiskCF", type = org.xadisk.connector.outbound.XADiskConnectionFactoryImpl.class)
    private XADiskConnectionFactory xaConnectionFactory;

XADIsk JAR is available on my EAR/lib folder.

jboss-deployment-structure.xml File.

<jboss-deployment-structure>
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
    <deployment>
        <dependencies>
            <module name="org.springframework.spring" slot="snowdrop" />

            <module name="deployment.XADisk.rar" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

pl. help me on this, if i am missing any configuration related to XADISK in Jboss.

Nitin Verma

unread,
Feb 7, 2013, 8:43:53 AM2/7/13
to XADisk
Hi Ravi,

Thanks for coming up with the steps. Let me try xadisk deployment over
the new jboss version (7.2) and then I can be able to diagnose the
NoClassDefFoundError.

In the mean time, do let us know if you are able to resolve this.

Thanks,
Nitin

my.ra...@gmail.com

unread,
Feb 11, 2013, 5:53:14 AM2/11/13
to xad...@googlegroups.com
Hi Nitin,

I am able to solve all issue in XADisk to use in Jboss 7.2, its working ok.

after adding XADisk resource to jboss. you need to use following way of Jboss deployment structure

To use in Ejb.
<sub-deployment name="example-ejb-1.0.0-SNAPSHOT.jar">

        <dependencies>

            <module name="deployment.XADisk.rar" />

        </dependencies>

</sub-deployment>

Nitin Verma

unread,
Feb 11, 2013, 5:58:33 AM2/11/13
to xad...@googlegroups.com, my.ra...@gmail.com
Thanks a lot, Ravi.

srnjak...@gmail.com

unread,
Apr 11, 2013, 8:13:58 AM4/11/13
to xad...@googlegroups.com
Hello!

I followed these instructions how to deploy XADisk on JBoss 7.1.1. I use XADisk 1.2.1. It works fine as far as I do local connection. But when I'm trying to configure remote one, i get the following message:

org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.findConnectionDefinitions IJ020009: Invalid connection definition with class-name: org.xadisk.bridge.proxies.interfaces.XADiskRemoteConnectionFactory

My configuration for connection-definition is:
<connection-definition class-name="org.xadisk.bridge.proxies.interfaces.XADiskRemoteConnectionFactory" jndi-name="java:global/XADiskCFRemote" pool-name="XADiskCFRemote">

<config-property name="instanceId">
xadisk1
</config-property>
<config-property name="serverAddress">
localhost
</config-property>
<config-property name="serverPort">
9999

</config-property>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
</xa-pool>
</connection-definition>

Has anyone a clue, how to manage remote connection factory on JBoss 7.1.1?
Message has been deleted

Nitin Verma

unread,
Apr 13, 2013, 9:31:31 AM4/13/13
to XADisk
Hello.

For the remote connection factory, please use the class-name attribute
in the connection-definition as:

org.xadisk.bridge.proxies.impl.XADiskRemoteManagedConnectionFactory

instead of,

org.xadisk.bridge.proxies.interfaces.XADiskRemoteConnectionFactory

This is because, we need to specify the managed connection factory
class name for the class-name attribute.

Please feel free to respond back if you have further queries.

Thanks,
Nitin

auyeun...@gmail.com

unread,
May 4, 2013, 3:36:55 AM5/4/13
to xad...@googlegroups.com, my.ra...@gmail.com
Hi Ravi,

I encounter the same error when I config XADisk on JBoss 7.2, but I can't resolve the problem. Would you please kindly elaborate your solution a bit?
I followed this guide http://rvsoni.wordpress.com/2013/01/25/xadisk-resource-adapter-configuration-in-jboss-7-2/ and add XADisk as resource adapter. But I don't quite understand the last part(<jboss-deployment-structure>) and don't know what should be put in sub-deployment name.

Thank you very much!

Regards,
Jason

my.ra...@gmail.com於 2013年2月11日星期一UTC+8下午6時53分14秒寫道:

Nitin Verma

unread,
May 7, 2013, 9:29:50 AM5/7/13
to XADisk
Hi Jason,

jboss-deployment-structure.xml is one of the artifacts one might need
while deploying applications on jboss7. (You might want to read more
about it here: https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7#ClassLoadinginAS7-JBossDeploymentStructureFile).

Another example of this file, which I wrote for a sample web-
application (nothing but a servlet accessing xadisk), is below:

____________________________________________________________________

<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.XADisk.rar"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

____________________________________________________________________

Please let me know if you have any questions.

Thanks,
Nitin

auyeun...@gmail.com

unread,
May 17, 2013, 5:04:03 AM5/17/13
to xad...@googlegroups.com
Hi Nitin,

Thanks for your reply. I have tried but no luck. When I tried to deploy XADisk as JCA on jboss 7.2, the following warning messages were displayed during server startup and JNDI of XADisk was not bound.
Therefore I got an error saying "No matching bean of type [org.xadisk.connector.outbound.XADiskConnectionFactoryImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class org.xadisk.connector.outbound.XADiskConnectionFactoryImpl, authenticationType=CONTAINER, lookup=java:/XADiskCF)}" when using @resource to get the connection factory.

Would you please kindly have a look? Please let me know if I need to provide more information.

Regards,
Jason

16:50:14,322 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/atomikos-util.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,322 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-api.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,322 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-hibernate2.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,323 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-hibernate3.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,323 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-jdbc-deprecated.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,323 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-jdbc.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,323 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-jms-deprecated.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,323 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-jms.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-jta.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions-osgi.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/transactions.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/geronimo-j2ee-connector_1.5_spec.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/geronimo-jms_1.1_spec.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,324 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/geronimo-jta_1.0.1B_spec.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,325 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/servlet-api.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,325 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/slf4j-api.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,325 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/slf4j-nop.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,325 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/javaee-api-5.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,325 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/connector-api-1.5.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.
16:50:14,326 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015960: Class Path entry lib/tools.jar in /D:/jboss/standalone/deployments/TradingSystem.war/WEB-INF/lib/XADisk.jar  does not point to a valid jar for a Class-Path reference.



Nitin Verma於 2013年5月7日星期二UTC+8下午9時29分50秒寫道:

Nitin Verma

unread,
May 23, 2013, 10:15:51 AM5/23/13
to XADisk
Hi Jason,

Please ignore the all these warnings related to "Class Path entry...".
These entries were left in XADisk.rar\XADisk.jar\META-INF\MANIFEST.MF
by mistake. For the time being, you can remove the "Class-Path" entry
from the manifest file. I have created a bug (https://java.net/jira/
browse/XADISK-135) to track the same.

As you said, the connection factory "XADiskCF" is not getting created.
Do you see any other error when the server attempts to create this
connection factory. It will help me diagnose it if you can please send
me the <resource-adapter> element for xadisk from the jboss
configuration file (standalone.xml).

Thanks,
Nitin

auyeun...@gmail.com

unread,
Jun 1, 2013, 9:52:03 AM6/1/13
to xad...@googlegroups.com
Hi Nitin,

Thanks for your comment! There is no error during jBoss start-up. It just seems that its creation doesn't get triggered.
I used XADiskManager way as a workaround and inject it as spring bean, instead of JCA. So I have not kept the configure file.

Another question I would like to ask is how to change the isolation level? Becuase the following actions will fail with the default isolation level:
1. In one transaction, delete test.txt and create test.txt in the same directory. I would like to replace the file. Or truncate function is the correct way for file replacement?
2. In one transaction, write test.txt and read it back. Will cause fileNotFound exception.

Regards,
Jason

Nitin Verma於 2013年5月23日星期四UTC+8下午10時15分51秒寫道:

Nitin Verma

unread,
Jun 3, 2013, 11:07:12 AM6/3/13
to XADisk
Hi Jason,

At present, there is no way to change the isolation level in xadisk.

XADisk will acquire an exclusive lock for "delete" and "write"
operations in the examples you mentioned. Depending upon which
transaction calls its operation first, the exclusive lock will be
"reserved" with it until the transaction completes. When such
transaction completes, then only the other transaction will be able to
retrieve the exclusive lock and continue. So, the exclusive locking
helps in ensuring consistency with the file, else we may see unknown
results due to concurrent modifications. Are you looking for a
behavior different than this (as you asked about a different isolation
level)? Can you help me understand.

Regards,
Nitin

Nitin Verma

unread,
Nov 6, 2013, 10:24:54 AM11/6/13
to xad...@googlegroups.com
Here is another post for deploying a sample servlet and XADisk 1.2.2. on JBoss AS 7.1.1:

https://groups.google.com/forum/#!topic/xadisk/soANGGx9xOk

Reply all
Reply to author
Forward
0 new messages