How to write a client..?


EJB programming & troubleshooting: How to write a client..?

  1. How to write a client..? (5 messages)

    Hi Guys.. I'm trying to write a client for a bean which is deployed as transaction attribute as MANDATORY. A normal client fails saying TransactionRequiredException. Can some one tell me how to start/create a transaction at the client ? or u can some other way of writing a client for MANDATORY.
    Any help is appreciated.
    Thanks in advance.

    Threaded Messages (5)

  2. How to write a client..?[ Go to top ]

    You need to start a UserTransaction on your client. If you're connecting via RMI/IIOP this may not be possible, as not all (iPlanet for instance) app servers allow you start a transaction remotely.

    For example (from the iPlanet docs):-

    InitialContext ctx = null;
    String dsName1 = "jdbc/GlobalSampleDS";
    DataSource ds1 = null;

       ctx = new InitialContext();
       ds1 = (DataSource)ctx.lookup(dsName1);

       UserTransaction tx = ejbContext.getUserTransaction();


       Connection conn1 = ds1.getConnection();

       // use conn1 to do some database work -- note that conn1.commit(),
       // conn1.rollback() and conn1.setAutoCommit() can not used here


    } catch(Exception e) {
  3. How to write a client..?[ Go to top ]

    Hi Many Thanks for the response. But I'm using WebLogic 6.0/6.1 and in the code which u wrote there is one ejbContext variable/instance is there could u explain me from where it has come ? i'm not able to understand.

    Thanks in advance.
  4. How to write a client..?[ Go to top ]

    I bet Richard is using the ejbContext that is available for you to store when the container invokes the setEntityContext(EntityContext ctx).

  5. How to write a client..?[ Go to top ]

    Check the weblogic documentation, I found this in 5 minutes :-)

  6. How to write a client..?[ Go to top ]

    do you still need help regarding that ...