Re: Very Urgent!. Please help me. - Websphere

This is a discussion on Re: Very Urgent!. Please help me. - Websphere ; I too faced problems when trying to lookup UserTransaction from a standalone client and followed the comments posted here. I managed to overcome the problem and finally get the UserTransction lookup issue solved. Please see if the following steps help ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Re: Very Urgent!. Please help me.

  1. Re: Very Urgent!. Please help me.

    I too faced problems when trying to lookup UserTransaction from a standalone client and followed the comments posted here. I managed to overcome the problem and finally get the UserTransction lookup issue solved. Please see if the following steps help you, they helped me atleast!

    1. In your sample program, add the following steps:
    Context ctx = new InitialContext(environment);
    System.out.println(ctx.getEnvironment());

    from the sysout text, take com.ibm.ws.naming.provider.url and set it to javax.naming.Context.PROVIDER_URL starting from iiop to the port address

    2. Need not specify the VM arguments to run the client standalone program, if you need then follow the arguments posted earlier.
    3. Need not run the launchClient.bat file. If running, check setupCmdLine.bat file and
    sas.client.props, basically all references that launchClient.bat and setupCmdLine.bat files make. Check whether the installation path for websphere is correctly stated.
    4. Run the websphere local server.
    5. If running the launchClient.bat file, you can specify host at command prompt, though not needed:
    C:/launchClient.bat -CCBootstrapHost=your.host.of.choice

    6. Run the dumpNameSpace.bat to see the how is UserTransaction is defined, if it is jta/usertransaction, then specify that string in your lookup string (if java:comp/UserTransaction, then specify that), e.g, ctx.lookup("jta/usertransaction"); This is the string that you need to pass to the look-up.

    7. Run the client. Hope it runs for you.

    Sample code:
    public static void main(String args[]){
    String naming_factory = "com.ibm.websphere.naming.WsnInitialContextFactory";
    String namespace_address = "iiop://providerUrl:2809/";
    String transaction_address = "jta/usertransaction";
    java.util.Hashtable environment = new java.util.Hashtable();
    environment.put(javax.naming.Context.INITIAL_CONTE XT_FACTORY, naming_factory);
    environment.put(javax.naming.Context.PROVIDER_URL, namespace_address);

    try
    {
    Context ctx = new InitialContext(environment);
    System.out.println(ctx.getEnvironment());

    Object remote_object = ctx.lookup(transaction_address);
    UserTransaction tx = (javax.transaction.UserTransaction)remote_object;
    System.out.println("tx----> " + tx);
    }
    catch (javax.naming.NamingException ne) {
    ne.printStackTrace();
    }

  2. Re: Very Urgent!. Please help me.

    medha.vyas@tcs.com wrote:
    > I too faced problems when trying to lookup UserTransaction from a
    > standalone client and followed the comments posted here.


    Well, the better answer is to redesign your application so that you're
    not doing something as ridiculous as starting a transaction at the client.

  3. Re: Very Urgent!. Please help me.

    You are right.

+ Reply to Thread