raj420
02-08-2007, 12:42 PM
Hi,
Im new to .NET/C#, Spring.NET and Mono as moved over from Java camp where I used Spring happily.
Using Spring.Net successfully on .NET framework but getting following exception on under Mono on windows.
Unhandled Exception: System.Configuration.ConfigurationErrorsException: Error instantiating context 'spring.root'. () () ---> Spring.Objects.FatalObjectException: Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(String, Boolean, String[])] : 'Exception ha
s been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Mono.Xml.Schema.XmlSchemaValidatingReader.get_Pref ix () [0x00000]
at System.Xml.XmlDocument.ReadAttributeNode (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000]
at Spring.Objects.Factory.Xml.XmlObjectDefinitionRead er.LoadObjectDefinitions (IResource resource) [0x00000]
at Spring.Context.Support.AbstractXmlApplicationConte xt.LoadObjectDefinitions (Spring.Objects.Factory.Xml.XmlObjectDefinitionRea der objectDefinitionReader) [0x00000]
at Spring.Context.Support.AbstractXmlApplicationConte xt.RefreshObjectFactory () [0x00000]
at Spring.Context.Support.AbstractApplicationContext. Refresh () [0x00000]
at Spring.Context.Support.XmlApplicationContext..ctor (System.String name, Boolean caseSensitive, IApplicationContext parentContext, System.String[] configurationLocations) [0x00000]
at Spring.Context.Support.XmlApplicationContext..ctor (System.String name, Boolean caseSensitive, System.String[] configurationLocations) [0x00000]
at <0x00000> <unknown method>
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[])
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] --- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000]
at Spring.Objects.ObjectUtils.InstantiateType (System.Reflection.ConstructorInfo constructor, System.Object[] arguments) [0x00000] --- End of inner exception stack trace ---
at Spring.Objects.ObjectUtils.InstantiateType (System.Reflection.ConstructorInfo constructor, System.Object[] arguments) [0x00000]
at Spring.Context.Support.ContextHandler+RootContextI nstantiator.InvokeContextConstructor (System.Reflection.ConstructorInfo ctor) [0x00000]
at Spring.Context.Support.ContextHandler+ContextInsta ntiator.InstantiateContext () [0x00000] --- End of inner exception stack trace ---
at Spring.Context.Support.ContextHandler+ContextInsta ntiator.InstantiateContext () [0x00000]
at Spring.Context.Support.ContextHandler.InstantiateC ontext (IApplicationContext parentContext, System.Object configContext, System.String contextName, System.Type contextType, Boolean caseSensitive, System.String[] resources) [0x00000]
at Spring.Context.Support.ContextHandler.Create (System.Object parent, System.Object configContext, System.Xml.XmlNode section) [0x00000]
Worked through previous threads on similar issue but no luck. Below is snippet of the objects XML file I am using. Accessing through app.config with resource URI to seperate file .I've tried removing references to the schema etc to see if that solves the issue as seems to be validation issue of sorts.
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<description>Spring managed objects</description>
<!--Injector main class-->
<object id="Injector" type="Test.Integration.Injector.Injector">
<!-- Frequency to poll the IMAP mailbox-->
<property name="pollingInterval" value="1000" />
</object>
<!-- IMAP Agent-->
<object id="ImapClient" type="Test.Integration.Injector.Imap.ImapClient">
<!-- Mailbox details and credentials -->
<property name="mailHost" value="localhost" />
<property name="mailHostPort" value="143" />
<property name="mailusername" value="testbox" />
<property name="mailPassword" value="password" />
<!-- Folders where incoming mail is delivered and moved to post injection -->
<property name="incomingFolder" value="Inbox" />
<property name="injectedFolder" value="Injected" />
<!-- Filter for which message to retrieve -->
<property name="messageFilter" value="1:*" />
<!-- references to which header and attachments processor to use -->
<property name="headerProcessor" ref="PassThroughHeaderProcessor" />
<property name="attachmentsProcessor" ref="MissingAttachmentsProcessor" />
</object>
...................
Not sure where to go with this one now.
Any help much appreciated.
Raj
Im new to .NET/C#, Spring.NET and Mono as moved over from Java camp where I used Spring happily.
Using Spring.Net successfully on .NET framework but getting following exception on under Mono on windows.
Unhandled Exception: System.Configuration.ConfigurationErrorsException: Error instantiating context 'spring.root'. () () ---> Spring.Objects.FatalObjectException: Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(String, Boolean, String[])] : 'Exception ha
s been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Mono.Xml.Schema.XmlSchemaValidatingReader.get_Pref ix () [0x00000]
at System.Xml.XmlDocument.ReadAttributeNode (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000]
at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000]
at Spring.Objects.Factory.Xml.XmlObjectDefinitionRead er.LoadObjectDefinitions (IResource resource) [0x00000]
at Spring.Context.Support.AbstractXmlApplicationConte xt.LoadObjectDefinitions (Spring.Objects.Factory.Xml.XmlObjectDefinitionRea der objectDefinitionReader) [0x00000]
at Spring.Context.Support.AbstractXmlApplicationConte xt.RefreshObjectFactory () [0x00000]
at Spring.Context.Support.AbstractApplicationContext. Refresh () [0x00000]
at Spring.Context.Support.XmlApplicationContext..ctor (System.String name, Boolean caseSensitive, IApplicationContext parentContext, System.String[] configurationLocations) [0x00000]
at Spring.Context.Support.XmlApplicationContext..ctor (System.String name, Boolean caseSensitive, System.String[] configurationLocations) [0x00000]
at <0x00000> <unknown method>
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[])
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] --- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000]
at Spring.Objects.ObjectUtils.InstantiateType (System.Reflection.ConstructorInfo constructor, System.Object[] arguments) [0x00000] --- End of inner exception stack trace ---
at Spring.Objects.ObjectUtils.InstantiateType (System.Reflection.ConstructorInfo constructor, System.Object[] arguments) [0x00000]
at Spring.Context.Support.ContextHandler+RootContextI nstantiator.InvokeContextConstructor (System.Reflection.ConstructorInfo ctor) [0x00000]
at Spring.Context.Support.ContextHandler+ContextInsta ntiator.InstantiateContext () [0x00000] --- End of inner exception stack trace ---
at Spring.Context.Support.ContextHandler+ContextInsta ntiator.InstantiateContext () [0x00000]
at Spring.Context.Support.ContextHandler.InstantiateC ontext (IApplicationContext parentContext, System.Object configContext, System.String contextName, System.Type contextType, Boolean caseSensitive, System.String[] resources) [0x00000]
at Spring.Context.Support.ContextHandler.Create (System.Object parent, System.Object configContext, System.Xml.XmlNode section) [0x00000]
Worked through previous threads on similar issue but no luck. Below is snippet of the objects XML file I am using. Accessing through app.config with resource URI to seperate file .I've tried removing references to the schema etc to see if that solves the issue as seems to be validation issue of sorts.
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<description>Spring managed objects</description>
<!--Injector main class-->
<object id="Injector" type="Test.Integration.Injector.Injector">
<!-- Frequency to poll the IMAP mailbox-->
<property name="pollingInterval" value="1000" />
</object>
<!-- IMAP Agent-->
<object id="ImapClient" type="Test.Integration.Injector.Imap.ImapClient">
<!-- Mailbox details and credentials -->
<property name="mailHost" value="localhost" />
<property name="mailHostPort" value="143" />
<property name="mailusername" value="testbox" />
<property name="mailPassword" value="password" />
<!-- Folders where incoming mail is delivered and moved to post injection -->
<property name="incomingFolder" value="Inbox" />
<property name="injectedFolder" value="Injected" />
<!-- Filter for which message to retrieve -->
<property name="messageFilter" value="1:*" />
<!-- references to which header and attachments processor to use -->
<property name="headerProcessor" ref="PassThroughHeaderProcessor" />
<property name="attachmentsProcessor" ref="MissingAttachmentsProcessor" />
</object>
...................
Not sure where to go with this one now.
Any help much appreciated.
Raj