Umesh K Sharma wrote:Now i am getting this exception
java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.portable.ObjectImpl
Umesh K Sharma wrote:Yes that are correct. Do you think that it could be any jars issue which should be app server specific?
Claude Moore wrote:Wait a moment: are you trying to lookup a Datasource from standalone Java program , as you stated in your title ? I think that such a thing is simply impossible. While you may look up a remote EJB interface - and client runtime, generally speaking strictly coupled with server runtime, will handle this for you using the right stub - I don't think that a datasource may be looked up from a standalone client, not only the way you are tryng, but in general. If you succeeded, you may use getConnection() method on datasource and get a Connection. How ? Should the remote server open the connection and pass it over TCP/IP ? It simply can't, Connections aren't serializable.
Let me understand better this.
Mikalai Zaikin wrote:
You think or you know?
Check my older WAS exam guide - it's absolutely possible (although a rare scenario)
Hint: In order to perform JNDI lookups on remote WAS you must have Application client container installed on Java client side.
Claude Moore wrote:Googling a bit, it seems that JBoss AppServer supported this feature some version ago but now it's no longer supported, just look at this topic. Of course we're all talking about another appserver - not WebSphere. So, it was technically possible (even if not reccomended).
Umesh K Sharma wrote:Yes in WAS it is possible through IIOP to access remotely the datasource. And if you look at the exception, it is clear that it is succefully lookup the JNDI but when it was trying to cast the return object into Javax.sql.Datasource it is throwing exception.
Can someone have seen this scenario and help me to resolve.
Umesh K Sharma wrote:Thanks a lot Mikalai Zaikin. I am able to resolve this issue. what i did was just put all the jars present in WAS LIB and PLUGIN to my client classpath and it got worked for me.