Is there anyway in WebSphere 5 to run an Application client without using the launchClient utility? The application client needs to look up the datasource that's defined in WebSphere, but the application client might not run on a WebSphere box. So launchClient is not available.
Note that the provideURL currently is "corbaloc:iiop:localhost:2809", but it could be some remote machine's IP address.
<code>
Hashtable params = new Hashtable();
String providerURL = "corbaloc:iiop:localhost:2809";
params.put(Context.PROVIDER_URL, providerURL);
params.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext ctx = null;
DataSource ds = null;
try {
ctx = new InitialContext(params);
/*BLOWING UP HERE */
ds = (DataSource) ctx.lookup("jdbc/myDatasource");
myDataSources.put(resRefName, ds);
}
catch (NamingException ne)
{
ne.printStackTrace();
throw new DatabaseException("Unable to find a DataSource for " + resRefName + " due to " + ne.getExplanation());
}
</code>
Any idea? Thanks!