aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate: Error getting property 'lastItem' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Error getting property Watch "Hibernate: Error getting property New topic
Author

Hibernate: Error getting property 'lastItem'

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi guys! I'm so new to hibernate and I think I just incremented my iGotStuck counter. I'm following a tutorial made by netbeans themselves

http://www.netbeans.org/kb/articles/hibernate-javaee.html

and I think it's a little hard to follow for beginners. I was able to get to the last part, except when I already try to run the app I get this error which left me totally clueless.


HTTP Status 500 -

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

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.NoClassDefFoundError: javax/transaction/SystemException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.NoClassDefFoundError: javax/transaction/SystemException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspService(List_jsp.java:103)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause

javax.faces.el.EvaluationException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.NoClassDefFoundError: javax/transaction/SystemException
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:89)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
com.sun.faces.el.MixedELValueBinding.getValue(MixedELValueBinding.java:80)
javax.faces.component.UIOutput.getValue(UIOutput.java:147)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
com.sun.faces.taglib.html_basic.OutputTextTag.doEndTag(OutputTextTag.java:173)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_h_outputText_0(List_jsp.java:250)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_h_form_0(List_jsp.java:192)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_f_view_0(List_jsp.java:133)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspService(List_jsp.java:93)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


Does anyone here know what this means? Please help... Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
A "NoClassDefFoundError" typically means that a jar is missing in the classpath, in this case the one that contains, for your server, the javax.transaction.SystemException class.
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks! Is anyone aware in which jar file this class belongs to? Thanks!
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi guys! I think I solved the previous problem. I'm getting a different error message right now... What could be the problem here? Thanks!

HTTP Status 500 -

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

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [select count(o) from Customer as o]
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [select count(o) from Customer as o]
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspService(List_jsp.java:103)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause

javax.faces.el.EvaluationException: Error getting property 'lastItem' from bean of type hibernatesample.db.CustomerController: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [select count(o) from Customer as o]
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:89)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
com.sun.faces.el.MixedELValueBinding.getValue(MixedELValueBinding.java:80)
javax.faces.component.UIOutput.getValue(UIOutput.java:147)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:191)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:169)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
com.sun.faces.taglib.html_basic.OutputTextTag.doEndTag(OutputTextTag.java:173)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_h_outputText_0(List_jsp.java:250)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_h_form_0(List_jsp.java:192)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspx_meth_f_view_0(List_jsp.java:133)
org.apache.jsp.hibernatesample_controller.customer.List_jsp._jspService(List_jsp.java:93)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


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

Apache Tomcat/5.5.17
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Well that last error looks like it is trying to run an HQL query where the from clause is for the Customer class, but the Customer class isn't mapped at all.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hmmm... The Netbeans tutorial only mentioned about persistence.xml but no hibernate mapping at all. Am I missing something about this xml file? Thanks!


persistence.xml

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Does customer have Annotations on it for the mapping? For JPA and Hibernate you can either map using xml or using Annotations. But there needs to be one of them for the class to be mapped. the persistence.xml is what defines your configuration, and lists your mapped classes, but you need to acutally map your classes.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Error getting property 'lastItem'