Posted on 2007-09-30
Last Modified: 2013-12-02
I'm using tomcat with netbeans and developing some servlets.

I have the current code:

public class client extends HttpServlet {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("<title>Admin Area </title>");
        out.println("<h1> Version 3 Admin</h1></br>");
        dbManage db = new dbManage();
        String username = request.getParameter("un") ;
        String action = request.getParameter("action");
        out.println("<p>User account:  has been created.</p>");
        } else if (action.equals("delete")) {
       out.println("<p>User account has been deleted.</p>");
        } else {

When run, I get the error:

HTTP Status 500 -


type Exception report


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



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

However, if I put out.close() right after:

out.println("<h1>Version 3 Admin</h1></br>");

It works fine..

Any ideas?

Question by:rameenvaswani
    LVL 23

    Assisted Solution

    > client.processRequest(
    whats there at line 45?
    LVL 15

    Assisted Solution

    You are referencing a bunch of DB stuff which isn't included in the source. My guess is that one of these calls has failed, and you are using the return value without checking that it's valid, hence the NullPointerException.
    LVL 1

    Accepted Solution

    You are processing request parmeters with out checking for Null. You should always check the request parameters for Null. This might also be a reason.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now