• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RAD 6.0.1, ClassCastException

 
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Rational Application Developer 6.0.1

Inside RAD, I have a web application that runs on the Websphere 6.0 Test Environment.

The application uses JNDI to lookup a DataSource. The lookup is successful but the cast is unsuccessful:

java.lang.Object objRef = ctx.lookup(dataSourceName);
DataSource dataSource = (DataSource) objRef;


java.lang.ClassCastException: com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource incompatible with javax/sql/DataSource


I have also tried using

DataSource dataSource = (DataSource) PortableRemoteObject.narrow(objRef, DataSource.class);

but it I get the same ClassCastException.

How can I fix this?

Sean
 
Sean Sullivan
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ClassCastException was due to the fact that I had
a copy of the Oracle type 4 driver JAR in my WEB-INF/lib folder.

I removed the Oracle JAR from WEB-INF/lib and the ClassCastException went away!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic