Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 5267 invoked from network); 1 Apr 2005 02:21:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Apr 2005 02:21:18 -0000 Received: (qmail 53132 invoked by uid 500); 1 Apr 2005 02:21:18 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 52906 invoked by uid 500); 1 Apr 2005 02:21:17 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 52892 invoked by uid 99); 1 Apr 2005 02:21:17 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from ip60.post-legacy.dfw.ygnition.net (HELO localhost.localdomain) (66.135.183.60) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 31 Mar 2005 18:21:15 -0800 Received: from [192.168.0.198] ([192.168.0.198]) (authenticated bits=0) by localhost.localdomain (8.13.1/8.13.1) with ESMTP id j312LTTj012744 for ; Thu, 31 Mar 2005 20:21:32 -0600 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Thu, 31 Mar 2005 20:21:09 -0600 Subject: Re: ClassCastException building SqlMap instance From: Sasha Borodin To: Message-ID: In-Reply-To: <2fe5ef5b05033118045b9cfdb@mail.gmail.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Yes, I have ibatis-common-2.jar on the classpath. I've tested my classes from within IntelliJ Idea, and implemented them successfully in a number of web applications. I'm not sure how to go about debugging this particular environment, however. The jars are all located in $CATALINA_HOME/server/lib, instead of the WEB-INF/lib directory; that is the only difference that I can see - which makes me think it's some kind of a conflict with existing jars, or there's a necessary jar that hasn't yet been loaded by the classloader before the ibatis classes are initialized in this scenario. If anyone has used iBatis in this context (tomcat realm implementations) and is familiar with any nuances, please let me know. Also, if you have a suggestion for debugging WHAT particular statements or code cause the ClassCastException, that would also be very helpful to troubleshooting this. >>>> --- Check the data source type or class. >>>> --- Cause: com.ibatis.sqlmap.client.SqlMapException: Error initializing >>>> DataSource. Could not instantiate DataSourceFactory. Cause: >>>> java.lang.ClassCastException Thanks again. -Sasha Borodin > From: Brandon Goodin > Reply-To: > Date: Thu, 31 Mar 2005 19:04:39 -0700 > To: > Subject: Re: ClassCastException building SqlMap instance > > do you have the ibatis-common.jar on your classpath? > > If i were you i would put this in a debugger. > > Brandon > > On Thu, 31 Mar 2005 19:16:50 -0600, Sasha Borodin > wrote: >> Excerpt from sql-map-config.xml: >> >> >> > value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> >> >> The error persists whether or not I place the commons-dbcp, commons-pool, >> commons-collections, and the jdbc driver jars in server/lib. >> >> Thanks for looking at this. >> >> -Sasha >> >>> From: Brandon Goodin >>> Reply-To: >>> Date: Thu, 31 Mar 2005 18:09:02 -0700 >>> To: >>> Subject: Re: ClassCastException building SqlMap instance >>> >>> What are you using for your datasource? >>> >>> Brandon >>> >>> >>> On Thu, 31 Mar 2005 18:32:57 -0600, Sasha Borodin >>> wrote: >>>> I've written some classes that employ the iBatis framework for data access. >>>> All patterns used are identical to the iBatis JPetStore example >>>> (DaoManager, >>>> SqlMaps, a "service" class which abstracts all this, etc.) >>>> >>>> These classes work great when accessed from a Tomcat web application. But >>>> I >>>> ran into problems using these classes in a custom Realm for Tomcat. These >>>> are the errors I'm getting when the class loader initializes everything on >>>> Tomcat startup: >>>> >>>> Caused by: java.lang.RuntimeException: Could not initialize >>>> BrokerDaoConfig. >>>> Cause: com.ibatis.dao.client.DaoException: Error while configuring >>>> DaoManager. Cause: com.ibatis.sqlmap.client.SqlMapException: There was an >>>> error while building the SqlMap instance. >>>> --- The error occurred in the SQL Map Configuration file. >>>> --- The error occurred while configuring the data source. >>>> --- Check the data source type or class. >>>> --- Cause: com.ibatis.sqlmap.client.SqlMapException: Error initializing >>>> DataSource. Could not instantiate DataSourceFactory. Cause: >>>> java.lang.ClassCastException >>>> >>>> Can anyone shed some light on the ClassCastException? I Googled but found >>>> no references to this exception in this context. >>>> >>>> As I mentioned, my classes work when all iBatis (and related) jars are >>>> under >>>> a webapp's WEB-INF/lib directory. But in this case, since I'm trying to >>>> use >>>> the classes in a custom Realm implementation, I've placed all the jars >>>> under >>>> server/lib directory - that is the only difference between a working and >>>> non-working scenario. >>>> >>>> Thanks for all your help, >>>> >>>> -Sasha Borodin >>>> >>>> >> >>