*
The moose likes Java in General and the fly likes NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "NullPointerException" Watch "NullPointerException" New topic
Author

NullPointerException

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi, i am getting the following error when i run my code.
I think i am using null where the object is required.but i dont know how to solve it.Anyone help me please.

The following is the error.

java.lang.NullPointerException
at com.example.servlets.OutboundServlet1.doGet(OutboundServlet1.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)


[ April 03, 2008: Message edited by: preethi Ayyappan ]

[ April 03, 2008: Message edited by: preethi Ayyappan ]
[ April 03, 2008: Message edited by: preethi Ayyappan ]
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Line number 67 of your servlet is throwing the exception.
Just check whatever objects you have there, can they be null?
If yes, then either do a null check or make sure they are non null.


apigee, a better way to API!
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Thanks.The below line is line no:67.

abstractMeetme.getMeetMe();

getMeetMe() is the method of the abstract class AbstractMeetMeEvent.In the definition for the AbstractMeetMeEvent.java, the following is given.

protected AbstractMeetMeEvent(Object source)
{
super(source);
}

Now what i have to do in my code.If it needs an object,what should i do there?please guide me.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
It would appear that you have no object associated with the variable abstractMeetMe. Check carefully where that object is supposed to be initialised.

If that doesn't help, make sure the meetMe variable is not null.
 
jQuery in Action, 2nd edition
 
subject: NullPointerException