XADisk 1.2.2 on JBoss AS 7.1.1 - An example servlet.

357 views
Skip to first unread message

Nitin Verma

unread,
Nov 6, 2013, 10:19:51 AM11/6/13
to xad...@googlegroups.com
Below are the steps which can be followed to deploy XADisk and a test servlet on JBoss AS 7.1.1. (Please find attached the servlet's .java and the .war files).

1. Download XADisk.rar (version 1.2.2 works on JBoss AS 7.1.1 without any modifications in the source) and copy it to "deployments" directory.

2. Below is a sample configuration which needs to be done in the resource-adapters subsystem of the configuration file (standalone.xml):

=======================================================================

        <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="instanceId">
                        xadisk1
                    </config-property>
                    <config-property name="xaDiskHome">
                        c:\xadisk
                    </config-property>
                    <connection-definitions>
                        <connection-definition class-name="org.xadisk.connector.outbound.XADiskManagedConnectionFactory" jndi-name="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-definition class-name="org.xadisk.bridge.proxies.impl.XADiskRemoteManagedConnectionFactory" jndi-name="xadiskcfRemote" pool-name="XADiskRemoteConnectionFactoryPool">
                            <config-property name="instanceId">
                                xadisk1
                            </config-property>
                            <config-property name="serverAddress">
                                localhost
                            </config-property>
                            <config-property name="serverPort">
                                5151
                            </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>

=======================================================================

3. Test Servlet contains the following code (the .java file is attached with this post):

=======================================================================
            UserTransaction utx = (UserTransaction)new InitialContext().
                    lookup("java:comp/UserTransaction");
            utx.begin();
            XADiskConnectionFactory xadiskCF = (XADiskConnectionFactory)
                    (new InitialContext()).lookup("xadiskcf");
            XADiskConnection xadiskCon = xadiskCF.getConnection();
            xadiskCon.createFile(new File("C:\\test.txt"), false);
            xadiskCon.close();
            utx.commit();
=======================================================================

4. The jboss-deployment-structure.xml file in the META-INF directory of the .war contains the following dependency declaration:

=======================================================================

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

=======================================================================


Please feel free to reply with any additional information and corrections which can be useful to others.

Thanks & Regards,
Nitin
Servlet1.java
TestServlet.war
Message has been deleted

Nitin Verma

unread,
Nov 21, 2013, 8:26:03 AM11/21/13
to xad...@googlegroups.com, lpeer...@gmail.com
Hi Luc,

I copied your xadisk system directory onto my local windows xp machine, and started an xadisk instance pointing to it. It can be seen that you were creating a file with path "C:/test.txt" in the transaction. The transaction, as expected, completes fine on my system. Can you confirm that you saw the above error while creating "C:/test.txt"? This should work in general. Are you able to do a common Java API File.createNewFile() for "C:/test.txt" from a test application (without xadisk) otherwise?

Thanks,
Nitin

Nitin Verma

unread,
Nov 21, 2013, 8:27:59 AM11/21/13
to xad...@googlegroups.com, lpeer...@gmail.com
Also, as the issue is not related to JBoss AS, can you please bring this discussion to a new thread.
Reply all
Reply to author
Forward
0 new messages