File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Error pointing to a Hashtable but I don't have a Hashtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Error pointing to a Hashtable but I don Watch "Error pointing to a Hashtable but I don New topic
Author

Error pointing to a Hashtable but I don't have a Hashtable

Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Good day!

Oct 10, 2007 9:41:41 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet ControllerServlet threw exception

I have a program with these parts, Bean.java, ControllerServlet.java, read.jsp, ReadWrite.java., it reads data from a machine and it works fine the first time I load it but when I click the button which supposed to read data again, this error occurs.

java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:336)
at org.apache.tomcat.util.http.Parameters.getParameterValues(Parameters.java:193)
at org.apache.tomcat.util.http.Parameters.getParameter(Parameters.java:238)
at org.apache.catalina.connector.Request.getParameter(Request.java:1007)
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:353)
at com.amkor.stripmap.ControllerServlet.doPost(ControllerServlet.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
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:210)
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:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
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:685)
at java.lang.Thread.run(Thread.java:595)


I don't understand this error. First of all, I did not use Hashtable.

Thanks.

[ October 09, 2007: Message edited by: Darren Alexandria ]
[ October 09, 2007: Message edited by: Darren Alexandria ]
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

The root cause is a NullPointerException, shown at the top of the stack trace. If you continue down the stack, you will see, as you noted, that the get method of the HashTable class threw the NullPointerException. If we continue down the stack trace, we see that the HashTable is used by the Parameters class (org.apache.tomcat.util.http.Parameters) that is part of Tomcat (at org.apache.tomcat.util.http.Parameters.getParameterValues(Parameters.java:193)). This in turn was used by other Tomcat classes. So we can deduce that Tomcat is using a HashTable to store the name/value (or key/value) pairs for parameters.

If we look at the JavaDoc for the HashTable's get(Object) method, it states:


Throws:
NullPointerException - if the specified key is null


So, ultimately, the issue is that somewhere your code is asking Tomcat to fetch a parameter value, but the parameter key you are passing in is a null value.
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
wow, thanks, I will try to search where in my code is that value that is always null. I will first try to remove it and see what will happen.

Thanks so much.

Darren
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Originally posted by Darren Alexandria:
I will try to search where in my code that value that is always null


my "guess" would be line 34 of your ControllerServlet

...
at com.amkor.stripmap.ControllerServlet.doPost(ControllerServlet.java:34)
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
okay, I have removed it already.
That error doesn't appear anymore.
Thanks. Next time, I will try to analyze the stack trace.

Now I have a new problem. I can't get the button to Read the data again.
Anyway, thanks for your replies.

God bless.

Darren
 
jQuery in Action, 2nd edition
 
subject: Error pointing to a Hashtable but I don't have a Hashtable