An hour and a half of confusion for one partial line of code......Gotta love programming
Main Topics
Browse All TopicsOk. I am running Tomcat and I have a jsp page calling a servlet. When I submit the form contained in the jsp page, I get the following error:
The server encountered an internal error () that prevented it from fulfilling this request.
javax.servlet.ServletExcep
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.coyote.tomcat4.
at org.apache.coyote.http11.H
at org.apache.coyote.http11.H
at org.apache.tomcat.util.net
at org.apache.tomcat.util.thr
at java.lang.Thread.run(Threa
root cause
java.lang.ClassNotFoundExc
at org.apache.catalina.loader
at org.apache.catalina.loader
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.coyote.tomcat4.
at org.apache.coyote.http11.H
at org.apache.coyote.http11.H
at org.apache.tomcat.util.net
at org.apache.tomcat.util.thr
at java.lang.Thread.run(Threa
Here is the important part of the jsp file:
...
<BR><FORM ACTION="http://myDomain.co
<TABLE>
<TR>
<TD>StudentID:</TD>
<TD><INPUT TYPE=TEXT NAME=StudentID></TD>
</TR>
<TR>
<TD>Password:</TD>
<TD><INPUT TYPE=PASSWORD NAME=Password></TD>
</TR>
<TR>
<TD ALIGN=RIGHT COLSPAN=2>
<INPUT TYPE=SUBMIT VALUE=Login></TD>
...
and here is the servlet:
public void doPost(HttpServletRequest request,HttpServletRespons
{
HttpSession session = request.getSession(true); //Create a session if one doesn't exist
session.setAttribute("logg
String StudentID = request.getParameter("Stud
String Password = request.getParameter("Pass
String FirstName;
String LastName;
String Course;
String Semester;
String trans = "0";
session.setAttribute("tran
try
{
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("j
DataSource ds = (DataSource)envCtx.lookup(
Connection con = ds.getConnection();
Statement s = con.createStatement();
String sql = "SELECT * FROM Students WHERE StudentID='" + StudentID + "' AND Password='" + Password + "'";
ResultSet rs = s.executeQuery(sql);
if (rs.next())
{
session.setAttribute("logg
FirstName = rs.getString("FirstName");
LastName = rs.getString("LastName");
Course = rs.getString("Course");
Semester = rs.getString("Semester");
Student myStudent = new Student(StudentID,LastName
session.setAttribute("mySt
}
rs.close();
s.close();
con.close();
}
catch(Exception ex)
{
System.out.println(ex.toSt
}
if((String) session.getAttribute("logg
{
System.out.println("The login was executed flawlessly");
response.sendRedirect("htt
}
else
{
String error = "error";
session.setAttribute("erro
response.sendRedirect("htt
}
}
Any help would be appreciated.... WITH POINTS ;)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I got this error.
Any feedback on this?
Thanks
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperEx
org.apache.jasper.servlet.
org.apache.jasper.servlet.
org.apache.jasper.servlet.
javax.servlet.http.HttpSer
root cause
java.lang.NullPointerExcep
org.apache.struts.util.Req
org.apache.struts.util.Req
org.apache.struts.util.Req
org.apache.struts.taglib.l
org.apache.jsp.index_jsp._
org.apache.jsp.index_jsp._
org.apache.jasper.runtime.
javax.servlet.http.HttpSer
org.apache.jasper.servlet.
org.apache.jasper.servlet.
org.apache.jasper.servlet.
javax.servlet.http.HttpSer
Clement
Business Accounts
Answer for Membership
by: jerkface2098Posted on 2003-01-31 at 21:07:20ID: 7857734
It looks like your links are set up properly. However, I would check your web.xml file to make sure that you have the proper <servlet-class> entered.
The error you are getting is saying that it can't find the class. Check web.xml