Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error

Status
Not open for further replies.

sonun

IS-IT--Management
Dec 26, 2001
384
US
Ok, the subject may not sound jsp like, but thats what I get when I am trying out a sample jsppage. I just bought the copy of "JSP examples and best practices" and was trying out the the first example from the first chapter.
I created the tables, got the mysql driver and out it under lib. Copied the code from the example, restarted tomcat and then when I try to view the file, I get the following error. Not sure what the error is,
type Exception report
message Internal Server Error

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

exception

java.lang.NullPointerException
at org.apache.jsp.customers$jsp._jspService(customers$jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
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:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)

--------------------------------------------------------------------------------

The source code is avialable on line, but I post it here anyways. The only guess I can take is if mysql is really running on port 3306.

<!-- JSP Directives -->
<%@ page import=&quot;java.sql.*&quot; %>

<html>
<head>
<title>Insurance Quoting System</title>
</head>

<body>

<basefont face=&quot;Arial&quot;>

<!-- JSP Declarations -->
<%! ResultSet rs = null;%>

<!-- JSP Scriptlet -->
<%
try {
Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;);
Connection db = DriverManager.getConnection(
&quot;jdbc:mysql://localhost:3306/quoting&quot;);
Statement s = db.createStatement();
rs = s.executeQuery(&quot;select * from customer&quot;);
}
catch (Exception e) {
// For now, just report the error to the system log
System.out.println(e.toString());
}
%>

<!-- Template text -->
<table width=&quot;550&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td bgcolor=&quot;#006633&quot;>
<div align=&quot;center&quot;>
<font size=&quot;6&quot; color=&quot;#FFFFFF&quot;><b>Insurance Quoting System</b></font>
</div>
</td>
</tr>
<tr>
<td>
<p> </p>
<p> </p>
<p align=&quot;center&quot;><b>Customers</b></p>

<table width=&quot;290&quot; border=&quot;0&quot; align=&quot;center&quot;>
<%
try {
while (rs.next()) {
%>

<!-- JSP Expressions used within template text -->
<tr>
<td width=&quot;20&quot;><%= rs.getInt(1) %></td>
<td width=&quot;70&quot;><%= rs.getString(2) %></td>
<td width=&quot;70&quot;><%= rs.getString(3) %></td>
<td width=&quot;40&quot;>
<a href=&quot;custMaint.jsp?id=<%= rs.getString(1) %>&action=edit&quot;>
edit
</a>
</td>
<td width=&quot;40&quot;>
<a href=&quot;custMaint.jsp?id=<%= rs.getString(1) %>&action=delete&quot;>
delete
</a>
</td>
<td width=&quot;40&quot;>
<a href=&quot;custMaint.jsp?id=<%= rs.getString(1) %>&action=newQuote&quot;>
new quote
</a>
</td>
</tr>

<%
}
}
catch (SQLException e) {
// For now, just report the error to the system log
System.out.println(e.toString());
}
%>
</table>
</td>
</tr>
<tr>
<td>
<p> </p>
<p align=&quot;center&quot;><a href=&quot;custMaint.jsp?action=add&quot;>New Customer</a></p>
</td>
</tr>
</table>
</body>
</html>


Also,
whenever I cannot use mysql without suppying a valid username and password from the terminal. I see that this code doesnt supply the username and password. Could that be a problem.
Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top