Forum Stats

  • 3,872,603 Users
  • 2,266,457 Discussions
  • 7,911,262 Comments

Discussions

JNDI access outside OC4J 10.1.3.4

My server is OC4J 10.1.3.4
Need to access JNDI outside the container (from a standalone java program) to use DataSource.

getting error: META-INF/application-client.xml not found
But I am having this application-client.xml as well as orion-application-client.xml
while trying to use DataSource from a standalone application, using the following code:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory");
env.put("java.naming.provider.url","ormi://localhost/myApp");
env.put("java.naming.security.principal","oc4jadmin");
env.put("java.naming.security.credentials","oc4jadmin");
Context initial = new InitialContext(env);

DataSource ds = (DataSource) initial.lookup("jdbc/adpDS");

Error point is the code: Context initial = new InitialContext(env);


Any working code or config info from your side will be a great.
This discussion has been closed.