Hi,
I am trying to access the datasource object from a stateless session
ejb.
...code follows.
-----------------------
InitialContext ctx = null;
String dsName1 = "jdbc/was3"; // JNDI name
DataSource ds1 = null;
try
{
ctx = new InitialContext();
ds1 = (DataSource)ctx.lookup(dsName1);
} catch(Exception e) {
e.printStackTrace(System.out);
}
It gives errors while running it with the universal
test client of WSAD. It is not able to connect to the remote database. It says 'Network Adapter could not establish the connection', eventhough the database access works very well from other
java application with Driver Manager implementation of connection. It doesn't work while creating the data source object by looking up the jndi name.
It is giving following error when I try to install the application in WAS 4.0 server also.
Default Server jndiNamingException (com.ibm.ws.naming.util.WsnResourceBundle ��;
com.ibm.ws.naming.urlns.genericURLContextRoot createSubcontext(Name) local: jdbc/jdbc �javax.naming.NameNotFoundException: Name
jdbc not found in context "local:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1443)
at com.ibm.ws.naming.ipbase.NameSpace.getParentContext(NameSpace.java:1342)
at com.ibm.ws.naming.urlbase.UrlContext.getParentBindingData(UrlContext.java:1529)
at com.ibm.ws.naming.urlbase.UrlContext.createSubcontext(UrlContext.java:703)
at com.ibm.websphere.naming.JndiHelper.createSubcontexts(JndiHelper.java:261)
at com.ibm.websphere.naming.JndiHelper.createSubcontextsDriver(JndiHelper.java:237)
at com.ibm.websphere.naming.JndiHelper.recursiveBind(JndiHelper.java:499)
at com.ibm.websphere.naming.JndiHelper.recursiveRebind(JndiHelper.java:317)
at com.ibm.ws.runtime.utils.ResourceBinder.bind(ResourceBinder.java:271)
at com.ibm.ws.runtime.utils.ResourceBinder.bind(ResourceBinder.java:212)
at com.ibm.ws.runtime.Server.bindResource(Server.java:827)
at com.ibm.ws.runtime.StandardServer.bindResource(StandardServer.java:451)
at com.ibm.ws.runtime.StandardServer.bindResources(StandardServer.java:444)
at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:344)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:882)
at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
-------------------------------------------------------------------
Works fine with the local db2 database, but not with the remote oracle database. I had set up the properties in server configuration 'data sources' of WSAD and in JDBC data sources of WAS (while testing on WAS directly) also.
Can anybody help me with this?
Thanks Much.
--
Sailaja