![]() |
|
#1
|
|||
|
|||
|
Hi,
I get following exception using Spring RC2 with SQLite. I've noticed the problem some time ago and stopped migrating from RC1 where I've had my SQLite xml configuration (now I want to use embeded provider...) and had no problems... Code:
Spring.Objects.Factory.ObjectCreationException: Error creating object with name '' : IFactoryObject threw exception on object creation for object with name = dbProvider ---> Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'SQLite-1.0.43' defined in 'assembly [Spring.Data, Version=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml]' : Initialization of object failed : Cannot instantiate Type [Spring.Data.Common.DbMetadata] using ctor [Void .ctor(System.String, System.String, System.Type, System.Type, System.Type, System.Type, System.Type, System.String, System.Type, System.String, System.String, System.String, System.Type, Boolean, Boolean, Boolean, System.String)] : 'Exception has been thrown by the target of an invocation.' while resolving 'constructor argument with name dbmetadata' to '(inner object)' defined in 'assembly [Spring.Data, Version=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml]' ---> Spring.Util.FatalReflectionException: Cannot instantiate Type [Spring.Data.Common.DbMetadata] using ctor [Void .ctor(System.String, System.String, System.Type, System.Type, System.Type, System.Type, System.Type, System.String, System.Type, System.String, System.String, System.String, System.Type, Boolean, Boolean, Boolean, System.String)] : 'Exception has been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: DbProvider product name = SQLite, could not resolve commandBuilderDeriveParametersMethod DeriveParameters to MethodInfo. Please check dbproviders.xml entry for correct metadata listing. Parameter name: commandBuilderDeriveParametersMethod at Spring.Util.AssertUtils.ArgumentNotNull(Object argument, String name, String message) at Spring.Data.Common.DbMetadata..ctor(String productName, String assemblyName, Type connectionType, Type commandType, Type parameterType, Type dataAdapterType, Type commandBuilderType, String commandBuilderDeriveParametersMethod, Type parameterDbType, String parameterDbTypeProperty, String parameterIsNullableProperty, String parameterNamePrefix, Type exceptionType, Boolean useParameterNamePrefixInParameterCollection, Boolean useParameterPrefixInSql, Boolean bindByName, String errorCodeExceptionExpression) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) --- End of inner exception stack trace --- at Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) at Spring.Objects.Factory.Support.SimpleInstantiationStrategy.Instantiate(RootObjectDefinition definition, String name, IObjectFactory factory, ConstructorInfo constructor, Object[] arguments) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition, ConstructorArgumentValues argumentValues) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObjectInstance(String name, RootObjectDefinition definition, Object[] arguments) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) --- End of inner exception stack trace --- at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ResolveInnerObjectDefinition(String name, String innerObjectName, String argumentName, IObjectDefinition definition, Boolean singletonOwner) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ResolveValueIfNecessary(String name, RootObjectDefinition definition, String argumentName, Object argumentValue) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ResolveConstructorArguments(String name, RootObjectDefinition definition, ConstructorArgumentValues resolvedValues) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition, ConstructorArgumentValues argumentValues) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.AutowireConstructor(String name, RootObjectDefinition definition) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObjectInstance(String name, RootObjectDefinition definition, Object[] arguments) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments) at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name, Type requiredType, Object[] arguments) at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name, Type requiredType) at Spring.Context.Support.AbstractApplicationContext.GetObject(String name, Type requiredType) at Spring.Data.Common.DbProviderFactory.GetDbProvider(String providerInvariantName) at Spring.Data.Common.DbProviderFactoryObject.GetObject() at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectFromFactoryObject(IFactoryObject factory, String objectName, RootObjectDefinition rod) --- End of inner exception stack trace --- at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectFromFactoryObject(IFactoryObject factory, String objectName, RootObjectDefinition rod) at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectForInstance(String name, Object instance) at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name, Type requiredType, Object[] arguments) at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name) at Spring.Objects.Factory.Support.DefaultListableObjectFactory.PreInstantiateSingletons() at Spring.Context.Support.AbstractApplicationContext.Refresh() at Spring.Context.Support.XmlApplicationContext..ctor(Boolean refresh, String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) at Spring.Context.Support.XmlApplicationContext..ctor(String[] configurationLocations) at GalleryViewer.Program.Main() in C:\02 - Projects\Lithium.pl\GalleryViewer\Program.cs:line 27 TIA. |
|
#2
|
|||
|
|||
|
Hi,
got same error was wondering if you found a fix in the meantime i read dbProvider.xml and they suggest to take drivers from here http://sourceforge.net/projects/sqlite-dotnet2 i downloaded the 1.0.43 version, and got same exception Code:
problems here :System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': DbProvider product name = SQLite, could not resolve comm andBuilderDeriveParametersMethod DeriveParameters to MethodInfo. Please check d bproviders.xml entry for correct metadata listing. Parameter name: commandBuilderDeriveParametersMethod ---> Spring.Util.FatalRefle ctionException: Cannot instantiate Type [Spring.Context.Support.XmlApplicationCo ntext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : 'Excep tion has been thrown by the target of an invocation.' ---> System.Reflection.Tar getInvocationException: Exception has been thrown by the target of an invocation . ---> Spring.Objects.Factory.ObjectCreationException: Error creating object wit h name '' : IFactoryObject threw exception on object creation for object with na me = DbProvider ---> Spring.Objects.Factory.ObjectCreationException: Error throw n by a dependency of object 'SQLite-1.0.43' defined in 'assembly [Spring.Data, V ersion=1.1.0.2, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spr ing.Data.Common.dbproviders.xml]' : Initialization of object failed : Cannot ins tantiate Type [Spring.Data.Common.DbMetadata] using ctor [Void .ctor(System.Stri ng, System.String, System.Type, System.Type, System.Type, System.Type, System.Ty pe, System.String, System.Type, System.String, System.String, System.String, Sys tem.Type, Boolean, Boolean, Boolean, System.String)] : 'Exception has been throw n by the target of an invocation.' while resolving 'constructor argument with name dbmetadata' to '(inner object)' defined in 'assembly [Spring.Data, Version=1.1.0.2, Culture=neutral, PublicKeyT oken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml]' ---> Spri ng.Util.FatalReflectionException: Cannot instantiate Type [Spring.Data.Common.Db Metadata] using ctor [Void .ctor(System.String, System.String, System.Type, Syst em.Type, System.Type, System.Type, System.Type, System.String, System.Type, Syst em.String, System.String, System.String, System.Type, Boolean, Boolean, Boolean, System.String)] : 'Exception has been thrown by the target of an invocation.' - --> System.Reflection.TargetInvocationException: Exception has been thrown by th e target of an invocation. ---> System.ArgumentNullException: DbProvider product name = SQLite, could not resolve commandBuilderDeriveParametersMethod DerivePar ameters to MethodInfo. Please check dbproviders.xml entry for correct metadata listing. Parameter name: commandBuilderDeriveParametersMethod at Spring.Util.AssertUtils.ArgumentNotNull(Object argument, String name, Stri ng message) at Spring.Data.Common.DbMetadata..ctor(String productName, String assemblyNam e, Type connectionType, Type commandType, Type parameterType, Type dataAdapterTy pe, Type commandBuilderType, String commandBuilderDeriveParametersMethod, Type p arameterDbType, String parameterDbTypeProperty, String parameterIsNullableProper ty, String parameterNamePrefix, Type exceptionType, Boolean useParameterNamePref ixInParameterCollection, Boolean useParameterPrefixInSql, Boolean bindByName, St ring errorCodeExceptionExpression) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStru ct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruc t signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, B inder binder, Object[] parameters, CultureInfo culture) at Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Objec t[] arguments) --- End of inner exception stack trace --- at Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Objec t[] arguments) at Spring.Objects.Factory.Support.SimpleInstantiationStrategy.Instantiate(Roo tObjectDefinition definition, String name, IObjectFactory factory, ConstructorIn fo constructor, Object[] arguments) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.Autowi reConstructor(String name, RootObjectDefinition definition, ConstructorArgumentV alues argumentValues) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.Create ObjectInstance(String name, RootObjectDefinition definition, Object[] arguments) at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.Create Object(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) --- End of inner exception stack trace --- at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.Resolv regards marco |
|
#3
|
|||
|
|||
|
Hi,
Thanks for reporting this. After RC1 there was a bug regarding a mistake in specifying parameterDbTypeProperty in the Oracle provider and I added code to ensure that all method/property names were resolved otherewise and exception would be thrown. parameterDbTypeProperty is pretty critical so that makes sense but commandBuilderDeriveParametersMethod is not only rarely used but it is not present in the SQLite provider supplied by http://sourceforge.net/projects/sqlite-dotnet2 FYI, it is in the provider supplied by http://adodotnetsqlite.sourceforge.net/downloads/ To avoid API change to DbMetadata I've made a 'magic string' so that the commandBuilderDeriveParametersMethod can be optional. The value for that field can now be set to 'not supported' and the exception will not be thrown. As a work around now you can se tthe static property DBPROVIDER_ADDITIONAL_RESOURCE_NAME in DbProviderFactory to a Spring resource location that contains an alternate definition for the provider metadata. In this alternate definition and set the value of commandBuilderDeriveParametersMethod to GetSchemaTable. Alternatively, you can download the latest build which fixes this issue. It had already been entered as SPRNET-514 but pushed it off to fix in 1.2 since I thought to modify the DbMetadata API. This seems like a reasonable compromise, making DbMetadata aware of the magic string 'not supported' as appropriate. Cheers, Mark |
|
#4
|
|||
|
|||
|
Mark
thanks for the reply i'll try it out and get back here thanks again for your help regards marco |
|
#5
|
|||
|
|||
|
Mark,
worked as a charm (downloaded S.Net 20071120-22.19)thanx a lot! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|