我电脑XP系统
安装的JBUILDER2006 自带JDK1.5和TOMCAT5
以前运行JAVA程序正常JDK没问题
现在运行servlet程序 总是出HTTP 500错误 抛异常
TOMCAT的路径应该是集成好的啊
把代码贴出来 希望各位帮忙
servlet代码
package demo;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Checkusers extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String n=request.getParameter("username");
String name=new String(n.getBytes());
String p=request.getParameter("password");
String pass=new String(p.getBytes());
out.println("<html>");
out.println("<head><title>Checkusers</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("用户名:"+name+"<br>密码:"+pass);
out.println("</body>");
out.println("</html>");
out.close();
}
//Clean up resources
public void destroy() {
}
}
HTML代码
<html>
<head>servlet测试
</head>
<body>
<form method="POST" action="Checkusers">
<table>
<tr>
<td colspan="2" align="center">用户登陆</td>
</tr>
<tr>
<td>用户名</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码</td>
<td><input type="text" name="password"></td>
</tr>
<tr>
<td colspan="=2" align="center"><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html>
错误提示:
D:\安装程序\Jbuilder\jdk1.5\bin\javaw -classpath "D:\安装程序\Jbuilder\thirdparty\jakarta-tomcat-5.5.9\bin\bootstrap.jar;D:\安装程序\Jbuilder\jdk1.5\lib\tools.jar" "-Dcatalina.home=D:/安装程序/Jbuilder/thirdparty/jakarta-tomcat-5.5.9" org.apache.catalina.startup.Bootstrap -config C:\demo\Tomcat\conf\server8083.xml start
2007-3-21 20:15:48 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8083
2007-3-21 20:15:48 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 6046 ms
2007-3-21 20:15:48 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2007-3-21 20:15:49 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.9
2007-3-21 20:15:49 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2007-3-21 20:15:52 org.apache.catalina.realm.JAASRealm setContainer
信息: Set JAAS app name Catalina
2007-3-21 20:15:53 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8083
2007-3-21 20:15:53 org.apache.catalina.startup.Catalina start
信息: Server startup in 5016 ms
2007-3-21 20:15:55 org.apache.catalina.core.ApplicationContext log
信息: Marking servlet checkusers as unavailable
2007-3-21 20:15:55 org.apache.catalina.core.ApplicationContext log
严重: Error loading WebappClassLoader
delegate: false
repositories:
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1a082e2
demo.Checkusers
java.lang.ClassNotFoundException: demo.Checkusers
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1027)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:750)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
2007-3-21 20:15:55 org.apache.catalina.core.StandardWrapperValve invoke
严重: Allocate exception for servlet checkusers
java.lang.ClassNotFoundException: demo.Checkusers
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1027)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:750)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)