I am porting an ASP.NET Webform application that runs with Spring.Net and NHibernate to ASP.NET MVC3. After creating a new project and verifying that Spring.Net can properly inject dependencies across projects in the same solution, I went on with the import of the service and persistence layer projects in the new solution.
My mappings now look somewhat ok (more about it at the end of this post) but when I start the application, I get the following error:
No persistence exception translators found in container. Cannot perform exception translation.
[ConfigurationErrorsException: Error creating context 'spring.root': No persistence exception translators found in container. Cannot perform exception translation.]
If I understand this well, it means that an exception was raised and that Spring.Net does not know how to map / handle it... is that correct?
Assuming that it came from NHibernate, and as explained in section 44.3.3 from the SpringFramework documentation related to NHibernate integration, I added an ExceptionTranslationProcessor to my mapping...
<object type="Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor, Spring.Data"/>
... but it does not seem to do anything and I don't know where to look further. Anyone with a brilliant idea or a hint around?
Thanks in advance!
Here's some data for reference purpose:
To the web.config file I added the spring section group and the references to the xml definition files:
<configuration>
<!-- Snip -->
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.MvcContextHandler, Spring.Web.Mvc3"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="file://~/Config/controllers.xml"/>
<resource uri="assembly://Service/Service.Config/Service.xml"/>
<resource uri="assembly://Persistence.Hibernate/Persistence.Hibernate.Config/Persistence.xml"/>
</context>
</spring>
<!-- Snip -->
</configuration>
The PersistenceExceptionTranslationPostProcessor I added in the Persistence.xml file. Out of ideas, I also tried adding it to the other xml but it did not do anything.