Return-Path: Delivered-To: apmail-ibatis-user-cs-archive@www.apache.org Received: (qmail 25440 invoked from network); 30 Jan 2006 22:29:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Jan 2006 22:29:59 -0000 Received: (qmail 35041 invoked by uid 500); 30 Jan 2006 22:29:58 -0000 Delivered-To: apmail-ibatis-user-cs-archive@ibatis.apache.org Received: (qmail 35027 invoked by uid 500); 30 Jan 2006 22:29:58 -0000 Mailing-List: contact user-cs-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-cs@ibatis.apache.org Delivered-To: mailing list user-cs@ibatis.apache.org Received: (qmail 35016 invoked by uid 99); 30 Jan 2006 22:29:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2006 14:29:58 -0800 X-ASF-Spam-Status: No, hits=4.2 required=10.0 tests=DNS_FROM_RFC_DSN,SPF_FAIL X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [68.142.225.205] (HELO smtp107.rog.mail.re2.yahoo.com) (68.142.225.205) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Jan 2006 14:29:57 -0800 Received: (qmail 26899 invoked from network); 30 Jan 2006 22:29:35 -0000 Received: from unknown (HELO prescott) (r.j.taylor@rogers.com@70.31.28.218 with login) by smtp107.rog.mail.re2.yahoo.com with SMTP; 30 Jan 2006 22:29:35 -0000 Reply-To: From: "Jason Taylor" To: Subject: Error configuring DAO. Cause: Ambiguous match found. Date: Mon, 30 Jan 2006 17:29:34 -0500 Organization: The ESCO Institute Message-ID: <000501c625ec$a5e69720$3202a8c0@prescott> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Thread-Index: AcYl4B3UA60x8VjLQJ2uFCcrv/oLYwACXCBg X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello everyone; I'm fairly new to iBATIS and I seem to have hit a wall that I can't get around. I keep getting the error message "Error configuring DAO. Cause: Ambiguous match found", when I try to access a Dao (CompanyDao) through the DaoManager by calling the corresponding IDao (ICompanyDao). The solution is made up of 4 projects: Data.Domain ( domain/value classes, common code ) Data.Persistence ( Daos and their corresponding interfaces ) Data.Service ( Service classes that inherit a reference to a DaoManager ) Data.Service.Test ( Unit tests for Data.Service ) ******************************** Here is a sample Service class: ******************************** using System; using Data.Service.Source.Base; using Data.Domain.Source.Directory.Core; using Data.Persistence.Interface.Directory.Core; namespace Data.Service.Source.Directory.Core { public class CompanyService : BaseService { private static CompanyService _instance = new CompanyService( ); private ICompanyDao _companyDao = null; private CompanyService( ) { _companyDao = ( ICompanyDao ) _daoManager.GetDao( typeof( ICompanyDao ) ); } public static CompanyService Instance( ) { return _instance; } public CompanyVO GetByID( string companyId ) { CompanyVO companyVo = null; _daoManager.OpenConnection( ); companyVo = _companyDao.GetByID( companyId ); _daoManager.CloseConnection( ); return companyVo; } } } *********************************** I have been puzzling over this for quite a while. Any hint as to what I might have done wrong would be very much appreciated. Thanks in advance, Jason Taylor P.S. I have included the Exception Message and the Stack Trace below MESSAGE: System.TypeInitializationException : The type initializer for 'Data.Service.Source.Directory.Core.CompanyService' threw an exception. ----> IBatisNet.Common.Exceptions.ConfigurationException : - The error occurred while add global properties. - configure dao - The error occurred in . - Check the Data.Persistence.Source.Directory.Core.CompanyDao, Data.Persistence. ----> IBatisNet.Common.Exceptions.ConfigurationException : Error configuring DAO. Cause: Ambiguous match found. ----> System.Reflection.AmbiguousMatchException : Ambiguous match found. STACK TRACE: at Data.Service.Source.Directory.Core.CompanyService.Instance() at Data.Service.Test.Source.Directory.Core.CompanyServiceTest.TestService() in E:\Projects\The ESCO Institute\Applications\Esco.2007\Data.Service.Test\Source\Directory\Core\Com panyServiceTest.cs:line 13 --TypeInitializationException at Data.Service.Source.Base.BaseService.setDaoManager() in E:\Projects\The ESCO Institute\Applications\Esco.2007\Data.Service\Source\Base\BaseService.cs:lin e 19 at Data.Service.Source.Base.BaseService..ctor() in E:\Projects\The ESCO Institute\Applications\Esco.2007\Data.Service\Source\Base\BaseService.cs:lin e 25 at Data.Service.Source.Directory.Core.CompanyService..ctor() in E:\Projects\The ESCO Institute\Applications\Esco.2007\Data.Service\Source\Directory\Core\CompanyS ervice.cs:line 14 at Data.Service.Source.Directory.Core.CompanyService..cctor() in E:\Projects\The ESCO Institute\Applications\Esco.2007\Data.Service\Source\Directory\Core\CompanyS ervice.cs:line 10 --ConfigurationException at IBatisNet.DataAccess.Configuration.Dao.Initialize(DaoManager daoManager) at IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.ParseDaoFactory(Conf igurationScope configurationScope, DaoManager daoManager) at IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.GetContexts(Configur ationScope configurationScope) at IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.BuildDaoManagers(Xml Document document, Boolean useConfigFileWatcher) --ConfigurationException at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers) at System.Type.GetMethod(String name) at Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.MethodTokenExpression.Emit (IEasyMember member, ILGenerator gen) at Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.MethodInvocationExpression .Emit(IEasyMember member, ILGenerator gen) at Castle.DynamicProxy.Builder.CodeBuilder.SimpleAST.AssignStatement.Emit(IEasy Member member, ILGenerator gen) at Castle.DynamicProxy.Builder.CodeBuilder.AbstractCodeBuilder.Generate(IEasyMe mber member, ILGenerator il) at Castle.DynamicProxy.Builder.CodeBuilder.EasyMethod.Generate() at Castle.DynamicProxy.Builder.CodeBuilder.AbstractEasyType.EnsureBuildersAreIn AValidState() at Castle.DynamicProxy.Builder.CodeBuilder.AbstractEasyType.BuildType() at Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator.CreateType() at Castle.DynamicProxy.Builder.CodeGenerators.InterfaceProxyGenerator.GenerateC ode(Type[] interfaces, Type targetType) at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateInterfaceProxy(Type[] interfaces, Type type) at Castle.DynamicProxy.ProxyGenerator.CreateProxy(Type[] interfaces, IInterceptor interceptor, Object target) at IBatisNet.DataAccess.Configuration.DaoProxy.NewInstance(Dao dao) at IBatisNet.DataAccess.Configuration.Dao.Initialize(DaoManager daoManager)