-->
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.  [ 3 posts ] 
Author Message
 Post subject: Absurd null pointer exception
PostPosted: Tue Oct 04, 2005 7:17 am 
Newbie

Joined: Wed Jul 06, 2005 10:18 am
Posts: 5
I am having what appears to be an absurd problem with Tomcat and null pointers (and Hibernate, although this seems only marginally related to Hibernate). When I creat an object via a form, passed to a servlet, then back to the JSP to render the view, I consistently get a null pointer exception. The object is being persisted with no issues, and when I attempt to access the view directly, I can see the newly persisted object with no difficulty. Has anyone encountered anything like this? I'm certain I'm doing something simple that's causing this but can't figure it out for the life of me.

Code:
root cause

java.lang.NullPointerException
        org.apache.jsp.myview_jsp._jspService(org.apache.jsp.myview_jsp:871)
        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:322)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        com.mycompany.gtdb.controller.ViewAsset.doGet(Unknown Source)
        com.mycompany.gtdb.controller.ViewAsset.doPost(Unknown Source)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        net.traxtech.gtdb.controller.AddGuntube.doPost(Unknown Source)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        com.mycompany.util.HibernateFilter.doFilter(Unknown Source)


Thanks,

Coleman


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 1:02 pm 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
what's in line 871 of myview_jsp.java?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 3:55 pm 
Newbie

Joined: Wed Jul 06, 2005 10:18 am
Posts: 5
Got it - turns out it was an empty collection that I was not initializing. Adding the newly constructed object to the attributes kept Hibernate from running the getter - which would create an empty collection. I was trying to iterate through said collection in the view, which obviously causes the null pointer exception when said set is simly null and not actually an empty set. Thanks for the pointer!


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