cancel
Showing results for 
Search instead for 
Did you mean: 

com.sap.engine.services.jndi.persistent.exceptions.NamingException

Former Member
0 Kudos

Hi,

I have been struggling with the following JNDI lookup error

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name : jdbc/VITSPR , can not resolve object reference [Root exception is java.lang.ClassCastException]

The following are the connection details from simple a java class

Hashtable ht = new Hashtable();

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

ht.put(Context.PROVIDER_URL, "igb11004:50004");

ht.put(Context.SECURITY_PRINCIPAL, "Administrator");

ht.put(Context.SECURITY_CREDENTIALS, "******");

Context ctx = new InitialContext(ht);

DataSource ds = (DataSource) ctx.lookup("jdbc/VITSPR");

I have created the above "VITSPR" datasource in Visual Administrator.

I am able to connect using direct method as follows

Class.forName("com.sap.dbtech.jdbc.DriverSapDB");

String url = "jdbc:sapdb://igb11004/VITSPR";

Connection connection = DriverManager.getConnection(url, "RAMBABU", "password");

Statement stmt = connection.createStatement();

Please suggest any help and it's quite urgent for me.

I would appreciate any help.

Thanks in advance.

Rambabu kancharla

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

Hello Rambabu,

this is the completely wrong forum for this question. Have alook for Enterprise Portal or Java development.

Regards

Gregor

Former Member
0 Kudos

As it says Class Cast Exception

Do not cast to DataSource but printout the debug info

object.getClass().getName()

This will get one step further.

Enjoy

Answers (0)