cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI Naming Exception for Datasource

Former Member
0 Kudos

This is the error that is thrown for a JNDI Lookup for an oracle datasource. This works correctly with j2ee components(ejbs/jsps) but when I do a look up from a remote swing client this exception is thrown. I have checked the jndi tree and the driver/aliases/jndi names are all correct. Tried the java:comp/env prefix too..Did not work. This is code that is used..

Object o = ctx.lookup("jdbc/POCJDBC");

javax.sql.DataSource ds = (javax.sql.DataSource) o ;

Any tips?

Thanks

Sid

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name jdbc/POCJDBC, cannot resolve object reference. [Root exception is com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot lookup ManageConnectionFactory "oracle". Cannot deserialize object: java.lang.NullPointerException

at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.readObject(CPManagedConnectionFactoryImpl.java:307)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Siddhartha,

What you have passed in initialcontext() method?

You need to pass server information here, as this code is running at client side. Your J2ee components are running at server side. So, you need not to pass such information. But, for client side code it is must.

Use following code for the same.

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL,"<server>:50004");

env.put("force_remote", "true");

env.put(Context.SECURITY_PRINCIPAL, "<user name>");

env.put(Context.SECURITY_CREDENTIALS, "<password>");

env.put("domain", "true");

InitialContext ctx = new InitialContext(env);

Regards,

Bhavik

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yes I am passing the user credentials . The lookup works for ejbs(from the swing remote client) but fails for the datasource.

Former Member
0 Kudos

Hi Siddhartha,

But error shows that there is a problem in your look up only.

If you are now getting any other error then update me.

Regards,

Bhavik