ClassCastException with jta/usertransaction lookup - Websphere

This is a discussion on ClassCastException with jta/usertransaction lookup - Websphere ; Hi, This is the code that I've been using successfully in WebSphere 5.1. javax.transaction.UserTransaction userTrans = (javax.transaction.UserTransaction)context.lookup("jta/usertransaction"); In WebSphere 5.1, this would return an object of type com.ibm.ws.Transaction.JTA.UserTransactionImpl typecast as a UserTransaction object. In WebSphere 6.1, this fails with a ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: ClassCastException with jta/usertransaction lookup

  1. ClassCastException with jta/usertransaction lookup

    Hi,

    This is the code that I've been using successfully in WebSphere 5.1.

    javax.transaction.UserTransaction userTrans = (javax.transaction.UserTransaction)context.lookup("jta/usertransaction");

    In WebSphere 5.1, this would return an object of type
    com.ibm.ws.Transaction.JTA.UserTransactionImpl typecast as a UserTransaction object.

    In WebSphere 6.1, this fails with a ClassCastException :

    java.lang.ClassCastException: javax.naming.Reference incompatible with javax.transaction.UserTransaction


  2. Re: ClassCastException with jta/usertransaction lookup

    shankar.sathiamurthi@gmail.com wrote:

    > In WebSphere 6.1, this fails with a ClassCastException :
    >
    > java.lang.ClassCastException: javax.naming.Reference incompatible with javax.transaction.UserTransaction
    >

    You are receiving a javax.naming.Reference instance from JNDI rather
    than a javax.transaction.UserTransaction instance because your classpath
    is incomplete. This has prevented the naming service from instantiating
    WAS's UserTransaction implementation.

    In what environment are you attempting to perform the lookup, and what
    JARs do you have on the classpath?

    Regards,
    Andy

  3. Re: ClassCastException with jta/usertransaction lookup

    Hi,

    Thanks for the reply. I'm running a java program as a stand-alone application which will connect to some beans deployed inside the WebSphere 6.1 appserver. I'm using JDK1.5 and I have added ws_runtime.jar and com.ibm.ws.webservices.thinclient_6.1.0.jar to my classpath. Should I do any other steps?

  4. Re: ClassCastException with jta/usertransaction lookup

    shankar.sathiamurthi@gmail.com wrote:
    > Hi,
    >
    > Thanks for the reply. I'm running a java program as a stand-alone
    > application which will connect to some beans deployed inside the
    > WebSphere 6.1 appserver. I'm using JDK1.5 and I have added
    > ws_runtime.jar and com.ibm.ws.webservices.thinclient_6.1.0.jar to my
    > classpath. Should I do any other steps?


    You should install the WAS client runtime, which will make sure that you
    have all the jars you need. See the WAS infocenter for details.

  5. Re: ClassCastException with jta/usertransaction lookup

    Hi,

    Can you give me a link to the specific page in the inforcenter I should be looking at.

  6. Re: ClassCastException with jta/usertransaction lookup

    Can you tell me the set of jars that need to be added to the classpath in a standalone java client application that connects to the beans deployed inside the appserver. I believe this issue is due to a Classpath issue.

  7. Re: ClassCastException with jta/usertransaction lookup

    shankar.sathiamurthi@gmail.com wrote:
    > Hi,
    >
    > Can you give me a link to the specific page in the inforcenter I should be looking at.


    Being able to search documentation by yourself would seem to be part of
    the basic competency needed to be in this business.

  8. Re: ClassCastException with jta/usertransaction lookup

    Hi all,
    anyone has discovered which are the jar to include?

    Thanks a lot

    Paolo

+ Reply to Thread