General J2EE: Problem with DataSource Look Up

  1. Problem with DataSource Look Up (2 messages)

    I am doing a look up for Datasource on Websphere from a java client. The code and exception is as follow
    I have classes12.jar, cm.jar, j2ee.jar, rt.jar and websphere.jar in my classpath.

    private void lookUp()
         Connection conn = null;
                java.util.Hashtable parms = new java.util.Hashtable();
                parms.put( Context.PROVIDER_URL, url );
    parms.put( Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

                InitialContext ctx = new InitialContext(parms);
                System.out.println("InitialContext ctx ::: " + ctx);
    Object ref = ctx.lookup("target");

    System.out.println("ds ::: " + ref.getClass().getName());

    DataSource corrXmlApiHome = (DataSource)PortableRemoteObject.narrow(ref, DataSource.class);


    conn = corrXmlApiHome.getConnection();
    System.out.println("Connection ::: " + conn);

            catch(Exception e)
             System.out.println("Exception e " + e.getClass().getName());
    System.out.println("Exception e " + e.getMessage());

    Exception e com.ibm.ejs.jts.jts.CurrentSet$InitializationError
    Exception e not initialized
    com.ibm.ejs.jts.jts.CurrentSet$InitializationError: not initialized
    at com.ibm.ejs.jts.jts.CurrentSet.self(CurrentSet.java:218)
    at com.ibm.ejs.jts.jts.CurrentSet.get_control(CurrentSet.java:265)
    at com.ibm.ejs.jts.jts.Current.get_control(Current.java:72)
    at com.ibm.ejs.util.tran.Util.getCoordinator(Util.java:13)
    at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:686)
    at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:312)
    at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:129)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:127)
    at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:102)
    at Client.lookUp(Client.java:54)
    at Client.main(Client.java:29)

    Thanks in Advance

    Makarand Parab
  2. Problem with DataSource Look Up[ Go to top ]

    I don't know WS but generally speaking you don't need to IIOP semantics of PortableRemoteObject for datasource lookups, as these are never remote objects, being referenced via the container.
  3. Problem with DataSource Look Up[ Go to top ]


    I am trying quite the same stuff: Looking up a datasource from a Websphere App Srv in the same way.

    Have you managed to solve the problem???