• 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 in Accessing DataSource in websphere

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.util.*;
import javax.naming.*;
import javax.naming.NamingException;
public class LotusTest{
public static void main(String args[]){
try{
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
parms.put(Context.PROVIDER_URL, "iiop://192.200.8.224:2809");
//parms.put(Context.PROVIDER_URL, "iiop://192.200.8.224:900");
//This URL will be different if context provider is on another machine, for example "iiop://myserver:900/"
javax.naming.Context Ctx = null;
Ctx = new InitialContext(parms);
javax.sql.DataSource ds = (javax.sql.DataSource)Ctx.lookup("jdbc/DominoDS");
java.sql.Connection conn = ds.getConnection();
}
catch(Exception ee){
ee.printStackTrace();
}
}
}

when i am tring to run the programme written above using launchClient tool in websphere i am getting the following exceptions

WSCL0014I: Invoking the Application Client class LotusTest
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred w
ile the JNDI NamingManager was processing a javax.naming.Reference object. Roo
exception is javax.naming.NamingException: Exception: null
at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceRefe
enceObjectFactory.getObjectInstance(DataSourceFactory.java:767)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:
13)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Help
rs.java:884)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNCont
xtImpl.java:1674)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:
537)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:
457)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:11
7)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at LotusTest.main(LotusTest.java:22)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.websphere.client.applicationclient.launchClient.createContai
erAndLaunchApp(launchClient.java:616)
at com.ibm.websphere.client.applicationclient.launchClient.main(launchC
ient.java:420)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
please help me to sort out this issue
regards
(kumar)
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Websphere forum...
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To ask the obvious question -- will this code run inside of a servlet? That helps us determine if the problem is in your datasource setup or in the client setup.
Kyle
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic