Can't decode JSP Server Error Please help!

Hi,

I wrote this code and I get this huge server error when I run it and I can't for the life of me figure out what's wrong, can someone please help me debug my jsp or explain to me what any of those errors mean?

Here is the error message:

type Exception report

message

description

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

exception

org.apache.jasper.JasperException

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)

at java.lang.Thread.run(Thread.java:536)

root cause

java.lang.NullPointerException

at org.apache.jsp.Pdb_Add_jsp._jspService(Pdb_Add_jsp.java:530)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)

at java.lang.Thread.run(Thread.java:536)

--

Apache Tomcat/4.1.24

Here is the code: Pdb_Add.jsp

<%@ include file="authenticate.jsp" %>

<%@ page import="java.sql.*" %>

<%

String connectionURL ="jdbc:mysql://localhost:3306/xxxxx?user=****&password=***";

Connection connection =null;

Statement statement =null;

ResultSet rs =null;

%>

<html>

<head>

<title>Project Portal Confirm New Project</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="style.css" rel="stylesheet" type="text/css">

<link type="text/css" rel="stylesheet" href="xtree.css">

<script src="xtree.js"></script>

</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">

<table bgcolor="#ffffff" width="761" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td height="337" valign="top">

<table width="761" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="11" valign="top"><IMG height=1 src="images/spacer.gif" width=1></td></tr>

<tr>

<td height="291" valign="top">

<table width="761" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="10"><IMG height=1 src="images/spacer.gif" width=1></td>

<td width="399" valign="top">

<table width="399" border="0" cellspacing="0" cellpadding="0">

<TBODY>

<tr><!--IMAGE SQUARE ONE: TOP -->

<td height="300" background="images/BB7250.jpg"><IMG height=1 src="images/spacer.gif" width="100%"></td>

</tr>

<tr>

<td height="0" valign="top">

<table width="300" height="200" border="0" cellpadding="0" cellspacing="0">

</tr>

</table>

</td>

</tr>

<tr></tr>

</table>

</td>

<td width="340" valign="top">

<table width="340" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="91" valign="top">

<table width="340" height="88" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="3"><IMG height=1 src="images/spacer.gif" width=1></td>

<td width="167" valign="top" background="images/S1.gif">

<table width="167" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="80"> </td>

<td width="86" valign="top" class="text2" style="PADDING-TOP: 24px"></td>

</tr>

</table>

</td>

<td width="3"><IMG height=1 src="images/spacer.gif" width=1></td>

<td width="167" valign="top" background="images/V.gif">

<table width="167" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="70"> </td>

<td width="95" valign="top" class="text2" style="PADDING-TOP: 23px"></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td height="88" valign="top">

<table width="340" height="88" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="3"><IMG height=50 src="images/spacer.gif" width=1></td>

<td width="77" valign="top" background="images/and.gif">

<table width="167" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="80"> </td>

<td width="86" valign="top" class="text2" style="PADDING-TOP: 21px"></td>

</tr>

</table>

</td>

<td width="3"><IMG height=1 src="images/spacer.gif" width=1></td>

<td width="167" valign="top" background="images/V.gif">

<table width="167" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="77"> </td>

<td width="90" valign="top" class="text2" style="PADDING-TOP: 21px"></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td valign="top" style="PADDING-LEFT: 4px">

<table width="336" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="300" height="4" valign="top" background="images/spacer.gif">

</td>

</tr>

<tr>

<td width="300" height="116" valign="top" background="images/portalspiral.jpg">

</td>

</tr>

</table>

</td>

</tr>

</table></td>

<td><IMG height=1 src="images/spac" width=1></td>

</tr>

</table></td>

</tr>

<tr>

<td valign="top">

<table width="761" height="35" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="10" valign="top"> </td>

<td width="517" valign="top">

<table width="517" border="0" cellspacing="0" cellpadding="0">

<tr>

<td valign="top">

<table width="517" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="3" bgcolor="#000000">

<IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td valign="top">

<table width="250" border="0" cellspacing="0" cellpadding="1">

<tr>

<td width="75" valign="top">

<A href="PIndex.html"><IMG height=31 src="images/but2.gif" width=99 border=0></A></td>

<td width="80" valign="top" style="PADDING-RIGHT: 1px">

<A href="ProjectPortal_Add.html"><IMG height=31 src="images/but3.gif" width=104 border=0></A></td>

<td width="100" valign="top" style="PADDING-RIGHT: 6px">

<A href="index-2.html"><IMG height=31 src="images/but4.gif" width=104 border=0></A></td>

<td width="100" valign="top">

<A href="PDir.html"><IMG id=IMG1 height=31 src="images/but5.gif" width=134 border=0 ></A></td>

<td width="75" valign="top">

<A href="index-4.html"><IMG height=31 src="images/but6.gif" width=99 border=0></A></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td height="1" bgcolor="#e3e3e3">

<IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

</table></td>

<td width="150" valign="top">

<table width="150" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="3" bgcolor="#000000"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td height="1"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td height="31" valign="top">

<table width="150" height="31" border="0" cellpadding="0" cellspacing="0" background="images/spacer.gif" bgcolor="#ffffff">

<tr>

<td width="80" valign="top" style="PADDING-TOP: 7px"><IMG height=25 src="images/spacer.gif" width=56></td>

<td width="100" valign="top" style="PADDING-RIGHT: 4px; PADDING-TOP: 8px"

><input name="textfield" class="form" ></td>

<td valign="top" style="PADDING-TOP: 5px">

<A href="#"><IMG height=21 src="images/minis.gif" width=20 border=0></A></td>

</tr>

</table></td>

</tr><tr>

<td height="1" bgcolor="#e3e3e3"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

</table></td>

<td><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

</table></td>

</tr>

</table></TD></TR>

<tr>

<td height="362" valign="top">

<table width="761" height="362" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="218" valign="top">

<table width="218" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12" valign="top">

<IMG height=1 src="images/spacer.gif" width=1></td>

<td width="218" valign="top">

<table width="218" border="0" cellspacing="0" cellpadding="0" style="WIDTH: 218px; HEIGHT: 472px">

<tr>

<td width="12" valign="top"><IMG height=1 src="images/spacer.gif" width=1></td>

<td width="205" valign="top">

<IMG alt="" src="file://C:\Documents and Settings\atavakkolie\Desktop\Project Portal\images\PDir.gif"

id=IMG1

>

<DIV id=DIV1

style="PADDING-RIGHT: 5px; PADDING-LEFT: 15px; LEFT: 5px; PADDING-BOTTOM: 5px; OVERFLOW: auto; WIDTH: 200px; PADDING-TOP: 0px; POSITION: relative; TOP: 10px; HEIGHT: 100%"><!-- js file containing the tree content, editthis file to alter the menu,

the menu will be inserted wherethis tag is located in the document -->

<SCRIPT src="tree.js"></SCRIPT>

</DIV></td>

<td>

</td>

</tr>

</table></td>

</tr>

</table></td>

<td width="1" valign="top"><table width="1" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="2"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td height="920" bgcolor="#e3e3e3"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td height="2"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

</table></td>

<td width="542" valign="top">

<table width="542" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="530" valign="top">

<table width="530" border="0" cellspacing="0" cellpadding="0">

<tr>

<td valign="top">

<table width="530" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="41" valign="top" style="PADDING-TOP: 6px"><IMG id=IMG1

style="LEFT: 409px; TOP: 552px" height

=44 src="images/Addp.gif" width=207></td>

</tr><!-- Form starts here-->

<tr>

<td valign="top"

>

<table width="530" border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="text" style="PADDING-LEFT: 18px">

<!-- ***** START EDITABLE REGION -->

<%

Class.forName("com.mysql.jdbc.Driver").newInstance();

connection = DriverManager.getConnection(connectionURL,"","");

statement = connection.createStatement();

String name = request.getParameter("name");

String email = request.getParameter("email");

String pname = request.getParameter("pname");

String pmanager = request.getParameter("pmanager");

String svvpp = request.getParameter("svvpp");

String pdphase = request.getParameter("pdphase");

String pdptarget = request.getParameter("pdptarget");

String etimecode = request.getParameter("etimecode");

if( request.getParameter("name").equals("") || request.getParameter("email").equals("") || request.getParameter("pname").equals("")

|| request.getParameter("pmanager").equals("") || request.getParameter("svvpp").equals("") || request.getParameter("pdphase").equals("")

|| request.getParameter("pdptarget").equals("") || request.getParameter("etimecode").equals(""))

{

out.println("<b>ERROR:</b> All fields were not filled out. Please go back and try again.");

}

else

{

try

{

int retval = statement.executeUpdate("INSERT INTO project VALUES('" + name +"," + email +"," + pmanager +"," + svvpp +"," + pname +"," + pdphase +"," + pdptarget +"," + etimecode +"')");

out.println("<b>SUCCESS:</b> Your changes have been successfully written to the database.");

session.putValue("entry","<b>" + pname +" (Add Project)</b>: added user with email: " + email +", pmanager: " + pmanager +", svvpp: " + svvpp +", pdphase: " + pdphase +", pdptarget: " + pdptarget +", etimecode: " + etimecode);

%>

<jsp:include page="log.jsp" />

</jsp:include>

<%

}

catch (SQLException e)

{

if (e.getErrorCode() == 1062)

{ out.println("

<b>ERROR:</b> There is something wrong. Please go back and try again.

");

}

else

{

out.println("

<b>ERROR:</b> Unexpected error <b>" + e.getErrorCode() +"</b> occurred.

");

out.println("

" + e +"

");

}

}

}

%>

</td>

</tr>

</table>

</td>

</tr>

</table></td>

</tr>

</table></td>

<td width="12"> </td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td height="71" valign="top"><table width="761" border="0" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table width="761" height="25" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="13">

<IMG height=1 src="images/spacer.gif" width=1></td>

<td width="738" align="middle" background="images/back_4.gif" bgcolor="#808080" class="links">

<A class=links href="index.html"><strong> Home page</strong></A>

| <A class=links href="index-1.html"><strong>About us</strong></A>

| <A class=links href="index-2.html"><strong>Search</strong></A>

| <A class=links href="index-3.html"><strong> Contact</strong></A>

| <A class=links href="#"><strong>SV&V Links</strong></A>

| <A class=links href="index-4.html"><strong>Help</strong></A>

| <A class=links href="#"><strong>Site map</strong></A>

| <A class=links href="#"><strong>Links</strong></A></td>

<td width="10">

<IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

</table></td>

</tr>

<tr>

<td height="18" valign="top"><IMG height=1 src="images/spacer.gif" width=1></td>

</tr>

<tr>

<td align="middle" valign="top" class="copy">

<A class=copy style="TEXT-DECORATION: none" href="index-5.html" >Copyright 2004-2005 ?SV&V Project Portal. All rights reserved.</A></td>

</tr>

</table></td>

</tr></TBODY></TABLE></TABLE>

</body>

<script>

function addNode(){

if (tree.getSelected()){

tree.getSelected().add(new WebFXTreeItem('New'));

}

}

function addNodes(){

if (tree.getSelected()){

var foo = tree.getSelected().add(new WebFXTreeItem('New'));

var bar = foo.add(new WebFXTreeItem('Sub 1'));

}

}

function delNode(){

if (tree.getSelected()){

tree.getSelected().remove();

}

}

</script>

</html>

[34525 byte] By [Crackberrya] at [2007-9-23]
# 1

request.getParameter("name").equals("")

You are using this in your 'if' statement. But if a parameter by the name "name" is not found, it would return a null reference and calling equals() would call a NullPointerException.

I observed that you are already assigning those parameters to Strings. You should add null checking for each of them. :)

MadDonnaa at 2007-7-10 > top of java,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Besides, this should be asked in the JSP forum. :)
MadDonnaa at 2007-7-10 > top of java,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Use the conditin check in this wayif( "".equals(name) || "".equals(email) || ...... )
enigma_y2k1a at 2007-7-10 > top of java,Enterprise & Remote Computing,Enterprise Technologies...