0 Replies Latest reply on Oct 24, 2007 8:22 AM by chandu_coool@yahoo.co.in chandu_coool@yahoo.co.in

    Jboss + Spring + Hibernate + jboss + testNG + java.lang.Ill

    chandu_coool@yahoo.co.in chandu_coool@yahoo.co.in Newbie

      Hello,
      I am new to spring (Plz help me). I have an working application with Spring,hibernate,Jboss
      and webservices.

      Also posted on Spring Forum (waiting for reply)

      My requirement is to write test cases using TestNg. I have multiple session factories in my configuraiton file and using "org.springframework.transaction.jta.JtaTransactio nManager" as transactionmanager.

      This setup is working fine.
      but when i introduce TestNg in to scene and try to run the test cases(On Webservices) it throws variety of wrrors when jta.jar is added to class path and when it is not.

      if jta.jar is added then i get following error


      Code:
      java.lang.IllegalStateException: Either 'userTransaction' or 'userTransactionName' or 'transactionManager' or 'transactionManagerName' must be specifiedotherwise i get


      Code:
      NoClassDefFoundError: javax/transaction/TransactionManager ...I just unable to understand where i am doing something wrong which is affeting while running TestNg

      Note: Here i am using

      org.springframework.transaction.jta.JtaTransaction Manager as transaction manager even tough i am referring to local resources (databases which are not bound to container) as i have to persist data on the DB's at the same time

      Following is my context.xml file
      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.1.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

      <!-- Configurer that replaces ${...} placeholders with values from a properties file -->
      <!-- (in this case, JDBC-related settings for the dataSource definition below) -->





      /WEB-INF/classes/applicationContext.properties





      <!-- Local C3P0 DataSource that works in any environment -->
      <!-- (This DataSource implementation has a "close" method to be called on shutdown) -->
      <bean id="dtDataSource"
      class="com.mchange.v2.c3p0.ComboPooledDataSource"
      destroy-method="close">






      <bean id="prodDataSource"
      class="com.mchange.v2.c3p0.ComboPooledDataSource"
      destroy-method="close">









      600
      50

      false

      1
      5
      2000
      5
      false
      <!-- Set the release mode to auto, so that the DB connections are released as soon as the transaction is complete. -->

      auto

      true

      false





      <!-- Hibernate SessionFactory -->







      <!-- Must references all OR mapping files. -->


      /hbm/UserListDt.hbm.xml
      /hbm/BoomListParameters.hbm.xml
      /hbm/DtListParameters.hbm.xml
      /hbm/DtParameterTypes.hbm.xml
      /hbm/DtListType.hbm.xml
      /hbm/DataCenterValues.hbm.xml
      /hbm/DtListDataCenters.hbm.xml











      <!-- Must references all OR mapping files. -->


      /hbm/UserListProd.hbm.xml
      /hbm/ProductCategory.hbm.xml
      /hbm/UserListGroup.hbm.xml
      /hbm/User.hbm.xml




      <!-- =================== TRANSACTION ====================== -->




      <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
      <tx:advice id="txAdvice" transaction-manager="transactionManager">
      <!-- the transactional semantics... -->
      <tx:attributes>
      <!-- all methods starting with 'get' are read-only -->
      <tx:method name="get*" read-only="true"
      propagation="REQUIRED" />
      <tx:method name="find*" read-only="true"
      propagation="REQUIRED" />
      <tx:method name="*" propagation="REQUIRED" rollback-for="BoomException" />
      </tx:attributes>
      </tx:advice>
      --------------------------------------------------------------------------------
      Last edited by chandu_coool : Today at 04:32 PM.