1 Reply Latest reply on Sep 9, 2010 7:53 PM by codenombre

    Arjuna TX Manager Class Cast Exception

    rupertlssmith

      Hi,

      On JBoss 4.2.2GA, I get the following exception:

      java.lang.ClassCastException: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to javax.transaction.TransactionManager
       at org.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
       at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:325)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)


      Another Forum post suggested this might be because of having the 'jta' jar in the .ear file I am trying to deploy. I checked and sure enough it was there as part of the hibernate dependencies I included. 'jta.jar' does not need to be in the .ear file as the app server already provides it. So I removed it, but I still get the above error.

      So now my dependency set of jars that are in my .ear file looks like (created with mvn dependency:tree):

      [dependency:tree]
      [INFO] uk.co.thebadgerset:thecookerybook-dev:ear:0.3-SNAPSHOT
      [INFO] +- uk.co.thebadgerset:thecookerybook-backend:jar:0.3-SNAPSHOT:compile
      [INFO] | +- uk.co.thebadgerset:common:jar:0.3-SNAPSHOT:compile
      [INFO] | | +- log4j:log4j:jar:1.2.13:compile
      [INFO] | | +- regexp:regexp:jar:1.3:compile
      [INFO] | | +- xml-apis:xml-apis:jar:1.3.03:compile
      [INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
      [INFO] | | +- xerces:xercesImpl:jar:2.8.0:compile
      [INFO] | | \- xalan:xalan:jar:2.7.0:compile
      [INFO] | +- uk.co.thebadgerset:configurator:jar:0.3-SNAPSHOT:compile
      [INFO] | | +- javax.xml.bind:jsr173_api:jar:1.0:compile
      [INFO] | | +- javax.xml.bind:jaxb-api:jar:2.1:compile
      [INFO] | | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
      [INFO] | | | \- javax.activation:activation:jar:1.1:compile
      [INFO] | | \- com.sun.xml.bind:jaxb-impl:jar:2.1.7:compile
      [INFO] | +- uk.co.thebadgerset:catalogue:ejb:0.3-SNAPSHOT:compile
      [INFO] | | +- uk.co.thebadgerset:locator:jar:0.3-SNAPSHOT:compile
      [INFO] | | +- uk.co.thebadgerset:catalogue-model:jar:0.3-SNAPSHOT:compile
      [INFO] | | +- uk.co.thebadgerset:index-ra-client:jar:0.3-SNAPSHOT:compile
      [INFO] | | \- org.hibernate:hibernate:jar:3.2.6.ga:compile
      [INFO] | | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
      [INFO] | | +- commons-logging:commons-logging:jar:1.0.4:compile
      [INFO] | | +- asm:asm-attrs:jar:1.5.3:compile
      [INFO] | | +- antlr:antlr:jar:2.7.6:compile
      [INFO] | | +- cglib:cglib:jar:2.1_3:compile
      [INFO] | | +- asm:asm:jar:1.5.3:compile
      [INFO] | | \- commons-collections:commons-collections:jar:2.1.1:compile
      [INFO] | +- uk.co.thebadgerset:index:jar:0.3-SNAPSHOT:compile
      [INFO] | \- uk.co.thebadgerset:aima:jar:0.3-SNAPSHOT:compile
      [INFO] +- uk.co.thebadgerset:thecookerybook-backend:jar:config:0.3-SNAPSHOT:compile
      [INFO] \- uk.co.thebadgerset:thecookerybook-web:war:0.3-SNAPSHOT:compile
      


      I'm confused by the class cast exception because I now expect that there should be only one copy of 'com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate' and 'javax.transaction.TransactionManager' on the classpath and that the former does indeed extend the latter. Is this happening because I have included the Hibernate jars in my .ear file instead of using the container supplied version?

      Any help is appreciated, thanks.

      Rupert