PDA

View Full Version : Spring.NET 1.1.1 & Mono 1.9 Problems


ACherry
04-08-2008, 11:54 PM
While I understand that there's no 'announced' support for Mono in Spring.NET yet, I have noticed that the NAnt build files know something about it.
Anyhow, my organization is planning to begin a new open-source web application and in order to leverage as much existing knowledge around here as possible, we've decided to build it using Spring.NET. Because this will be an open-source project, we would ideally like it to be deployable on a completely open-source platform.
Anyhow, after installing the very latest version of Spring.NET (1.1.1) on an XP machine and the latest version of Mono (1.9), I ran xsp2 in the Spring.WebQuickStart.2005 directory and received the following error when attempting to load the site:


Server Error in '/' Application
Failed to load httpHandler type `Spring.Web.Support.PageHandlerFactory, Spring.Web'

Description: HTTP 500. Error processing request.

Stack Trace:

System.Web.HttpException: Failed to load httpHandler type `Spring.Web.Support.PageHandlerFactory, Spring.Web'
at System.Web.Configuration.HttpHandlerAction.LoadTyp e (System.String type_name) [0x00000]
at System.Web.Configuration.HttpHandlerAction.GetHand lerInstance () [0x00000]
at System.Web.Configuration.HttpHandlersSection.Locat eHandler (System.String verb, System.String filepath) [0x00000]
at System.Web.HttpApplication.LocateHandler (System.String verb, System.String url) [0x00000]
at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url) [0x00000]
at System.Web.HttpApplication+<>c__CompilerGenerated6.MoveNext () [0x00000]

Version information: Mono Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.42

This seems to at least be an improvement on the error that Spring.NET 1.1 was giving me, which was just a NullReferenceException without really any other information...

I've attempted to rebuild Spring.NET 1.1.1 from source using Mono, but didn't have any luck with that either. After checking the project out from CVS (using the release_1_1_1 tag), I attempted to build it using:
> nant build-mono-2.0

The antlr stuff calls java and the command line is set up so that it won't run from a directory with spaces in it. I worked around that.
There are a bunch of compiler warnings. I worked around those.
Eventually, Core seems to build find. So does Aop.
When building Web, however, it complains that it can't find a bunch of namespaces in the System.Web assembly, including System.Web.UI.
I'm certain that Mono 1.9 implements all of the namespaces that it's complaining about, because nearly everything in ASP.NET 2.0 works fine in Mono 1.9.
I've tried explicitly settings MONO_HOME and also tried copying Mono's System.Web assembly into $build\lib\mono without any luck.

Please note that in order to try rebuilding Spring.NET using mono, you need to use the CVS version of Spring.NET, since the release version doesn't include nant build files for some reason...

Does anyone have any information on how to configure or build Spring.NET to be able to run Spring.Web applications on Mono?
It seems that these systems would be naturally complimentary and the fact that the Spring.NET build files already include some mono-specific stuff in it makes me hopeful that this might be possible soon.

Thanks.

Mark Pollack
04-09-2008, 04:39 AM
Hi,

Thanks for taking the time to work though this. There have been some attempts in the past to get it running on mono, with some success, but to my knowledge Spring.Web never worked. The previous post in this forum reported the same type not found issue. I didn't investigate deeply but found this link (http://lists.ximian.com/archives/public/mono-list/2006-June/031838.html) that might be helpful.

Even getting past the type loading issue, which I presume we can work though, the implementation of Spring.Web uses reflection in several places that are based on the specific Microsoft based implementation of ASP.NET, so it will not be a trivial effort to port to mono I'm afraid.

Try the suggestion in the link and lets see where we end up. I'd like to have mono support but frankly there hasn't been much demand. All contributions, nant file changes etc., are more than welcome contributions. BTW, the mono support in the nant build file is just legacy from the original version of the build files which came from nant itself.b

I didn't distribute the nant build file to avoid having to ship antlr and our custom nunit task, which would increase the size of the download but there isn't a more fundamental reason. Again, first time for the request, oddly enough, and we can add that for the next release. I've made a JIRA issue (http://jira.springframework.org/browse/SPRNET-928) for that.

Cheers,
Mark

ACherry
04-09-2008, 08:48 PM
Well, once that's done, I get a new error:
System.NullReferenceException: Object reference not set to an instance of an object
at Spring.Context.Support.WebApplicationContext..ccto r () [0x00000]

Looking in the error page source, I also see:
[System.TypeInitializationException]: An exception was thrown by the type initializer for Spring.Context.Support.WebApplicationContext
at Spring.Context.Support.WebSupportModule.Init (System.Web.HttpApplication app) [0x00000]
at System.Web.Configuration.HttpModulesSection.LoadMo dules (System.Web.HttpApplication app) [0x00000]
at System.Web.HttpApplication.InitOnce (Boolean full_init) [0x00000]
at System.Web.HttpApplication.Start (System.Object x) [0x00000]
[System.NullReferenceException]: Object reference not set to an instance of an object
at Spring.Context.Support.WebApplicationContext..ccto r () [0x00000]

chrisjsmith
04-14-2008, 01:59 PM
There's some stuff in the reflection.emit space which isn't complete in mono which Spring relies on to work properly. Try running MOMA (google it) on the spring dlls and it'll tell you the compatibility problems. The moment they fix it in Mono (this is not Spring's fault), i'm running dual platform builds.

roboguy
04-23-2008, 03:18 PM
Hi guys,

I am also very keen to get Spring working on Mono. I took a look at this a while back and now have some time to devote to this again. I'd be very keen to contribute/colloborate with anyone who's willing to help.

I plan to start work start work on this tonight, I'll report back here on any progress.

Cheers,
James

Mark Pollack
04-23-2008, 03:45 PM
Hi James,

Thanks, your time and effort is greatly appreciated!

Cheers,
Mark

roboguy
04-24-2008, 11:21 AM
Last night I pulled the latest from CVS and with a few MONO, MONO_2_0 directive additions it builds nicely in MonoDevelop using the VS2005 solution files.

Getting the Nant build to work is a bit more difficult as ACherry found out. I had to hack the build scripts a little to get Spring.Core and Spring.Aop to build - basically the same issues as ACherry. I also ran into the System.Web reference not found problem (very strange!) but didn't have time to investigate that further. ACherry, did you get that one solved?

Also I noticed that the Nant build scripts have erroronwarn set to true which causes a few issues as there are some warnings produced by Spring.Core and Spring.Aop. I added a few more error codes into the ignore pattern as a quick hack to work around that - whats the normally accepted plan there Mark?

I'll generate a patch from my diffs tonight and attach it here.

In the mean time I am working through the MOMA report and the Mono source code figuring out which warnings are legitimate problems. The good news is that so far it looks like Spring.Core is ok. The MOMA warnings on the ILGenerator.EmitCall are only to do with the varargs overload of that method and the Spring.Core calls pass null which should be fine.

Stay tuned for further updates ;)

chrisjsmith
04-24-2008, 11:16 PM
Nice work :)

.ben
04-25-2008, 10:00 AM
Thumbs up!

Mark Pollack
04-25-2008, 02:18 PM
Hi,

Great! I believe the System.Web reference issue might be solved as suggested in this link (http://lists.ximian.com/archives/public/mono-list/2006-June/031838.html)

If you can email me the patches/files that would be great, I might be able to put them in the 1.1.2 release. mark dot pollack at springsource dot com.

By the way, in Core there is a hack due to the odd fact (afaik) that Mono didn't implement XML validation in the same way as in the microsoft framework. See the Mono XML (http://www.mono-project.com/XML), "The design of Mono's XmlValidatingReader is radically different from that of Microsoft's implementation". The place this is used is in the method DoLoadObjectDefinitions of XmlObjectDefinitionReader. Perhaps I missed something obvious there but I'd appreciate an experience mono developer to take a look.

Cheers,
Mark

roboguy
04-25-2008, 04:24 PM
I've stuck a bit of a weird issue with Spring.Core not behaving properly in my application I'm using to test on Mono. It's proving extremely difficult to track down (due largely to my lack of familiarity with the Spring.NET internals). Basically when you start an application that makes use of the attribute driven transaction support the application crashes at start up. Remove the <tx:attribute-driven/> from the config file and the app starts fine?!

I've pasted the stack trace at the end of the post in case anyone has any insight to offer.

Regarding the Xml Validation the hack is still needed. I wouldn't describe myself as an experience Mono developer, but I'll certainly take a look, although I'd like to get the basic functionality working first - perhaps this is working a bit backwards though?

Anyway, I'll keep hacking.


System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': Cannot get an object definition with a null or zero length object name string. () () ---> Spring.Util.FatalReflectionException: Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(String, Boolean, String[])] : 'Exception has been thrown by the target of an invocation.' ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'Spring.Transaction.Interceptor.TransactionAttribu teSourceAdvisor' : Initialization of object failed : Cannot get an object definition with a null or zero length object name string.
while resolving 'transactionInterceptor' to '(inner object)' ---> System.ArgumentException: Cannot get an object definition with a null or zero length object name string.
at Spring.Objects.Factory.Support.DefaultListableObje ctFactory.GetObjectDefinition (System.String name, Boolean includeAncestors) [0x00000]
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetMergedObjectDefinition (System.String name, Boolean includingAncestors) [0x00000]
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name, System.Type requiredType, System.Object[] arguments) [0x00000]
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveReference (IConfigurableObjectDefinition definition, System.String name, System.String argumentName, Spring.Objects.Factory.Config.RuntimeObjectReferen ce reference) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveValueIfNecessary (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.String argumentName, System.Object argumentValue) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ApplyPropertyValues (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper, IPropertyValues properties) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.PopulateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ConfigureObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x00000] --- End of inner exception stack trace ---

at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x00000]
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveInnerObjectDefinition (System.String name, System.String innerObjectName, System.String argumentName, IObjectDefinition definition, Boolean singletonOwner) [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.Util.ObjectUtils.InstantiateType (System.Reflection.ConstructorInfo constructor, System.Object[] arguments) [0x00000] --- End of inner exception stack trace ---

at Spring.Util.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]
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] --- End of inner exception stack trace ---

at Spring.Context.Support.ContextHandler.Create (System.Object parent, System.Object configContext, System.Xml.XmlNode section) [0x00000]
at System.Configuration.ConfigurationSection.GetRunti meObject () [0x00000]
at System.Configuration.ClientConfigurationSystem.Sys tem.Configuration.Internal.IInternalConfigSystem.G etSection (System.String configKey) [0x00000]
at System.Configuration.ConfigurationManager.GetSecti on (System.String sectionName) [0x00000]
at Spring.Util.ConfigurationUtils.GetSection (System.String sectionName) [0x00000]
at Spring.Context.Support.ContextRegistry.InitializeC ontextIfNeeded () [0x00000]
at Spring.Context.Support.ContextRegistry.GetContext () [0x00000]

Mark Pollack
04-25-2008, 04:43 PM
Hi,
Can you post your configuration as well? Do all the unit tests pass for core, aop, data? I presume yes if you did the nant build - though I remember having a hard time getting nunit tests to work when I tried to work with mono. tx-attributedriven is using AOP under the covers, not sure it is related to you issue at the moment, more of an fyi. If you try to get the tx-quickstart app working that would give us some common ground.
Cheers,
Mark

roboguy
04-25-2008, 07:06 PM
Hi Mark,

I actually haven't run the tests for Core and AOP yet. I'll work on getting the unit tests working now.

Here is the output of the TxQuickstart unit tests:


NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.

Copyright (C) 2000-2003 Philip Craig.

All Rights Reserved.

OS Version: Unix 2.6.24.16 Mono Version: 2.0.50727.42

.F.F.N..

Tests run: 4, Failures: 2, Not run: 1, Time: 1.476637 seconds

Tests run: 4, Failures: 2, Not run: 1, Time: 1.476637 seconds

Failures:
1) Spring.TxQuickStart.AccountManagerTests.TransferBe lowMaxAmount : Spring.Objects.Factory.ObjectCreationException : Error thrown by a dependency of object 'Spring.Transaction.Interceptor.TransactionAttribu teSourceAdvisor' : Initialization of object failed : Cannot get an object definition with a null or zero length object name string.
while resolving 'transactionInterceptor' to '(inner object)'
----> System.ArgumentException : Cannot get an object definition with a null or zero length object name string.

at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x001cf] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:906
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveInnerObjectDefinition (System.String name, System.String innerObjectName, System.String argumentName, IObjectDefinition definition, Boolean singletonOwner) [0x00024] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:1984
--ObjectCreationException
at Spring.Objects.Factory.Support.DefaultListableObje ctFactory.GetObjectDefinition (System.String name, Boolean includeAncestors) [0x0006f] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs:535
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetMergedObjectDefinition (System.String name, Boolean includingAncestors) [0x0001c] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:515
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name, System.Type requiredType, System.Object[] arguments) [0x0008a] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:261
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name) [0x00000] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:1626
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveReference (IConfigurableObjectDefinition definition, System.String name, System.String argumentName, Spring.Objects.Factory.Config.RuntimeObjectReferen ce reference) [0x0008f] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:2042
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveValueIfNecessary (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.String argumentName, System.Object argumentValue) [0x00102] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:1857
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ApplyPropertyValues (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper, IPropertyValues properties) [0x000aa] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:360
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.PopulateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x00274] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:549
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ConfigureObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x0002e] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:2159
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x00198] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:890

2) Spring.TxQuickStart.AccountManagerTests.TransferAb oveMaxAmount : Spring.Objects.Factory.ObjectCreationException : Error thrown by a dependency of object 'Spring.Transaction.Interceptor.TransactionAttribu teSourceAdvisor' : Initialization of object failed : Cannot get an object definition with a null or zero length object name string.
while resolving 'transactionInterceptor' to '(inner object)'
----> System.ArgumentException : Cannot get an object definition with a null or zero length object name string.

at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x001cf] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:906
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveInnerObjectDefinition (System.String name, System.String innerObjectName, System.String argumentName, IObjectDefinition definition, Boolean singletonOwner) [0x00024] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:1984
--ObjectCreationException
at Spring.Objects.Factory.Support.DefaultListableObje ctFactory.GetObjectDefinition (System.String name, Boolean includeAncestors) [0x0006f] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs:535
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetMergedObjectDefinition (System.String name, Boolean includingAncestors) [0x0001c] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:515
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name, System.Type requiredType, System.Object[] arguments) [0x0008a] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:261
at Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject (System.String name) [0x00000] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs:1626
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveReference (IConfigurableObjectDefinition definition, System.String name, System.String argumentName, Spring.Objects.Factory.Config.RuntimeObjectReferen ce reference) [0x0008f] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:2042
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveValueIfNecessary (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.String argumentName, System.Object argumentValue) [0x00102] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:1857
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ApplyPropertyValues (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper, IPropertyValues properties) [0x000aa] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:360
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.PopulateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x00274] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:549
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ConfigureObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, IObjectWrapper wrapper) [0x0002e] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:2159
at Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject (System.String name, Spring.Objects.Factory.Support.RootObjectDefinitio n definition, System.Object[] arguments, Boolean allowEagerCaching) [0x00198] in /home/james/MonoDevelopProjects/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs:890

Tests not run:
1) Spring.TxQuickStart.AccountManagerTests.TransferAb oveMaxAmountNoRollbackFor : Change impl of AccountManager as shown before running this test


Cheers,
James

roboguy
04-28-2008, 10:01 AM
Woot! I can report I have a non trival middle tier application service up and running on Mono. It provides spring configured sao remoting services and I've written a number of unit tests and everything seems to be operating as expected including transaction management for nhibernate. So at this stage it looks like Spring.Core, Spring.Aop, Spring.Data, Spring.Services, Spring.Data.Nhibernate12 are all working as expected.

The break through came after doing extensive debugging around the schema validation stuff. I now have a much better understanding of how Spring uses the xml schemas to configure objects.

The Mono implementation of the XmlValidatingReader/XmlReader does actually work, it is simply a LOT stricter than the Microsoft one. In actual fact it could be argued that the Microsoft implementation is buggy as it allows xml that is (strictly speaking) invalid to pass validation.

There is one issue arising from the Mono XmlValidatingReader implementation and I'm not sure what the most appropriate solution to address it is. The Mono implementation will fail on the schema import in the remoting schema:

<xs:import namespace="http://www.springframework.net"/>

In order to work correctly the Mono implementation requires the schemaLocation attribute to be set i.e

<xs:import namespace="http://www.springframework.net" schemaLocation="http://www.springframework.net/schema/remoting/spring-remoting-1.1.xsd"/>

Now I'm not sure what the most appropriate solution to this is, obviously having every Mono app depend on being able to grab the schemas from the springframework.net website isn't ideal. It maybe that we need to implement a custom XmlResolver that can deal with xsd's stored as embedded resources in assemblies as is the case in Spring.NET. What's your take on this Mark?

I still have a lot of cleaning up to do before I'll have a patch ready with my changes (I need to strip out a bunch of debugging code I've added). I should hopefully have something ready tonight.

I still can't get the tests to run via the NAnt script, it keeps falling over on the nunit2outproc task so that needs some more investigation.

Once I have the patch for the current stuff cleaned up I'll start looking at Spring.Web. I know there are bunch of places that will need some work in there...

Cheers,
James

Mark Pollack
04-29-2008, 09:26 PM
Hi,

Great news! The custom XmlResolver sounds like the way to go at first glance, I believe similar approach is done in the Java implementation.

What are the errors reported by MOMA now regarding calls we make in the reflection emit namespace? I know that in Spring.Services the EnterpriseServices namespace isn't supported, so that is an obvious thing to point out, but it is less clear what user scenarios would not be supported due to incomplete Reflection emit calls.

The nunit2outproc task was used so that the same nant process could run nunit test runners that would operate under the various versions of the .NET framework, since we compile for 1.0,1.1, and 2.0 the default nant behavior of running the tests under the framework version that started nant wasn't good.

The alternative to use nunit2outproc is to spawn a new instance of nant for each framework version and set some 'magic' attributes. I forget which. At the moment you are probably just compiling with .NET 2.0 so it isn't that critical to get this fixed now. Feel free to ping Erich Eichinger at eeichinger at gmail dot com should you have some questions as he authored that code.

Cheers,
Mark

roboguy
05-07-2008, 09:46 AM
I meant to post an update last week but ran out of time.

I've done some work on implementing the custom XmlResolver and have an implementation that will work correctly on both Mono and Microsoft .NET frameworks (it takes advantage of some inconsistencies in behaviour between the two frameworks though). I also need to get a bug fixed in Mono's XmlSchema impmenetation and hope to submit a patch for that this week.

What are the errors reported by MOMA now regarding calls we make in the reflection emit namespace? I know that in Spring.Services the EnterpriseServices namespace isn't supported, so that is an obvious thing to point out, but it is less clear what user scenarios would not be supported due to incomplete Reflection emit calls.

Mono's EmitCall implementation doesn't allow varargs at the moment, but I have audited all cases of EmitCall usage in Spring.Net and in no case is the varargs parameter used (null is always passed) so I don't believe this to be a problem.

I've started on getting Spring.Web working and have fixed a few bugs already, hopefully I should have a working solution this week. It's all looking pretty promising!

Cheers,
James

Erich Eichinger
07-05-2008, 09:13 PM
Hi,

this really sounds great - if I can be of any help making Spring.Web run on Mono, plz let me know. Maybe it's worth noting, that I plan to rework some of the current implementation internals of Spring.Web - so I'm all open for any improvement suggestions from your side!

Keep up your great work!

cheers,
Erich

Mark Pollack
07-05-2008, 09:16 PM
Hi,
James is away until mid-July, but said he would contribute his work when he gets back.
-Mark

gael.pawlak
11-03-2008, 09:12 PM
Hi,

I compiled the 1.2 RC1 this week-end... it's an adventure with mono ;-) I finaly built Core, Aop, Web, Data, Data.NHibernate20 and Service.

A missing class is System.Web.UI.SimpleHandlerFactory that is internal to the Microsoft System.Web.dll and is not in the ECMA standard ! A simple implementation in the Spring.Web.UI and replace the reflection call by instantiate it rules.

But now, I meet an error I met this spring (whithout word game) in .net version : spring.root doesn't instantiate with a NullReferenceException thrown in the GetSection... I continue to look into the problem tomorrow

Gael

Erich Eichinger
11-03-2008, 09:22 PM
Hi,

Cool!!!!!!!!

If you find more issues let us know! You can send patches here on the forum using private messages to Mark Pollack or me.

cheers,
Erich

roboguy
11-03-2008, 09:24 PM
Hi Gael,

Unfortunately Spring.Web is a long way from running on Mono. This is due to the fact that in a large number of places in the spring.web code reflection is used to access private methods and members that are not part of the public API. As these methods or members may or may not exist in Mono, and even if they do they probably won't have the same names, there is a large amount of Mono specific hacking to be done on Spring.Web before it will work. It also means that there will never be a cross platform binary for Spring.Web.

I started on this a few months ago, however other commitments have meant that I've had to shelve this work for a while. I hope to return to it in the coming months.

Cheers,
James

Mark Pollack
11-03-2008, 09:24 PM
Hi,
Thanks. I put a bit of time into getting things to compile with Mono 2.0 as of Oct 1st 2008. These changes are in subversion. If you get the latest code I think all you should need to do is use the latest version of NAnt and enable the line

<call target="${nant.target.root.name}-mono-2.0" />
In the nant function "build-all-function". What issues did you run into? I was able to compile the same set of libs as you...except didn't pass the tests.

I commented out some of the tests where resolution against the serbian culture were failing - not sure what is going on there but I'm pretty confident it is due to the wierdness of that 'culture', so to speak. there were issues in Msoft .NET to get it all to work correctly with serbian, say as compared to french or russian.

Keep me posted, it would be nice to close this issue as there are many details an iterations to get it all working for some time now.

Cheers,
Mark

You can post relevant tech details on JIRA issue - http://jira.springframework.org/browse/SPRNET-296

Erich Eichinger
11-04-2008, 12:00 AM
Hi,

wrt running Spring.Web on Mono: Most of the reflection hacks deal with intercepting Page/Control instantiation, so that users don't have to worry about it.
But it should be a no brainer to implement a different DI strategy for Mono like e.g. AutoFac is doing by hooking into the Page.InitComplete event and iterating over all controls on the page at this stage. Of course this does not give the guarantee, but there's still Spring's <spring:Panel> that can be used to enable DI on it's contained controls.

As far as I remember, there are only 2 other things we need to deal with:

1)
The call to HttpRuntime.ProcessRequestNow() in WebSupportModule. This call is necessary to ensure certain initialization is done when using the "ASP.NET Admin" Web from within VS (which uses the questionable System.Web.Administration.* stuff)

2)
hooking into the in-memory Session_End event to ensure, that 'session' scoped objects are properly disposed.

hth,
Erich

gael.pawlak
11-13-2008, 07:21 PM
Hi,

Spring.Web works on my system but with some limitations and via local adpatations. I give you this little account of the installation. Hoping this will be useful for your team.

-----------------------



Install of Spring.NET 1.2.0 With Mono 1.9.1 on Mandriva 2009.

1/ Building Spring.NET

1a/ Install nant
I used the 0.86 beta version for building

1b/ Find, build and place libraries
Mono lirairies are not in the Spring.NET. Find antlr at www.antlr2.org (I used the 2.7.6.2) and Common.Logging at sourceforge.I built them with the config mono 2.0 and place them in Spring.NET12/lib/mono/2.0/. For NHbiernate, add libraries in lib/NHibernate20/mono/2.0

1c/ Mofidy a file in Spring.Web
In src/Spring/Spring.Web/Web/Support/InterceptControlCollectionStrategy.cs, lines 142-143 : DynamicMethod take a fourth argument, I gave it 'ownerType' and the code passed at compilation. Other solution, at line 122, add '&& !MONO' to compilator condition.

1d/ Modify build files
Spring.include : comment readregistry commands
Spring.build : comment the readregistry command, comment the sets that you don't want to build (I kept Core, Aop, Web, WebExtensions, Data, Data.NHibernate and Services without examples and without tests).
There is a readregistry command in spring.services.build to comment.

1e/ Build
"nant build-mono-2.0" builds Spring.NET in build/mono/2.0/debug(or release)

2/ Use of Spring in a simple Web application with XSP2

2a/ Spring.Web/Spring.Context.Support.WebSupportModule.cs
line 81 and 151, I needed to add '&& !MONO' to compilator condition because the mono HttpContext doesn't have a HideRequestResponde Field (thanks reflector...)

2b/ Spring.Web/Spring.Context.Support.WebContextHandler.cs
the problem is that XSP2 gives a null configContext. Then, In WebContextHandler.GetContextName I added "if (configContext == null) return (String.Empty);" at the begin. It works but children context are not attached at [spring.root], each one is [spring.root], then I must declare all my context at the root of application...

2c/ Spring.Web/Spring.Web.Support.ControlAccessor.cs
I commented the delegate for "ClearNamingContainer"(it doesn't exist in mono) and the related code.
I had to simplify the Controls property ; get just returns _targetControl.Controls ; and set does nothing.

I rewrote the SetcontroleAt to not use the safeField (the code may be inefficient but works...) :
public void SetControlAt(Control control, int index)

{
Control[] controls = new Control[this.Controls.Count];
this.Controls.CopyTo(controls, 0);

controls[index] = control;
this.Controls.Clear();
for(Int32 i=0; i < controls.Length; i++)
this.Controls.Add(controls[i]);
}

2d/ Spring.Web/Spring.Web.Support.LocalResourceManager.cs
It calls different classes that don't exist in mono... I choose to activate the old system in Spring.web.UI.Page, MasterPage and UserControl. Thus there is no class that catch MissingManifestException, I must compile a resource for each page...

--------------------------------------------------------

It finally works with some limitations but for my application, this is acceptable.

Regards
Gaƫl