ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Taylor" <jtay...@escoinst.com>
Subject Error configuring DAO. Cause: Ambiguous match found.
Date Mon, 30 Jan 2006 22:29:34 GMT
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 <dao
interface="Data.Persistence.Interface.Directory.Core.ICompanyDao,
Data.Persistence"
implementation="Data.Persistence.Source.Directory.Core.CompanyDao,
Data.Persistence" />.  
- 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)




Mime
View raw message