• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with DataSource lookup through java client

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
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.

Code
****************
private void lookUp()
{
Connection conn = null;
try
{
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);

System.out.println(corrXmlApiHome);

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());
e.printStackTrace();
}
}

Exception
************************
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

Regards
Makarand Parab
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't WebSphere have a facility whereby you can run a J2EE client within the client container? The client container would take care of setting all that stuff up for you.
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI james
Thanks for responding, I am writing a batch application and this application is outside the Websphere Application Server.The java client exist on c or d drive from where it will interact with the WAS.

Regards
Makarand parab
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&uid=swg1PQ78401
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic