wood burning stoves 2.0*
The moose likes Websphere and the fly likes java.lang.ClassCastException when invoking jdbc stored procedure call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "java.lang.ClassCastException when invoking jdbc stored procedure call" Watch "java.lang.ClassCastException when invoking jdbc stored procedure call" New topic
Author

java.lang.ClassCastException when invoking jdbc stored procedure call

Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

Hi,

I m calling stored procedure using spring frame work. My application server on production environment ins Web sphere and data source is configured and connection is retrieved through jndi. My code require Connection object to commit the transactions. Im getting below error when executing the application in WAS.



Please let me know the way to avoid this error. My application runs on tomcat in my local machine and WAS in my production machine.


Skanda
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 496
    
    1

May you post more code details ? How do you get connection from the connection pool ? Did you configurate your data source provider properly ?
Anton Novopashin
Greenhorn

Joined: Feb 25, 2008
Posts: 19
Hi, I'd recomend to create resource reference to datasorce.
You can easy to find solution for connection configuration: Stackoverflow


OCJP (1Z0-851).
Integration Developer (000-607).
WAS Admin (000-377).
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

I'm afraid the original poster didn't provide enough details for any specific recommendation to be made.
Anton Novopashin
Greenhorn

Joined: Feb 25, 2008
Posts: 19
Martin Vajsar wrote:I'm afraid the original poster didn't provide enough details for any specific recommendation to be made.

Hi, Martin.

I disagree with you.
First of all there is no concrete implementation details.
is native WebSphere connection.
IBM has perfect document for this situation Technote

Second of all if you are developing in J2EE environment best way is use standards.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

I wasn't - and still am not - sure whether this problem is caused by misconfiguration of the datasources, or by trying to use some Oracle specific functionality on the WSJdbcConnection without calling getNativeConnection first (there are articles on the web which suggest this possibility). If it is the second case, the StackOverflow article wouldn't apply. And since your post didn't explain why did you think the SO article applies, I've mentioned that we might not know the details. I'm no expert on this, and if you are really sure that the only way the message can appear is the issue described in the StackOverflow article, I don't have anything to add.

Anton Novopashin wrote:Second of all if you are developing in J2EE environment best way is use standards.

Not disputing this at all
Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

Sorry for not posting the complete details.

Issue is more as mentioned in below IBM notes

http://www-01.ibm.com/support/docview.wss?uid=swg21409335

I wanted to pass list of objects to my stored procedure through Springs. Hence, I implemented ArrayDescriptor from oracle package. Now, on running my code on WAS server, server throws below error. I have set up the datasource in WAS admin console and looks like WAS wraps the connection object as WSJdbcConnection, which is not compatible with OracleConnection which ArrayDescriptor requires.



I tried normal typecasting from WSJdbcConnection to OracleConnection and this is not working. My requirement is to run the code on both Tomcat and WAS server.

With that said, after some research on google I found that spring framework provides native jdbc classes and hence I used CommonDbcpNativeJdbcExtractor for Tomcat and WebSphereNativeJdbcExtractor for WAS as below



Please let me know if this is the right approach or am I going on wrong direction.
Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

Please let me know if any Suggestions on direction I have selected for resolving this problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassCastException when invoking jdbc stored procedure call