Umesh K Sharma

Greenhorn
+ Follow
since Nov 01, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Umesh K Sharma

What is the difference DataSource.getConnection() Vs DataSource.getConnection(username,password)
8 years ago
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.

Thanks all whoever has given me input to resolve this issue. Special thanks to Mikalai
8 years ago
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.
8 years ago
Hi Micheal John.. did you remember how you solved this problem. i am also facing the same problem
8 years ago
And as per exception also seems to be that it is able to lookup up the jndi succesfully but when the return object is trying to cast with javax.sql.Datasource then it is throwing exception : java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.portable.ObjectImpl

May be i am wrong.
8 years ago
Yes that are correct. Do you think that it could be any jars issue which should be app server specific?
8 years ago
Now i am getting this exception

java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.portable.ObjectImpl
8 years ago
Thanks Mikalai for reply

I updated the code with narrow and getting this output, can you please help

Jun 4, 2015 7:48:56 AM com.ibm.ws.security.config.SecurityObjectLocator
INFO: Client code attempting to load security configuration
Jun 4, 2015 7:48:59 AM com.ibm.ws.naming.util.Helpers
WARNING: jndiGetObjInstNoop
CTX Obj---------------------->>>> Reference Class Name: javax.resource.cci.ConnectionFactory
Type: connectorName
Content: AwsotsDataSource
Type: classpath
Content: /usr/local/opt/was/was70/lib/rsadapter.rar:/usr/local/opt/was/was70/lib/rsadapter.rar
Type: FactoryJndiName
Content: jdbc/awsots
Address Type: dd
AddressContents: ffffffac ffffffed 0 5 73 72 0 25 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 52 65 73 6f 75 72 63 65 ...
Address Type: miscProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: poolProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 27 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ...
Address Type: configProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 23 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 43 6f 6e 6e 65 63 74 6f ...
Address Type: mmProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: dsProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 14 6a 61 76 61 2e 75 74 69 6c 2e 50 72 6f 70 65 72 74 69 65 73 39 12 ffffffd0 7a ...
Address Type: mcfProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 2d 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 61 6e 61 67 65 64 43 ...
Address Type: mbeanProps
AddressContents: ffffffac ffffffed 0 5 73 72 0 1a 63 6f 6d 2e 69 62 6d 2e 65 6a 73 2e 6a 32 63 2e 4d 42 65 61 6e 50 72 6f ...

CLASSLOADER ----->>> nulljavax.sql.DataSource.class--->> null
Jun 4, 2015 7:48:59 AM com.ibm.ws.naming.util.Helpers
WARNING: jndiGetObjInstNoop
Exception in thread "P=135513:O=0:CT" java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.portable.ObjectImpl
at com.ibm.rmi.javax.rmi.PortableRemoteObject.getObjectImpl(PortableRemoteObject.java:587)
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:326)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:135)
at Test.main(Test.java:37)
8 years ago
Can someone please help, it looks to me the problem due to server specific jars.

Any help will be appreciated.
8 years ago
Please help stuck on this issue for long and we have a production deployment very soon so need your help.
Actually we are moving our standalone java program from Weblogic to Websphere 7.0 and when i was trying to run the below program which connects to datasource created in Websphere through jndi lookup then i am getting the ClasscastException.


java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource

This is the code snippet i am trying to run


Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
ht.put(Context.PROVIDER_URL, PROVIDER_URL+ "/");

//ht.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
ctx = new InitialContext(ht);
Object obj = ctx.lookup(JNDINAME);
System.out.println("CTX Obj " + obj);
System.out.println("Context Lookup "+ ctx.PROVIDER_URL);
// javax.sql.DataSource ds = (javax.sql.DataSource)javax.rmi.PortableRemoteObject.narrow(ctx.lookup(JNDINAME), javax.sql.DataSource.class);
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(JNDINAME);
System.out.println("Datasource "+ds);
connection = ds.getConnection();
System.out.println("Connection "+connection.getMetaData().getURL());



java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource

8 years ago
Can anyone please guide me on this
11 years ago
Hi All,

Can someone help me how to get a job in Singapore as Tech Lead in Java/J2EE. I am having 8+ year of experince in Java/J2EE, Struts, Hibernate, Web Services, EJB 2.0 etc.
And what would be estimated Salary having such experince.
11 years ago