• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic