• 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

java.lang.ClassCastException when invoking jdbc stored procedure call

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1360
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May you post more code details ? How do you get connection from the connection pool ? Did you configurate your data source provider properly ?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'd recomend to create resource reference to datasorce.
You can easy to find solution for connection configuration: Stackoverflow
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm afraid the original poster didn't provide enough details for any specific recommendation to be made.
 
Anton Novopashin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please let me know if any Suggestions on direction I have selected for resolving this problem.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic