PDA

View Full Version : [OSIV] Object reference not set to an instance of an object.



abstraction
04-24-2007, 02:51 PM
I'm pretty sure I've got something configured incorrectly, but for the life of me I can't see it. Any pointers would be appreciated.

I'm using the Spring.Data.NHibernate12-20070412-0201 build.

stacktrace


[NullReferenceException: Object reference not set to an instance of an object.]
Spring.Transaction.Support.AbstractPlatformTransac tionManager.ProcessCommit(DefaultTransactionStatus status) in c:\projects\daily\Spring.Net\src\Spring\Spring.Dat a\Transaction\Support\AbstractPlatformTransactionM anager.cs:647
Spring.Transaction.Support.AbstractPlatformTransac tionManager.Commit(ITransactionStatus transactionStatus) in c:\projects\daily\Spring.Net\src\Spring\Spring.Dat a\Transaction\Support\AbstractPlatformTransactionM anager.cs:600
Spring.Transaction.Interceptor.TransactionAspectSu pport.DoCommitTransactionAfterReturning(Transactio nInfo transactionInfo) in c:\projects\daily\Spring.Net\src\Spring\Spring.Dat a\Transaction\Interceptor\TransactionAspectSupport .cs:384
Spring.Transaction.Interceptor.TransactionIntercep tor.Invoke(IMethodInvocation invocation) in c:\projects\daily\Spring.Net\src\Spring\Spring.Dat a\Transaction\Interceptor\TransactionInterceptor.c s:86
Spring.Aop.Framework.AbstractMethodInvocation.Proc eed() in c:\projects\daily\Spring.Net\src\Spring\Spring.Aop \Aop\Framework\AbstractMethodInvocation.cs:283
Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Inv oke(Object proxy, Object target, Type targetType, MethodInfo targetMethod, Object[] args, IList interceptors) in c:\projects\daily\Spring.Net\src\Spring\Spring.Aop \Aop\Framework\DynamicProxy\AdvisedProxy.cs:185
CompositionAopProxy_194e58b8531743759288709f10100c c3.StoreApplication(Application application) +161
My.Application.Web.Step1.InitializeModel() in C:\svn\work\Project\trunk\src\My.Application\Web\S tep1.aspx.cs:33
Spring.Web.UI.Page.OnInit(EventArgs e) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Web\UI\Page.cs:256
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692


dao.xml


<?xml version="1.0" encoding="utf-8" ?>

<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">

<!-- Database and NHibernate Configuration -->
<db:dbProvider id="dbProvider"
provider="SqlServer-2.0"
connectionString="server=localhost;database=db;uid=user;pwd=password"/>

<object id="sessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate12">
<property name="DbProvider" ref="dbProvider"/>
<property name="MappingAssemblies">
<list>
<value>My.Core</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect"/>
<entry key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<entry key="hibernate.connection.isolation" value="ReadCommitted"/>
</dictionary>
</property>
</object>

<object id="hibernateTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager , Spring.Data.NHibernate12">
<property name="DbProvider" ref="dbProvider"/>
<property name="SessionFactory" ref="sessionFactory"/>
</object>
</objects>


service.xml


<?xml version="1.0" encoding="utf-8" ?>

<objects xmlns="http://www.springframework.net">
<object id="applicationService" type="My.Service.ApplicationService, My.Core">
<property name="ApplicationDao" ref="applicationDao" />
</object>

<object id="autoProxyCreator"
type="Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoP roxyCreator, Spring.Aop">
</object>

<object id="transactionAdvisor"
type="Spring.Transaction.Interceptor.TransactionAttribut eSourceAdvisor, Spring.Data"
autowire="constructor">
</object>

<!-- Transaction Interceptor -->
<object id="transactionInterceptor" type="Spring.Transaction.Interceptor.TransactionIntercep tor, Spring.Data">
<property name="TransactionManager" ref="hibernateTransactionManager"/>
<!-- note do not have converter from string to this property type registered -->
<property name="TransactionAttributeSource" ref="attributeTransactionAttributeSource"/>
</object>

<object id="attributeTransactionAttributeSource"
type="Spring.Transaction.Interceptor.AttributesTransacti onAttributeSource, Spring.Data">
</object>
</objects>


web.config snippet


<appSettings>
<add key="Spring.Data.NHibernate.Support.OpenSessionInViewMo dule.SessionFactoryObjectName" value="sessionFactory"/>
</appSettings>

Erich Eichinger
04-24-2007, 06:01 PM
Hi,

sorry - i can't see the problem too. Unfortunately the exceptionhandling inside the ProcessCommit() method is preventing us from getting the exact line of the error. I saw that you are using your own build anyway: Could you please replace all "throw ex;" statements within ProcessCommit() by simple "throw;" statements and repost the stacktrace here?

tx,
erich

abstraction
04-24-2007, 06:57 PM
Thanks for taking a look at it Erich.

It turns out I was violating a not null constraint in sql server. Once I fixed that everything went smoothly.