Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Standalone client access remote DataSource

Greetings,

I have setup two datasources on NW WAS

1. ORACLE_DSN (JDBC1.0 )

2. oraclepool1 (JDBC2.0 with conection pool)

I have a standalone client(Not deployed inside NW WAS) which does a JNDI lookup on the remote Datasource with code snippet shown below:

//Load the properties for initial context.

Properties properties = new Properties();

properties.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sap.engine.services.jndi.InitialContextFactoryImpl");

properties.put(Context.PROVIDER_URL, "<machine_name>:50004");

InitialContext ctx = new InitialContext(properties);

/* jdbc/ORACLE_DSN is the jndi name for DataSource configured in NW WAS without connection pool */

DataSource dataSource = (DataSource) ctx.lookup("jdbc/ORACLE_DSN");

Connection conn = dataSource.getConnection();

This works and I was able to get a connection and run my sql.

However, when I lookup for datsource with connection pool ie (DataSource) ctx.lookup("jdbc/oraclepool1"); , I get the errors shown below:

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name jdbc/oraclepool1, cannot resolve object reference. [Root exception is com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot lookup ManageConnectionFactory "oraclepool1". Cannot deserialize object: java.io.InvalidClassException: com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl; local class incompatible: stream classdesc serialVersionUID = -4854122921580973088, local class serialVersionUID = 100351084895370205

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)

at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)

at com.sap.engine.services.jndi.persistent.RemoteSerializator.toObject(RemoteSerializator.java:70)

at com.sap.engine.services.jndi.implclient.ClientContext.deserializeObject(ClientContext.java:3349)

at com.sap.engine.services.jndi.implclient.ClientContext.deserializeDirObject(ClientContext.java:3303)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:385)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.sap.engine.services.connector.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:165)

at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:522)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.mycode.EventsFactory.<init>(EventsFactory.java:37)

at com.mycode.EventsFactory.main(EventsFactory.java:97)

]

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:529)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.mycode.EventsFactory.<init>(EventsFactory.java:37)

at com.mycode.EventsFactory.main(EventsFactory.java:97)

Caused by: com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot lookup ManageConnectionFactory "oraclepool1". Cannot deserialize object: java.io.InvalidClassException: com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl; local class incompatible: stream classdesc serialVersionUID = -4854122921580973088, local class serialVersionUID = 100351084895370205

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)

at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)

at com.sap.engine.services.jndi.persistent.RemoteSerializator.toObject(RemoteSerializator.java:70)

at com.sap.engine.services.jndi.implclient.ClientContext.deserializeObject(ClientContext.java:3349)

at com.sap.engine.services.jndi.implclient.ClientContext.deserializeDirObject(ClientContext.java:3303)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:385)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.sap.engine.services.connector.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:165)

at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:522)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.mycode.EventsFactory.<init>(EventsFactory.java:37)

at com.mycode.EventsFactory.main(EventsFactory.java:97)

at com.sap.engine.services.connector.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:189)

at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:522)

... 4 more

Any ideas here?

Highly Appreciated,

Raghav

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question