The moose likes JDBC and the fly likes java.lang.ClassCastException: oracle.sql.CLOB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.lang.ClassCastException: oracle.sql.CLOB" Watch "java.lang.ClassCastException: oracle.sql.CLOB" New topic

java.lang.ClassCastException: oracle.sql.CLOB

Firas Najjar

Joined: Nov 22, 2005
Posts: 3
I am getting this error when I try to use oracle.sql.CLOB
Any help would be greatly appreciated

Here is my code (Inside DB.java)

And here is the error I am getting from catalina.out

java.lang.ClassCastException: oracle.sql.CLOB
at mdx.DB.updateClob(DB.java:116)
at org.apache.jsp.processEditBidItem_jsp._jspService(org.apache.jsp.processEditBidItem_jsp:174)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:319)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

Thanks in advance

You must be the change you wish to see in the world. Mahatma Gandhi
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60755

Moved to the JDBC forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Firas Najjar

Joined: Nov 22, 2005
Posts: 3
stu derby, Thanks for your reply.
This code is working on a resin environment; I moved to Tomcat5.5.12 and now
it is not working; it compiles correctly but when I try to use it gives this error.
I am not a JSP/JAVA expert and I did not write this code I just want it to work.
I am sure that the code in the link you send to is great but it will take a lot of time to figure it out.
I use this code when I want to insert or update to the Clob field.

Any help would greatly appreciated.
Thank you
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
I think the problem is likely that you don't have the OracleResultSet. Most appservers have proxy classes for the JDBC driver. They don't have a choice in the matter if they want to manage a connection pool. If I'm correct, than that would mean the result set isn't returning an Oracle CLOB, it is returning a Resin wrapper around the Oracle CLOB. Whenever I've hit this problem before its always been because of a proxy class.
[ January 12, 2006: Message edited by: Reid M. Pinchback ]

Reid - SCJP2 (April 2002)
Don't get me started about those stupid light bulbs.
subject: java.lang.ClassCastException: oracle.sql.CLOB
Similar Threads
ClassCastException when running portlet
problem with getOutputStream() has already been called for this response
EOF error
Retrieving CLOB data
java.lang.IllegalStateException: getOutputStream() has already been called for this response