10 Replies Latest reply on Sep 10, 2016 11:41 AM by Zefa Guan

    facing performane issue when setup narayana JTA and txbridge out of JBoss

    Zefa Guan Newbie

      when I setup txbridge under Tomcat8 out of JBoss, I am facing performance issue as below scenario;
      1) running 3 tomcat instances
      2) A call B via WS
      3) B call C via WS
      4) when 100 - 200 GET query from " http://localhost:8081/user?action=add " via Service A, all 3 tomcat got stuck for a while then raise exception with attached logs

      sth similar with quickstart example but no EJB and out of JBoss from https://github.com/jbosstm/quickstart/tree/master/XTS
      ==================================================
      WS-AT to JTA (Multi Hop)

      This example demonstrates a JTA client that invokes a remote EJB over Web services. The JTA transaction is distributed to the remote EJB using WS-AtomicTransaction. The service also acts as a client to a second service. Again using WS-AT to distribute the transaction over Web services.
      ==================================================

       

      servlet client - localhost:8081/user?action=add
      |

      --------------------------------------------------------------

      ServiceA Tomcat
      Narayana JTA
      Webservie - localhost:8082/user?action=add

      --------------------------------------------------------------

      |
      txbridge
      |

      --------------------------------------------------------------

      ServiceB Tomcat
      Narayana JTA
      Webservie - localhost:8083/user?action=add

      --------------------------------------------------------------

      |
      txbridge
      |

      --------------------------------------------------------------

      ServiceB Tomcat
      Narayana JTA

      --------------------------------------------------------------

       

       

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

      ---------------------------------------------

      this may caused by race condition/socket timeout/exceed limits, will need to reproduce and research more;

      at the beginning I thought it was caused by DB resource locking failed but after I commented out all DB access, the problem still there

      put all my code to https://github.com/JonkeyGuan/txbridgeInTomcat8 for reproducing and reference

       

      my question is

      1) is there any existing parameters for short-term solution?

      2) could you confirm the performance issue?

        • 1. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
          Gytis Trikleris Apprentice

          Zefa,

           

          XTS and TXBridge are normally used inside WildFly or EAP because they require quite a bit of configuration. We do not test them on Tomcat, so I'm unable to point you to the example of how to configure them properly for Tomcat. Would you be able to run your tests on WildFly to see if they work there?

          Also, I see a lot of "Could not get org.jboss.ws.spi module classloader: java.lang.ClassNotFoundException: org.jboss.modules.Module" errors in the logs, so I'm guessing the failure is caused by misconfiguration rather than a performance issue.

          • 2. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
            Zefa Guan Newbie

            Hi Gytis,

             

            I tried EAP 7.0 today, unfortunately got NPE of txbridge outbound. I put all my test code to https://github.com/JonkeyGuan/txbridgeInEAP7

            I was using the same approach as I did in Tomcat 8.

             

            could you help to figure out the reason and provide the correct approach of txbridge outbound?

             

             

            list exception below:

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

            22:12:15,322 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016: Replaced deployment "ServiceA1.war" with deployment "ServiceA1.war"

            22:12:19,328 INFO  [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (default task-9) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring

            22:12:19,382 INFO  [com.test.user.service.UserServiceImpl] (default task-11) updating local user ...

            22:12:19,387 INFO  [com.test.user.service.UserServiceImpl] (default task-11) updated

            22:12:19,387 INFO  [com.test.user.service.UserServiceImpl] (default task-11) updating remote user ...

            22:12:19,412 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-11) Creating Service {http://service.user.test.com/}inboundUserService from WSDL: http://localhost:8280/ServiceB1/inboundUserService?wsdl

            22:12:19,417 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-11) Creating Service {http://service.user.test.com/}inboundUserService from WSDL: http://localhost:8280/ServiceB1/inboundUserService?wsdl

            22:12:19,432 ERROR [org.jboss.jbossts.txbridge] (default task-11) java.lang.NullPointerException

            22:12:19,433 INFO  [com.test.user.service.UserServiceImpl] (default task-11) updated

            22:15:23,710 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-13) Creating Service {http://service.user.test.com/}UserService from WSDL: http://localhost:8180/ServiceA1/UserService?wsdl

            22:15:23,713 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-13) Creating Service {http://service.user.test.com/}UserService from WSDL: http://localhost:8180/ServiceA1/UserService?wsdl

            22:15:23,724 INFO  [com.test.user.service.UserServiceImpl] (default task-15) updating local user ...

            22:15:23,730 INFO  [com.test.user.service.UserServiceImpl] (default task-15) updated

            22:15:23,730 INFO  [com.test.user.service.UserServiceImpl] (default task-15) updating remote user ...

            22:15:23,743 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-15) Creating Service {http://service.user.test.com/}inboundUserService from WSDL: http://localhost:8280/ServiceB1/inboundUserService?wsdl

            22:15:23,748 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (default task-15) Creating Service {http://service.user.test.com/}inboundUserService from WSDL: http://localhost:8280/ServiceB1/inboundUserService?wsdl

            22:15:23,758 ERROR [org.jboss.jbossts.txbridge] (default task-15) java.lang.NullPointerException

            22:15:23,759 INFO  [com.test.user.service.UserServiceImpl] (default task-15) updated

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

             

            core code:

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

             

            @WebService(portName = "OutbounUserPort", serviceName = "OutboundUserService", endpointInterface = "com.test.user.service.UserService")

            @HandlerChain(file = "/jaxws-handlers-outbound.xml")

            public class OutboundUserServiceImpl extends UserServiceImpl {

             

            }

            ------------------------------------------

            jaxws-handlers-inbound.xml

             

            <!-- Server side config file for inbound bridging -->

            <handler-chains xmlns="http://java.sun.com/xml/ns/javaee"

                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">

             

                <handler-chain>

                    <protocol-bindings>##SOAP11_HTTP</protocol-bindings>

                    <handler>

                        <handler-name>TransactionBridgeHandler</handler-name>

                        <handler-class>org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler</handler-class>

                    </handler>

             

                    <handler>

                        <handler-name>WebServicesTxContextHandler</handler-name>

                        <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>

                    </handler>

             

                </handler-chain>

            </handler-chains>

            ------------------------------------------

             

            public class ClientFactory {

             

                private static URL loalServiceURL;

                private static URL remoteServiceURL;

                static {

                try {

                    loalServiceURL = new URL("http://localhost:8180/ServiceA1/UserService?wsdl");

                } catch (MalformedURLException e) {

                    e.printStackTrace();

                }

                try {

                    remoteServiceURL = new URL("http://localhost:8280/ServiceB1/inboundUserService?wsdl");

                } catch (MalformedURLException e) {

                    e.printStackTrace();

                }

                }

             

                private static QName localQName = new QName("http://service.user.test.com/", "UserService");

                private static QName remoteQName = new QName("http://service.user.test.com/", "inboundUserService");

             

                public static UserService getClient() {

                return getClient(loalServiceURL, localQName);

                }

             

                public static UserService getRemoteClient() {

                UserService client = getClient(remoteServiceURL, remoteQName);

                BindingProvider bindingProvider = (BindingProvider) client;

                bindingProvider.getBinding().setHandlerChain(getOutboundHandlers());

                return client;

                }

             

                private static UserService getClient(URL url, QName qName) {

                UserService client = null;

                Service service = Service.create(url, qName);

                client = service.getPort(UserService.class);

                return client;

                }

             

                @SuppressWarnings("rawtypes")

                private static List<Handler> getOutboundHandlers() {

                List<Handler> handlers = new ArrayList<Handler>();

                handlers.add(new JaxWSTxOutboundBridgeHandler());

                handlers.add(new JaxWSHeaderContextProcessor());

                return handlers;

                }

             

            }

             

            ------------------------------------------

             

            @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
            public void updateUser(User user) {

                log.info("updating local user ...");

                userMapper.updateByID(user);

                log.info("updated");

             

                // for the dups to rollback

                // userMapper.add(user);

             

                 log.info("updating remote user ...");

                 ClientFactory.getRemoteClient().updateUser(user);

                 log.info("updated");

            }
            • 3. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
              Gytis Trikleris Apprentice

              Zefa,

               

              when running on EAP you should make a couple of modifications to your code. Firstly, Narayana dependencies should be in a provided scope. Secondly, you don't need to provide handler chain unless you disable default context propagation in XTS subsystem configuration.

               

              It's hard to tell why are you getting that NullPointerException from the log provided. Could you enable trace logging for com.arjuna and org.jboss.jbossts packages? Set console handler's level to trace and replace current com.arjuna logger in standalone-xts.xml logging configuration with the following:

              <logger category="com.arjuna">

                  <level name="TRACE"/>

              </logger>

              <logger category="org.jboss.jbossts">

                  <level name="TRACE"/>

              </logger>

              • 4. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                Zefa Guan Newbie

                Hi Gytis,

                 

                Thanks for the advice.

                I can get more log now, but I'd like to setup txbridge between ServiceB1 and Service C1.

                I tried to remove handler chain, after that txbridge did not been triggered, attached logs of B1 and C1.

                I guess handler chain is still needed. will try more.

                • 5. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                  Zefa Guan Newbie

                  Hi Gytis,

                   

                  when I add "@HandlerChain(file = "/jaxws-handlers-inbound.xml")" back to ServiceC1, I got exception during deploy, as I changed Narayana dependencies to provided.

                   

                  23:59:09,886 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ServiceC1.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ServiceC1.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ServiceC1.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"ServiceC1.war\"

                      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0024: Could not configure component com.test.user.service.InboundUserServiceImpl-com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor

                      Caused by: java.lang.ClassNotFoundException: com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor from [Module \"deployment.ServiceC1.war:main\" from Service Module Loader]"}}

                  23:59:09,909 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 36) WFLYSRV0010: Deployed "ServiceC1.war" (runtime-name : "ServiceC1.war")

                  23:59:09,916 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report

                  WFLYCTL0186:  Services which failed to start:      service jboss.deployment.unit."ServiceC1.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ServiceC1.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "ServiceC1.war"

                   

                  I will need to package all Narayana dependencies to war

                  • 6. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                    Zefa Guan Newbie

                    Hi Gytis,

                     

                    added more log of NPE, attached whole log, still no clue.

                     

                    2016-09-08 00:32:10,486 TRACE [org.jboss.jbossts.txbridge] (default task-5) JaxWSTxOutboundBridgeHandler.handleMessage()

                    2016-09-08 00:32:10,486 TRACE [org.jboss.jbossts.txbridge] (default task-5) JaxWSTxOutboundBridgeHandler.handleOutbound()

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Finding class org.jboss.jbossts.txbridge.outbound.OutboundBridgeManager from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Finding local class org.jboss.jbossts.txbridge.outbound.OutboundBridgeManager from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Loading class org.jboss.jbossts.txbridge.outbound.OutboundBridgeManager locally from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Attempting to define class org.jboss.jbossts.txbridge.outbound.OutboundBridgeManager in Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Defined class org.jboss.jbossts.txbridge.outbound.OutboundBridgeManager in Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.modules] (default task-5) Finding class javax.transaction.xa.XAResource from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,486 TRACE [org.jboss.jbossts.txbridge] (default task-5) OutboundBridgeManager.getOutboundBridge()

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Finding class com.arjuna.ats.jta.TransactionManager from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Finding local class com.arjuna.ats.jta.TransactionManager from Module "org.jboss.jts:main" from local module loader @46f5f779 (finder: local module finder @1c2c22f3 (roots: /Store/Huawei/workspaceB/jboss-eap-7.0-B/modules,/Store/Huawei/workspaceB/jboss-eap-7.0-B/modules/system/layers/base))

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Found previously loaded class com.arjuna.ats.jta.TransactionManager from Module "org.jboss.jts:main" from local module loader @46f5f779 (finder: local module finder @1c2c22f3 (roots: /Store/Huawei/workspaceB/jboss-eap-7.0-B/modules,/Store/Huawei/workspaceB/jboss-eap-7.0-B/modules/system/layers/base))

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Finding class com.arjuna.ats.jta.transaction.Transaction from Module "deployment.ServiceB1.war:main" from Service Module Loader

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Finding local class com.arjuna.ats.jta.transaction.Transaction from Module "org.jboss.jts:main" from local module loader @46f5f779 (finder: local module finder @1c2c22f3 (roots: /Store/Huawei/workspaceB/jboss-eap-7.0-B/modules,/Store/Huawei/workspaceB/jboss-eap-7.0-B/modules/system/layers/base))

                    2016-09-08 00:32:10,487 TRACE [org.jboss.modules] (default task-5) Found previously loaded interface com.arjuna.ats.jta.transaction.Transaction from Module "org.jboss.jts:main" from local module loader @46f5f779 (finder: local module finder @1c2c22f3 (roots: /Store/Huawei/workspaceB/jboss-eap-7.0-B/modules,/Store/Huawei/workspaceB/jboss-eap-7.0-B/modules/system/layers/base))

                    2016-09-08 00:32:10,487 ERROR [org.jboss.jbossts.txbridge] (default task-5) java.lang.NullPointerException

                    2016-09-08 00:32:10,487 FINE  [org.apache.cxf.endpoint.ClientImpl] (default task-5) Interceptors contributed by bus: [org.jboss.wsf.stack.cxf.client.configuration.SecurityProviderConfig$Interceptor@34d02e74, org.apache.cxf.ws.policy.PolicyInInterceptor@a11fcaf]

                    2016-09-08 00:32:10,487 FINE  [org.apache.cxf.endpoint.ClientImpl] (default task-5) Interceptors contributed by client: []

                    • 7. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                      Zefa Guan Newbie

                      Hi Gytis,

                       

                      I tried to debug, looks like no current transaction.

                       

                      public class OutboundBridgeManager

                       

                          public static org.jboss.jbossts.txbridge.outbound.OutboundBridge getOutboundBridge()

                          {

                              txbridgeLogger.logger.trace("OutboundBridgeManager.getOutboundBridge()");

                       

                              try

                              {

                                  Transaction transaction = (Transaction)TransactionManager.transactionManager().getTransaction(); //<----transaction is null

                       

                                  Uid externalTxId = transaction.get_uid();

                       

                                  if(!outboundBridgeMappings.containsKey(externalTxId)) {

                                      createMapping(transaction, externalTxId);

                                  }

                       

                                  return outboundBridgeMappings.get(externalTxId);

                       

                              }

                              catch(SystemException e)

                              {

                                  txbridgeLogger.logger.error(e);

                              }

                       

                              return null;

                          }

                       

                      my spring configuration

                       

                      <?xml version="1.0" encoding="UTF-8"?>

                       

                      <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"

                        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jdbc="http://www.springframework.org/schema/jdbc"

                        xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring" xmlns:jee="http://www.springframework.org/schema/jee" xmlns="http://www.springframework.org/schema/beans"

                        xsi:schemaLocation=

                            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd 

                         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 

                         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 

                         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 

                         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd  

                         http://www.springframework.org/schema/jdbc

                         http://www.springframework.org/schema/jdbc/spring-jdbc.xsd

                         http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring

                         http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.2.xsd">

                       

                        <jdbc:initialize-database data-source="dataSource">

                        <jdbc:script location="classpath:database/schema.sql" />

                        <jdbc:script location="classpath:database/data.sql" />

                        </jdbc:initialize-database>

                       

                        <bean id="wsSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

                        <property name="dataSource" ref="dataSource" />

                        <property name="typeAliasesPackage" value="com.test.user.domain" />

                        </bean>

                       

                        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

                        <property name="basePackage" value="com.test.user.mapper" />

                        <property name="sqlSessionFactoryBeanName" value="wsSqlSessionFactory" />

                        </bean>

                       

                        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" />

                        <tx:annotation-driven transaction-manager="transactionManager" />

                       

                        <!-- enable autowire -->

                        <context:annotation-config />

                       

                        <jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/ExampleXADS" />

                       

                      </beans>

                       

                      could you suggest please?

                      • 8. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                        Gytis Trikleris Apprentice

                        Could you make sure your logging subsystem configuration looks like example below? Because it's generating a lot of trace logging of other subsystems and it's hard to follow. Also could you also include log of only one start and execution. Because now each log is over 50MB.

                         

                                <subsystem xmlns="urn:jboss:domain:logging:3.0">

                                    <console-handler name="CONSOLE">

                                        <level name="TRACE"/>

                                        <formatter>

                                            <named-formatter name="COLOR-PATTERN"/>

                                        </formatter>

                                    </console-handler>

                                    <periodic-rotating-file-handler name="FILE" autoflush="true">

                                        <formatter>

                                            <named-formatter name="PATTERN"/>

                                        </formatter>

                                        <file relative-to="jboss.server.log.dir" path="server.log"/>

                                        <suffix value=".yyyy-MM-dd"/>

                                        <append value="true"/>

                                    </periodic-rotating-file-handler>

                                    <logger category="com.arjuna">

                                        <level name="TRACE"/>

                                    </logger>

                                    <logger category="org.jboss.jbossts">

                                        <level name="TRACE"/>

                                    </logger>

                                    <logger category="org.jboss.as.config">

                                        <level name="INFO"/>

                                    </logger>

                                    <logger category="sun.rmi">

                                        <level name="WARN"/>

                                    </logger>

                                    <root-logger>

                                        <level name="INFO"/>

                                        <handlers>

                                            <handler name="CONSOLE"/>

                                            <handler name="FILE"/>

                                        </handlers>

                                    </root-logger>

                                    <formatter name="PATTERN">

                                        <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>

                                    </formatter>

                                    <formatter name="COLOR-PATTERN">

                                        <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>

                                    </formatter>

                                </subsystem>

                        • 9. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                          Gytis Trikleris Apprentice

                          This error you might be getting because you don't have a Manifest dependency on org.jboss.xts subsystem.

                          • 10. Re: facing performane issue when setup narayana JTA and txbridge out of JBoss
                            Zefa Guan Newbie

                            Hi Gytis,

                             

                            the error is caused by no available transaction. I changed them all to Spring managed transaction, all looks good now.

                            you are right, handler chain is not needed.  updated GitHub - JonkeyGuan/txbridgeInEAP7: Testing txbridge in JBoss EAP7

                            no performance issue.

                             

                            web.xml

                            <context-param>
                                <param-name>contextConfigLocation</param-name>
                                <param-value>classpath:application-context.xml</param-value>
                            </context-param>

                             

                            <listener>
                                <listener-class>
                                    org.springframework.web.context.ContextLoaderListener
                                </listener-class>
                            </listener>

                             

                            <servlet>
                                <servlet-name>jaxws-servlet</servlet-name>
                                <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
                            </servlet>

                             

                            <servlet-mapping>
                                <servlet-name>jaxws-servlet</servlet-name>
                                <url-pattern>*.ws</url-pattern>
                            </servlet-mapping>

                               

                            <servlet>
                               <servlet-name>User-Servlet</servlet-name>
                               <servlet-class>com.test.user.UserServlet</servlet-class>

                                </servlet>

                             

                                <servlet-mapping>

                               <servlet-name>User-Servlet</servlet-name>
                               <url-pattern>/user</url-pattern>

                                </servlet-mapping>

                             

                             

                            Spring bean

                             

                            <jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/ExampleXADS" />

                             

                                <jdbc:initialize-database data-source="dataSource">

                               <jdbc:script location="classpath:database/schema.sql" />
                               <jdbc:script location="classpath:database/data.sql" />

                                </jdbc:initialize-database>

                             

                                <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

                               <property name="dataSource" ref="dataSource" />

                                </bean>

                             

                                <tx:annotation-driven transaction-manager="transactionManager" />

                             

                                <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

                               <property name="dataSource" ref="dataSource" />
                               <property name="typeAliasesPackage" value="com.test.user.domain" />

                                </bean>

                             

                                <bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">

                               <property name="mapperInterface" value="com.test.user.mapper.UserMapper" />
                               <property name="sqlSessionFactory" ref="sqlSessionFactory" />

                                </bean>

                             

                                <bean id="userServivceImpl" class="com.test.user.service.UserServiceImpl">

                               <property name="userMapper" ref="userMapper" />

                                </bean>

                             

                                <context:component-scan base-package="com.test.user.ws" />

                                <context:annotation-config />

                             

                                <wss:binding url="/user.ws">

                               <wss:service>
                               <ws:service bean="#userServiceWS" impl="com.test.user.ws.UserServiceWS" />
                               </wss:service>

                                </wss:binding>