Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 49053 invoked from network); 26 Sep 2008 17:25:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Sep 2008 17:25:19 -0000 Received: (qmail 99489 invoked by uid 500); 26 Sep 2008 17:25:03 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 99457 invoked by uid 500); 26 Sep 2008 17:25:03 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 99446 invoked by uid 99); 26 Sep 2008 17:25:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 10:25:03 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dini25@gmail.com designates 64.233.182.188 as permitted sender) Received: from [64.233.182.188] (HELO nf-out-0910.google.com) (64.233.182.188) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 17:24:02 +0000 Received: by nf-out-0910.google.com with SMTP id c10so404119nfd.44 for ; Fri, 26 Sep 2008 10:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:in-reply-to:mime-version:content-type:references; bh=3NuNc+PgVpaKQWuJ+ic8UJ732U+iFCDgYjK3sFMq9Eg=; b=rVfU11J0jhg7jMg+MMXJM7Xd1JBRyX4t+PhGAyGQ5UJN2inHK7oBeVU07OqNiD0Tu+ nY2y1HfOjWZivPrcd2L52Unt5jFUEU+T6DBISeaMqcy6dAAo0v6j/SkqAFvXL8rsHycU teGlVpzNKusWQZzLoTvKOLY9VE6tFoViMYuFs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:in-reply-to:mime-version :content-type:references; b=PBc0Rum7DCwAGfII+rPNTR+QyacPwH7WXvuuYc1ITOcxPzHypLmKedhUwmCcuRJLT2 7andoA2jbwcDqpgJpTL3EuKc6O0MscJNFoQOMBK2Q4fk7uXSlYgjpChW7zFQBwkhXk9s CVDvw5L7sG/SVEYGeX+Tb/6mTU0Tz/caxvp9c= Received: by 10.210.43.10 with SMTP id q10mr1750562ebq.166.1222449857950; Fri, 26 Sep 2008 10:24:17 -0700 (PDT) Received: by 10.210.47.15 with HTTP; Fri, 26 Sep 2008 10:24:17 -0700 (PDT) Message-ID: Date: Fri, 26 Sep 2008 18:24:17 +0100 From: "Ziggy O" Reply-To: Dini@Dinionline.com To: "Tomcat Users List" Subject: Re: jdbc driver fails with tomcat In-Reply-To: <48DD147E.4040302@christopherschultz.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3184_10844557.1222449858025" References: <48DD147E.4040302@christopherschultz.net> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_3184_10844557.1222449858025 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, When i debug the code, it doesnt get to the point where i am initialising the OracleCallableStatement object. It failed just after the initialisation of the ArrayDescriptor object. I have tried to change it to use CallableStatement and im now getting another error. Here is how i've changed it to. CallableStatement cst = conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC); ArrayDescriptor rectabDescriptor = ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",conn); ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs); ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList); context.xml web.xml Oracle Datasource jdbc/ccs21db oracle.jdbc.pool.OracleDataSource Container And here is the stack trace java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149) at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115) at com.abbt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:301) at com.bt.abccs21.presentation.events.consignments.select.SubmitDeclaration.midAction(SubmitDeclaration.java:68) at com.bt.abccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:36) at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:595) On Fri, Sep 26, 2008 at 5:57 PM, Christopher Schultz < chris@christopherschultz.net> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dini, > > Dini Omar wrote: > > I am trying to send an array to a pl/sql module but for some reason i am > > unable to get the connection object. > > > > Here is the line of code that fails > > > > [code] > > Connection conn = null; > > ArrayDescriptor rectabDescriptor = > > ArrayDescriptor.createDescriptor("CCS21_CONSIGNMENTLIST_TYPE",conn); > > It's odd that your exception says DelegatingCallableStatement (which is > the actual type of the object being casted) when the line indicated > neither performs a cast, nor does anything with a statement. > > Are you sure this is the right line number? > > > < > ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs); > > ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList); > > > > OracleCallableStatement cst = > > > (OracleCallableStatement)conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC); > > I'm guessing that the above line is the one where the problem is really > occurring. conn.prepareCall returns a DelegatingCallableStatement > instead of the Oracle-specific one you are expecting. > > Do you /need/ to use OracleCallableStatement, here? If not, you should > simply use java.sql.CallableStatement and you should be good to go. > > If you need to access the underlying OracleCallableStatement, then > you'll need to go through some hoops to get that actual object. Perhaps > something like this: > > DelegatingCallableStatement dcs = > conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC); > > OracleCallableStatement = > (OracleCallableStatement)dcs.getInnermostDelegate(); > > This is a big dangerous, though, because Tomcat doesn't make too many > guarantees about the structure of the objects in the dbcp.dbcp package. > Also, the "innermost delegate" might not actually be your Oracle statement. > > My advise would be to try to stick to using only objects and interfaces > in the JDBC API unless you absolutely need to (for instance, to create > Oracle-specific arrays from templates or whatever this stuff is). > > The Oracle driver ought to allow you to interact a bit more naturally > with the JDBC API and not require you to use OracleCallableStatement > objects and stuff like that. > > Hope that helps, > - -chris > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkjdFH4ACgkQ9CaO5/Lv0PARMgCgphBlDrwQWBWW73/a2cAG82Ju > RaUAmwSmGtca3RVQc91kORrMuXiy2DXs > =kZ3E > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > ------=_Part_3184_10844557.1222449858025--