-->
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.  [ 5 posts ] 
Author Message
 Post subject: Please help with Hibernate object Property Exception
PostPosted: Sun Sep 25, 2005 2:12 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 1:23 pm
Posts: 35
This is with Hibernate 3.0.5.

I do a Hibernate query, get a class "Rating" from the database. That works fine. Then I get a strange exception during a very basic property set:

Code:
rating.setRatingDate(new Date());


The exception stack looks like:

Code:
Hibernate: select rating0_.UserID as UserID0_, rating0_.RatableItemID as RatableI2_0_, rating0_.OriginalRating as Original3_5_0_, rating0_.NormalizedRating as Normaliz4_5_0_, rating0_.RatingDate as RatingDate5_0_, rating0_.Enabled as Enabled5_0_ from Ratings rating0_ where rating0_.UserID=? and rating0_.RatableItemID=?
Error performing load command
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.auenrec.data.Rating.setEnabled
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)
   at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2919)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
   at org.hibernate.loader.Loader.doQuery(Loader.java:436)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1345)
   at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
   at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:101)
   at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2471)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:351)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:332)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:75)
   at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:643)
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:59)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
   at com.auenrec.data.Rating$$EnhancerByCGLIB$$82da146e.setRatingDate(<generated>)
   at com.auenrec.webbean.ItemRater.doRateItem(ItemRater.java:76)
   at com.auenrec.webbean.ItemRater.getArtificalLoadTrigger(ItemRater.java:30)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
   at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
   at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
   at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
   at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
   at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
   at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
   at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
   at com.sun.faces.taglib.html_basic.OutputTextTag.doEndTag(OutputTextTag.java:173)
   at org.apache.jsp.pages.member.RateItem_jsp._jspx_meth_h_outputText_0(org.apache.jsp.pages.member.RateItem_jsp:157)
   at org.apache.jsp.pages.member.RateItem_jsp._jspx_meth_f_view_0(org.apache.jsp.pages.member.RateItem_jsp:123)
   at org.apache.jsp.pages.member.RateItem_jsp._jspService(org.apache.jsp.pages.member.RateItem_jsp:71)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
   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 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.auenrec.webbean.VeilControlFilter.doFilter(VeilControlFilter.java:33)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at com.auenrec.webbean.MemberControlFilter.doFilter(MemberControlFilter.java:33)
   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:595)
Caused by: net.sf.cglib.beans.BulkBeanException
   at com.auenrec.data.Rating$$BulkBeanByCGLIB$$6d325306.setPropertyValues(<generated>)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)
   ... 80 more
Caused by: java.lang.NullPointerException
   ... 82 more


How does the Hibernate code intercept my property set method? I don't even know where to start debugging.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 3:21 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
I recommend that you apply the suggestion in the trace and set
Code:
hibernate.cglib.use_reflection_optimizer=false

in your Hibernate properties. Then you will hopefully get an error that is easier to understand.

Erik


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 3:25 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 1:23 pm
Posts: 35
ErikFK wrote:
I recommend that you apply the suggestion in the trace and set
Code:
hibernate.cglib.use_reflection_optimizer=false

in your Hibernate properties. Then you will hopefully get an error that is easier to understand.

Erik


I added to hibernate.cfg.xml:

Code:
<property name="hibernate.cglib.use_reflection_optimizer">false</property>


Still simliar error:

Code:
Caused by: org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.auenrec.data.Rating.setEnabled
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)
   at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2919)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
   at org.hibernate.loader.Loader.doQuery(Loader.java:436)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1345)
   at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
   at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:101)
   at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2471)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:351)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:332)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:75)
   at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:643)
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:59)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
   at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
   at com.auenrec.data.Rating$$EnhancerByCGLIB$$46124de9.setRatingDate(<generated>)
   at com.auenrec.webbean.ItemRater.doRateItem(ItemRater.java:76)
   at com.auenrec.webbean.ItemRater.getArtificalLoadTrigger(ItemRater.java:30)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
   ... 54 more
Caused by: net.sf.cglib.beans.BulkBeanException
   at com.auenrec.data.Rating$$BulkBeanByCGLIB$$6d325306.setPropertyValues(<generated>)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)
   ... 80 more
Caused by: java.lang.NullPointerException
   ... 82 more


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
As per the docs, it is a system-level setting and must be applied using hibernate.properties.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 3:37 pm 
Beginner
Beginner

Joined: Sun Jul 31, 2005 1:23 pm
Posts: 35
gavin wrote:
As per the docs, it is a system-level setting and must be applied using hibernate.properties.


I thought that you used either hibernate.properties or hibernate.cfg.xml. From the docs:
Quote:
For Hibernate's configuration, we can use a simple hibernate.properties file, a slightly more sophisticated hibernate.cfg.xml file, or even complete programmatic setup. Most users prefer the XML configuration file


You are saying that some options required the use of the hibernate.properties file? Can I set this one option programmatically?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.