-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Null pointer exception on session flush
PostPosted: Mon Oct 17, 2005 8:22 pm 
Newbie

Joined: Thu Sep 22, 2005 7:09 pm
Posts: 14
I'm getting the NullPointerException included below when my DAO calls flush(). I have no idea why... The stack trace is in checkNaturalId so I've included that part of my mapping doc below; the natural ID property and the database ID property are both set correctly. Any clues?

Hibernate version:

3.1beta3

Mapping documents:

<hibernate-mapping package="..." default-access="field">
<class name="ProjectBO" table="projects" lazy="true">
<id name="id"><generator class="native"/></id>

<natural-id mutable="false">
<property name="name" length="32" not-null="true"/>
</natural-id>

...

Full stack trace of any exception that occurs:

java.lang.NullPointerException
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkNaturalId(DefaultFlushEntityEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:145)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:97)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:877)
at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:713)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:711)
at com.foo.projility.domain.BaseDAOHib.update(BaseDAOHib.java:135)
at com.foo.projility.modules.project.domain.ProjectService.updateProject(ProjectService.java:106)
at com.foo.projility.modules.project.domain.ProjectService$$FastClassByCGLIB$$9ec3bb15.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:661)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:606)
at com.foo.projility.modules.project.domain.ProjectService$$EnhancerByCGLIB$$924524f4.updateProject(<generated>)
at com.foo.projility.modules.project.web.ProjectEditAction.execute(ProjectEditAction.java:149)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.foo.projility.web.auth.UserAuthenticationFilter.doFilter(UserAuthenticationFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:613)

Name and version of the database you are using:

Postgres 7.4.3

The generated SQL (show_sql=true):

Doesn't get as far as running any SQL...

Debug level Hibernate log excerpt:

DEBUG [http-8080-Processor23] projility.modules.project.domain.ProjectDAOHib - Update class com.foo.projility.modules.project.domain.ProjectBO: [ProjectBO: Path='/Projects/Project 13'; Name='Project 13'; Status='FUTURE'; Owner='admin'] (releases: 0) desc: project 13 desc
DEBUG [http-8080-Processor23] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating detached instance
DEBUG [http-8080-Processor23] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [com.foo.projility.modules.project.domain.ProjectBO#71]
DEBUG [http-8080-Processor23] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [com.foo.projility.modules.project.domain.ProjectBO#71]
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - processing cascade ACTION_SAVE_UPDATE for: com.foo.projility.modules.project.domain.ProjectBO
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - cascade ACTION_SAVE_UPDATE for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done cascade ACTION_SAVE_UPDATE for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - deleting orphans for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done deleting orphans for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done processing cascade ACTION_SAVE_UPDATE for: com.foo.projility.modules.project.domain.ProjectBO
DEBUG [Finalizer] org.hibernate.jdbc.ConnectionManager - running Session.finalize()
DEBUG [http-8080-Processor23] org.hibernate.event.def.AbstractFlushingEventListener - flushing session
DEBUG [http-8080-Processor23] org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - processing cascade ACTION_SAVE_UPDATE for: com.foo.projility.modules.project.domain.ProjectBO
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - cascade ACTION_SAVE_UPDATE for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done cascade ACTION_SAVE_UPDATE for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - deleting orphans for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done deleting orphans for collection: com.foo.projility.modules.project.domain.ProjectBO.releases
DEBUG [http-8080-Processor23] org.hibernate.engine.Cascade - done processing cascade ACTION_SAVE_UPDATE for: com.foo.projility.modules.project.domain.ProjectBO
DEBUG [http-8080-Processor23] org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
DEBUG [http-8080-Processor23] org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
DEBUG [http-8080-Processor23] org.hibernate.transaction.JDBCTransaction - rollback
DEBUG [http-8080-Processor23] org.hibernate.jdbc.JDBCContext - before transaction completion
DEBUG [http-8080-Processor23] org.hibernate.impl.SessionImpl - before transaction completion
DEBUG [http-8080-Processor23] org.hibernate.transaction.JDBCTransaction - re-enabling autocommit
DEBUG [http-8080-Processor23] org.hibernate.transaction.JDBCTransaction - rolled back JDBC Connection
DEBUG [http-8080-Processor23] org.hibernate.jdbc.JDBCContext - after transaction completion
DEBUG [http-8080-Processor23] org.hibernate.impl.SessionImpl - after transaction completion
DEBUG [http-8080-Processor23] org.hibernate.impl.SessionImpl - closing session
DEBUG [http-8080-Processor23] org.hibernate.jdbc.ConnectionManager - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG [http-8080-Processor23] org.hibernate.jdbc.JDBCContext - after transaction completion
DEBUG [http-8080-Processor23] org.hibernate.impl.SessionImpl - after transaction completion
WARN [http-8080-Processor23] org.apache.struts.action.RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
ERROR [http-8080-Processor23] ContainerBase.[Catalina].[localhost].[/].[action] - Servlet.service() for servlet action threw exception
java.lang.NullPointerException
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkNaturalId(DefaultFlushEntityEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:145)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:97)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:877)
at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:713)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:711)
at com.foo.projility.domain.BaseDAOHib.update(BaseDAOHib.java:135)
at com.foo.projility.modules.project.domain.ProjectService.updateProject(ProjectService.java:106)
at com.foo.projility.modules.project.domain.ProjectService$$FastClassByCGLIB$$9ec3bb15.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:661)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:606)
at com.foo.projility.modules.project.domain.ProjectService$$EnhancerByCGLIB$$924524f4.updateProject(<generated>)
at com.foo.projility.modules.project.web.ProjectEditAction.execute(ProjectEditAction.java:149)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.foo.projility.web.auth.UserAuthenticationFilter.doFilter(UserAuthenticationFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:613)

_________________
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/


Top
 Profile  
 
 Post subject: Any suggestions?
PostPosted: Thu Oct 20, 2005 11:07 pm 
Newbie

Joined: Thu Sep 22, 2005 7:09 pm
Posts: 14
Does anyone have any suggestions on what's going on with this? I've had to comment out the natural-id part of the mapping document to get things working, but obviously that's not ideal...

L.

_________________
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.