html跳转连接servlet时出现500错误,Error instantiating servlet class

图片说明

在eclipse的console上面显示的是下面的错误:

严重: Allocate exception for servlet [Give Horoscope Servlet]
java.lang.ClassNotFoundException: Lab30.HoroscopeServlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:542)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:523)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1032)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:761)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

2个回答

这是我的文件目录
图片说明

web.xml文件是这样写的:
图片说明

web.xml把第八行去掉Lab30.,注意是'Lab30.'。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
servlet出现500错误 提示Error instantiating servlet class …
HandleLogin.javarn[code=java]package myservlet.control;rnimport mybean.data.*;rnimport java.sql.*;rnimport java.io.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnpublic class HandleLogin extends HttpServletrn public void init(ServletConfig config) throws ServletExceptionrn super.init(config);rn tryrn Class.forName("com.mysql.jdbc.Driver");rn rn catch(Exception e)rn rn rn public String handleString(String s)rn tryrn byte bb[] = s.getBytes("iso-8859-1");rn s = new String(bb);rn rn catch(Exception ee)rn rn return s;rn rn public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptionrn Connection con;rn Statement sql;rn Login loginBean = null;rn String backNews = "";rn HttpSession session = request.getSession(true);rn tryrn loginBean = (Login)session.getAttribute("login");rn if(loginBean == null)rn loginBean = new Login();rn session.setAttribute("login", loginBean);rn rn rn catch(Exception ee)rn loginBean = new Login();rn session.setAttribute("login", loginBean);rn rn String logname = request.getParameter("logname").trim();rn String password = request.getParameter("password").trim();rn boolean ok = loginBean.getSuccess();rn logname = handleString(logname);rn password = handleString(password);rn rn boolean boo = (logname.length() > 0) && (password.length() > 0);rn tryrn con = DriverManager.getConnection("jdbc:mysql://localhost:3306/itmanager?user=root&password=123456");rn String condition = "SELECT * FROM member WHERE logname = '" + logname + "' AND password = '" + password +"'";rn sql = con.createStatement();rn if(boo)rn ResultSet rs = sql.executeQuery(condition);rn boolean m = rs.next();rn if(m == true)rn backNews = "登录成功";rn loginBean.setBackNews(backNews);rn loginBean.setSuccess(true);rn loginBean.setLogname(logname);rn loginBean.setName(rs.getString(2));rn RequestDispatcher dispatcher = request.getRequestDispatcher("mainPage.jsp");rn dispatcher.forward(request, response);rn con.close();rn rn elsern backNews = "您输入的用户名不存在,或密码不匹配";rn loginBean.setBackNews(backNews);rn loginBean.setSuccess(false);rn loginBean.setLogname(logname);rn loginBean.setPassword(password);rn RequestDispatcher dispatcher = request.getRequestDispatcher("showLoginResult.jsp");rn dispatcher.forward(request, response);rn con.close();rn rn rn elsern backNews = "您输入的用户名不存在,或密码不匹配";rn loginBean.setBackNews(backNews);rn loginBean.setSuccess(false);rn loginBean.setLogname(logname);rn loginBean.setPassword(password);rn RequestDispatcher dispatcher = request.getRequestDispatcher("showLoginResult.jsp");rn dispatcher.forward(request, response);rn con.close();rn rn rn catch(SQLException exp)rn backNews = "" + exp;rn loginBean.setBackNews(backNews);rn loginBean.setSuccess(false);rn RequestDispatcher dispatcher = request.getRequestDispatcher("showLoginResult.jsp");rn dispatcher.forward(request, response);rn rn rn rn public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOExceptionrn doPost(request,response);rn rn[/code]rnrnLogin.javarn[code=java]package mybean.data;rnpublic class Login rn String logname, password, name, backNews = "";rn boolean success = false;rn public void setLogname(String lgn)rn logname = lgn;rn rn public String getLogname()rn return logname;rn rn public void setName(String n)rn name = n;rn rn public String getName()rn return name;rn rn public void setPassword(String pw)rn password = pw;rn rn public String getPassword()rn return password;rn rn public void setBackNews(String s)rn backNews = s;rn rn public String getBackNews()rn return backNews;rn rn public void setSuccess(boolean b)rn success = b;rn rn public boolean getSuccess()rn return success;rn rnrn[/code]rnrnlogin.jsprn[code=html]<%@ page language="java" contentType="text/html; charset=gb2312"rn pageEncoding="gb2312"%>rnrnrnrn rn 登录rnrnrn rn rn 登录用户名:rn 登录密码:rn rn rnrnrn[/code]rnrn[code=html]rnrn Itrn rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rn rn loginrn myservlet.control.HandleLoginrn rn rn loginrn /helpLoginrn rn[/code]rnrn错误:rnHTTP Status 500 - Error instantiating servlet class myservlet.control.HandleLoginrnrnrntype Exception reportrnrnmessage Error instantiating servlet class myservlet.control.HandleLoginrnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexceptionrnjavax.servlet.ServletException: Error instantiating servlet class myservlet.control.HandleLoginrn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)rn org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)rn org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)rn org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1452)rn org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Unknown Source)rnrnrnroot causernjava.lang.ClassNotFoundException: myservlet.control.HandleLoginrn org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)rn org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109)rn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)rn org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)rn org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)rn org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1452)rn org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Unknown Source)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/9.0.0.M10 logs.rnrnrnApache Tomcat/9.0.0.M10rnrn感谢!!!
Error instantiating servlet class org.apache.struts.action.ActionServlet是什么错误
StandardContext[/document]: Servlet /document threw load() exception: javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrnjavax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:895)rnrn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)rn
servlet部署问题,Error instantiating servlet class com.example.servlets.HelloServlet
我在eclipse中把代码写好后,再往tomcat上部署,路径是E:\Download\apache-tomcat-7.0.57-windows-x64\apache-tomcat-7.0.57\webapps\test,rn然后我在WEB-INF中增加了一个web.xml,rn内容是rnrnrn rn HelloServletrn com.example.servlets.HelloServletrn rnrn rn HelloServletrn /HelloServletrn rnrnrnrnWEB-INF\classes\com\example\servlets是从eclipse中复制过来的,里面有HelloServlet.class,rn然后去配置了E:\Download\apache-tomcat-7.0.57-windows-x64\apache-tomcat-7.0.57\conf下的server.xml文件,rn在host标签里面增加了一行rnrnrn然后重启tomcat,调用就报错了,搞不懂是什么原因,我哪里配置错了吗?rn求教!rnrn错误内容:rntype Exception reportrnrnmessage Error instantiating servlet class com.example.servlets.HelloServletrnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexceptionrnrnjavax.servlet.ServletException: Error instantiating servlet class com.example.servlets.HelloServletrn
servlet入门示例出错,提示"Error instantiating servlet class"
大家好!我初学java的web开发,有些很基础的问题弄不通,还请大家指点。rn我正在学servlet,在做一个入门示例时,就是访问不了正常的页面。不知道应该怎么解决这个问题。具体如下:rn我是按这个页面:[url=http://blog.csdn.net/wangdingqiaoit/article/details/7674367]http://blog.csdn.net/wangdingqiaoit/article/details/7674367[/url] 来搭建环境了。我用的是myeclipse10, tomcat 7, jdk1.7。访问http://localhost:8080/FirstServlet/index.jsp文件没有问题,但访问http://localhost:8080/FirstServlet/servlet/Test这个页面时,提示:HTTP Status 500 - Error instantiating servlet class test.Testrnrn具体错误为:rntype Exception reportrnmessage Error instantiating servlet class test.Testrndescription The server encountered an internal error that prevented it from fulfilling this request.rnexception rnjavax.servlet.ServletException: Error instantiating servlet class test.Testrnorg.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rnorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)rnorg.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)rnorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:243rnorg.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:241 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)rnjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:744)rnrnroot cause rnjava.lang.InstantiationException sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)rnjava.lang.reflect.Constructor.newInstance(Constructor.java:526)rnjava.lang.Class.newInstance(Class.java:374) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)rnorg.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)rnorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)rnorg.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430rnorg.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419rnjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)rnjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)rnjava.lang.Thread.run(Thread.java:744)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.rnrn
HTML提交servlet时报错HTTP Status 500 - Error instantiating servlet class
最近在学习《Head first servlets and jsp》,里面80页有个例子。rnrnrnrn我的workspace是这样的rnrn[b][img=https://img-bbs.csdn.net/upload/201701/07/1483798931_333470.png][/img][/b]rnrnform.htmlrnrn[code=html]rnrnrnrn rn 啤酒顾问rnrnrn Beer Selection Pagern rn Select beer characteristics rn Color:rn rn lightrn amberrn brownrn darkrn rn rn rn rn rnrnrnrn[/code]rnrnweb.xmlrnrn[code=html]rnrnrnrn rn Ch3 Beerrn com.example.web.BeerSelectrn rn rn rn Ch3 Beerrn /SelectBeer.dorn rnrnrn[/code]rnrnBeerSelect.javarnrn[code=java]rnpackage com.example.web;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnrn@SuppressWarnings("serial")rnpublic class BeerSelect extends HttpServletrnrn public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletExceptionrn rn response.setContentType("text/html");rn PrintWriter out = response.getWriter();rn rn out.println("Beer Selection Advice ");rn String c = request.getParameter("color");rn out.println(" Got beer color " + c);rn rnrnrn[/code]rnrn提交表单form.html后就报错HTTP Status 500 - Error instantiating servlet class com.example.web.BeerSelectrnclass文件也没有生成,是哪里错了呀。
Error instantiating servlet class org.apache.struts.action.ActionServlet这个错误怎么回事???
Error instantiating servlet class org.apache.struts.action.ActionServletrn采用struts技术,用的JB2005,jsp页面中frameset标签以及标签中的width和heigh、border等标签都显示为Unknown attribute "border". Unable to find attribute information.
Error instantiating servlet class org.apache.struts.action.ActionServlet是哪儿的问题?
我的Tomcat启动时报错,如下:rn2008-06-20 10:19:24 StandardContext[/ais]Marking servlet action as unavailablern2008-06-20 10:19:24 StandardContext[/ais]Servlet /ais threw load() exceptionrnjavax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:996)rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)rn at org.apache.catalina.core.StandardService.start(StandardService.java:480)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:556)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:585)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)rn----- Root Cause -----rnjava.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converterrn at java.lang.Class.getDeclaredConstructors0(Native Method)rn at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)rn at java.lang.Class.getConstructor0(Class.java:2640)rn at java.lang.Class.newInstance0(Class.java:321)rn at java.lang.Class.newInstance(Class.java:303)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:987)rn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)rn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)rn at org.apache.catalina.core.StandardService.start(StandardService.java:480)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:556)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:585)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)rnrn请教各位,问题出在哪儿?rn
Error instantiating servlet class 这个问题好长时间都没有解决。
各位帅哥:给看一下吧。谢谢了。rnexception rnrnjavax.servlet.ServletException: Error instantiating servlet class com.wy.webiter.PhotoSerlvetrn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)rn org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:866)rn org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:716)rn org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1498)rn java.lang.Thread.run(Unknown Source)rnrnrnroot cause rnrnjava.lang.NoClassDefFoundError: com/jspsmart/upload/Filesrn java.lang.Class.getDeclaredConstructors0(Native Method)rn java.lang.Class.privateGetDeclaredConstructors(Unknown Source)rn java.lang.Class.getConstructor0(Unknown Source)rn java.lang.Class.newInstance0(Unknown Source)rn java.lang.Class.newInstance(Unknown Source)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)rn org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:866)rn org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:716)rn org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1498)rn java.lang.Thread.run(Unknown Source)rnrn
struts运行时报出javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet!急!
在运行struts是,抱错:rnServlet /root threw load() exception: javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrnjavax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:895)rnrn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)rnrn这是什么原因阿?怎么解决?rn环境:jb9,struts1.1
关于HTTP Status 500 - Error instantiating servlet class 的问题。。
本来用的好好的。。按照师兄的格式改了代码之后就出错了。。rn错误信息:rntype Exception reportrnrnmessage Error instantiating servlet class com.jim.mystore.servlet.LoginCheckServletrnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexception rnjavax.servlet.ServletException: Error instantiating servlet class com.jim.mystore.servlet.LoginCheckServletrn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)rn org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)rn org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)rn org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)rn java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Thread.java:745)rnrnrnrnroot cause rnjava.lang.NullPointerExceptionrn com.jim.mystore.dao.ClientDao.(ClientDao.java:18)rn com.jim.mystore.service.ClientService.(ClientService.java:23)rn com.jim.mystore.servlet.LoginCheckServlet.(LoginCheckServlet.java:23)rn sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn java.lang.reflect.Constructor.newInstance(Constructor.java:422)rn java.lang.Class.newInstance(Class.java:442)rn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)rn org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)rn org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)rn org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)rn java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Thread.java:745)rnrnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/7.0.61 logs.rnrnClientDao.javarn[code=java]package com.jim.mystore.dao;rnrnimport java.sql.*;rnrnrnimport com.jim.mystore.dbc.DatabaseConnection;rnimport com.jim.mystore.model.Client;rnrnrnpublic class ClientDao rn rn private DatabaseConnection dbc = null;rn private Connection conn = null;rn private PreparedStatement pstmt = null;rn rn public ClientDao()rn rn conn = dbc.getConnection();rn rn rn rn public boolean doInsert(Client cli)throws Exceptionrn rn boolean flag = false;rn tryrn rn String sql = "insert into client (name,password,phonenumber,emailaddress,regdate) values(?,?,?,?,NOW())";rn rn this.pstmt = this.conn.prepareStatement(sql);rn rn this.pstmt.setString(1,cli.getName());rn this.pstmt.setString(2,cli.getPassword());rn this.pstmt.setString(3,cli.getPhonenumber());rn this.pstmt.setString(4,cli.getEmailAddres());rn rn if(this.pstmt.executeUpdate()>0)rn rn flag = true;rn rn rn catch (SQLException e)rn rn e.printStackTrace();rn rn finally rn tryrn this.pstmt.close();rn this.conn.close();rn catch(SQLException e )rn rn e.printStackTrace();rn rn rn rn rn rn rn return flag;rn rn rn rn public ResultSet findAll()rn rn ResultSet rs = null;rn rn tryrn rn String sql = "select name from client order by name asc";rn this.pstmt = this.conn.prepareStatement(sql);rn rs = this.pstmt.executeQuery();rn rn catch(SQLException e)rn rn e.printStackTrace();rn rn finallyrn tryrn rn this.pstmt.close();rn this.conn.close();rn rn catch(SQLException e)rn rn e.printStackTrace();rn rn rn rn return rs;rn rn rn public ResultSet findOne(String cn)rn rn ResultSet rs = null;rnrn tryrn rn String sql = "select * from client where name=?";rn this.pstmt = this.conn.prepareStatement(sql);rn this.pstmt.setString(1, cn);rn rs = this.pstmt.executeQuery();rn rn catch(SQLException e)rn rn e.printStackTrace();rn rn finallyrn tryrn rn this.pstmt.close();rn this.conn.close();rn rn catch(SQLException e)rn rn e.printStackTrace();rn rn rn return rs;rn rn rnrn[/code]rnrnDatabaseConnection.javarn[code=java]package com.jim.mystore.dbc;rnrnimport java.sql.Connection;rnimport java.sql.DriverManager;rnrnpublic class DatabaseConnection rn rn private Connection conn = null;rnrn public DatabaseConnection()rn tryrn rn Class.forName("com.mysql.jdbc.Driver").newInstance();rn conn = DriverManager.getConnection("jdbc:mysql://localhost/mystore","root", "jim1");rn catch(Exception e)rn rn e.printStackTrace();rn rn rn rn rn public Connection getConnection()rn rn return this.conn;rn rn rn rn public void close()rn rn if(this.conn!=null)rn rn tryrn rn this.conn.close();rn rn catch(Exception e)rn rn e.printStackTrace();rn rn rn rn rn rn rnrn[/code]rnrnClientService.javarn[code=java]rnpackage com.jim.mystore.service;rnrnrnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.util.ArrayList;rnimport java.util.List;rnrnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport com.jim.mystore.model.Client;rnimport com.jim.mystore.dao.ClientDao;rnrnrnpublic class ClientService rn rnrn private ClientDao cd = null;rn rn public ClientService()rn this.cd = new ClientDao();rn rn rn public boolean doInsert(HttpServletRequest request, HttpServletResponse response)throws Exceptionrn rn Client cli = new Client();rn tryrn rn cli.setName(request.getParameter("name"));rn cli.setPassword(request.getParameter("password"));rn cli.setEmailaddress(request.getParameter("emailaddress"));rn cli.setPhonenumber(request.getParameter("phonenumber"));rn rn catch(Exception e)rn rn e.printStackTrace();rn rn return cd.doInsert(cli);rn rn rn public List findAll()throws Exceptionrn rnrn List all = new ArrayList();rn ResultSet rs = null;rn rs = cd.findAll();rn Client cli = null;rn tryrn while(rs.next())rn cli = new Client();rn cli.setName(rs.getString(1));rn all.add(cli);rn rn rs.close();rn catch(SQLException e)rn rn e.printStackTrace();rn rn rn return all;rnrn rnrn public Client findOne(String cn)throws Exceptionrn rn Client cli = null;rn ResultSet rs = null;rn rn rs = cd.findOne(cn);rn rn if(rs.next())rn rn cli = new Client();rn cli.setId(rs.getInt(1));rn cli.setName(rs.getString(2));rn cli.setPassword(rs.getString(3));rn cli.setPhonenumber(rs.getString(4));rn cli.setEmailaddress(rs.getString(5));rn cli.setAddress(rs.getString(6));rn cli.setBalance(rs.getDouble(7));rn cli.setRegdate(rs.getString(8));rn rn rn rs.close();rn rn return cli;rn rn rn rnrnrn[/code]rnrnLoginCheckServlet.javarn[code=java]package com.jim.mystore.servlet;rnrnimport java.io.IOException;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.annotation.WebServlet;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnimport javax.servlet.http.HttpSession;rnrnimport com.jim.mystore.model.Client;rnimport com.jim.mystore.service.ClientService;rnrn/**rn * Servlet implementation class LoginCheckrn */rn@WebServlet("/Client/LoginCheckServlet")rnpublic class LoginCheckServlet extends HttpServlet rn private static final long serialVersionUID = 1L;rn rn Client cli = null;rn ClientService cs = new ClientService();rn rn public LoginCheckServlet() rn super();rn // TODO Auto-generated constructor stubrn rnrn /**rn * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)rn */rn protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException rn rn String name = request.getParameter("name");rn String pw = request.getParameter("password");rn String pw2 = null;rn String ref = null;rn tryrn this.cli = cs.findOne(name);rn if(cli != null)rn pw2 = cli.getPassword();rn rn if(!pw2.equals(pw))rn rn ref = "用户名不存在或者密码错误!";rn request.setAttribute("ref", ref);rn request.getRequestDispatcher("Login.jsp").forward(request,response);rn rn else rn HttpSession session = request.getSession();rn session.setAttribute("name", name);rn session.setAttribute("password", pw2);rn request.getRequestDispatcher("loginsuccess.jsp").forward(request,response);rn rn else rnrn ref = "此用户不存在!";rn request.setAttribute("ref", ref);rn request.getRequestDispatcher("Login.jsp").forward(request,response);rn rn catch(Exception e)rn e.printStackTrace();rn rn rn rnrn /**rn * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)rn */rn protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException rn this.doGet(request, response);rn rnrn[/code]rn分包情况rn[img=https://img-bbs.csdn.net/upload/201505/23/1432379504_795679.png][/img]rnrn跪求各位大神指教。。。我看了一个下午都找不到错误。。。
servlet 500错误
[img=https://img-bbs.csdn.net/upload/201507/11/1436625787_80154.png][/img]rn用myeclipse做一个简单的servlet的入门小程序,就是改写doGet然后显示一点东西,在web-inf下面的classes文件夹内有一个servlet文件夹,里面有需要的HelloServlet.class文件,web.xml文件配置应该也没有问题,不知道问题出在哪,求指教。rnweb.xml:rn[code=text]rnrn rn rn index.jsprn rn rn rn HelloServletrn servlet.HelloServletrn rn rn HelloServletrn /servlet/HelloServletrn rn[/code]rnrnindex.jsp:rn[code=text]<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>rn<%rnString path = request.getContextPath();rnString basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";rn%>rnrnrnrn rn rn rn My JSP 'index.jsp' starting pagern rn rn rn rn rn rn rn rn rn 第一个Servlet小例子rn rn Get方式请求HelloServletrn rn[/code]rnrnHelloServlet类:rn[code=java]package servlet;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnpublic class HelloServlet extends HttpServlet rnrn @Overridern protected void doGet(HttpServletRequest request,rn HttpServletResponse response) throws ServletException, IOException rn // TODO Auto-generated method stubrn System.out.println("处理Get()请求……");rn PrintWriter out = response.getWriter();rn response.setContentType("text/html;charset=utf-8");rn out.println("Hello Servetl! ");rnrn rnrn @Overridern protected void doPost(HttpServletRequest request,rn HttpServletResponse response) throws ServletException, IOException rn // TODO Auto-generated method stubrnrn rnrnrn[/code]
Servlet 500错误
rnrnHTTP Status 500 - Error instantiating servlet class com.test.Hellornrnrntype Exception reportrnrnmessage Error instantiating servlet class com.test.Hellornrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexceptionrnjavax.servlet.ServletException: Error instantiating servlet class com.test.Hellorn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)rn org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)rn org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)rn org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)rn org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)rn java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Thread.java:745)rnrnrnroot causernjava.lang.ClassNotFoundException: com.test.Hellorn org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)rn org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)rn org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)rn org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)rn org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)rn org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)rn org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)rn java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn java.lang.Thread.run(Thread.java:745)rnrnrn【web.xml里的class也设置对了】rnrnrn TestServletrn rn Hellorn This is the display name of my J2EE componentrn This is the description of my J2EE componentrn com.test.Hellorn rnrn rn Hellorn /servlet/Hellorn rn rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rnrnrn【测试程序】rn[code=java]package com.test;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnpublic class Hello extends HttpServlet rnrn public Hello() rn super();rn rnrn public void doGet(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rnrn PrintWriter out = response.getWriter();rn out.println("Hello");rn rnrn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn rn this.doGet(request, response);rn rnrn[/code]
Servlet Servlet的路径跳转
Servlet的路径跳转 一、JSP跳转到Servlet 1、相对路径,如href="servlet/TestServlet" 如果写成"/servlet/TestServlet"会报错,因为第一个“/”表示的是【服务器根目录】 2、绝对路径,通过内置成员变量path实现,如href="&lt;%=path%&gt;/servlet/TestServ...
又遇到问题了HTML/Servlet/class
创建了一个Dynamic Web Projectrn[b]HelloLet.java:[/b]rnrnpackage aaa;rnrnimport java.util.Calendar;rnimport java.io.PrintWriter;rnimport java.io.IOException;rnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnpublic class HelloLet extends HttpServlet rn private static final long serialVersionUID = 1L;rn rn public HelloLet() rn super();rn rn protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException rn rn rnrn protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException rn request.setCharacterEncoding("GB18030");rn String user = request.getParameter("user");rn user = user.trim();rn if(user.length()<=0)rn user = null;rn System.out.println("user=" + user);rn Calendar now = Calendar.getInstance();rn String w = "欢迎您访问我的网站!";rn rn if(now.get(Calendar.HOUR_OF_DAY)<12)rn w = (user == null)?"早上好!" + w:user + ",早上好!" + w;rn else if(now.get(Calendar.HOUR_OF_DAY)>=18)rn w = (user == null)?"晚上好!" + w:user + ",晚上好!" + w;rn else if(now.get(Calendar.HOUR_OF_DAY)<18)rn w = (user == null)?"下午好!" + w:user + ",下午好!" + w;rn rn response.setContentType("text/html;charest=gb18030");rn rn PrintWriter out = response.getWriter();rn out.println("");rn out.println("");rn out.println(" ");rn out.println("");rn out.println("");rn out.println(w);rn out.println("");rn out.println("");rn out.close();rn rnrnrnrn[b]index-let.html:[/b]rnrnrnrn rn Insert title herernrnrn rn欢迎您,请输入您的名字:rnrnrnrnrnrn我已经把servlet-api.jar复制到WEB-INF下的lib下了rn我把这个项目是发布到tomcat的webapps下的HelloWeb.war,然后用tomcat7.x来Debug As后就会弹出以下内容:rn[color=#FF0000]'Launching HelloWeb on Tomcat 7.x' has encountered a proble.rnErrors occurred during the build.rn Errors running builder 'DeploymentBuilding' on project 'HelloWeb'.rn java.lang.NullPointerExceptionrn[/color]rn怎么解决呢?rn
servlet访问不了 500错误
我写了一servlet访问不了 错误500rn错误代码提示 如果直接访问servlet 错误如下 请问什么原因啊?我web.xml也写了rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: Error allocating a servlet instancern org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)rn org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)rn org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)rn java.lang.Thread.run(Thread.java:595)rnrnrnroot cause rnrnjava.lang.UnsupportedClassVersionError: Bad version number in .class filern java.lang.ClassLoader.defineClass1(Native Method)rn java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1853)rn org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:875)rn org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1330)rn org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)rn org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)rn org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)rn java.lang.Thread.run(Thread.java:595)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.5.26 logsrn
解决Servlet 500错误
在Eclipse中写程序创建了包,把HelloWorld.class的整个包一起放到WEB-INF / classes中在web.xml中的servlet-class名也要包括包名如: com.servletJsp .HelloWorld
servlet与class
servlet如何传递值给某个java方法,在java方法中怎样接收servlet传递过来的数据,给个例子 ,小弟急求。。
Servlet跳转
NULL 博文链接:https://chaoyi.iteye.com/blog/2072931
servlet的跳转
介绍了servlet 的跳转情况!
Servlet与跳转
温馨提示 关注我的公众号【Java剑主】,学习更多有深度的技术文章。本博客不在记录原创博文,请移步公众号获取最新内容。 修道注重根基,熟透原理方能看透事物本质,编程亦如此! Java修炼之道,道心坚不移!踏剑寻梦,不忘初心! 如何由Servlet跳转到JSP或其他页面。 现在的开发要求是,可以由Servlet跳转到根目录下保存的show.jsp页面, 而show.jsp页面的功能就是输...
Servlet之跳转
页面跳转是开发一个web应用经常会发生的事情。 比如登录成功或是失败后,分别会跳转到不同的页面。 跳转的方式有两种,服务端跳转和客户端跳转 ,服务端一般便于传输数据,客户端就完全是另一个页面了。 1.准备两个页面 success.html fail.html &amp;lt;div style=&quot;color:green&quot;&amp;gt;login success&amp;lt;/div&amp;gt; &amp;lt;div st...
servlet跳转
请问下,我由A网页跳转到B网页,B网页会读取到数据库里的内容加载出来。rn我在A网页写了一个servlet 跳转到B网页取得的数据全为空,我该用session,cookie,把从数据存起来 加载到B? 才学J2EE几天,望大家帮忙解答rn
Servlet——(一)Servlet概述——Servlet的路径跳转
一、JSP跳转到Servlet 1、相对路径,如href="servlet/TestServlet" ***注意:如果写成"/servlet/TestServlet"会报错,因为第一个'/'表示的是【服务器根目录:http://localhost:8080/】,这里应该去【项目】的根目录寻找虚拟目录servlet ,然后在里面找到TestServlet。 2、绝对路径,通过内置成员变量pat
访问servlet时出现Servlet HelloWorldServlet is not available
我刚开始学servlet,然后自己照着书配置一个HelloWorldServlet,我按视频上说的都写配好后rn访问的时候输入http://localhost:8080/ch7/hellorn源程序是这样的rnimport java.io.*;rnimport javax.servlet.*;rnimport javax.servlet.http.*;rnrnrnpublic class HelloWorldServlet extends HttpServlet rn public void doGet(HttpServletRequest req, HttpServletResponse resp)rn throws IOException,ServletExceptionrn rn resp.setContentType("text/html;charset=gb2312");rn rn rn PrintWriter out=resp.getWriter();rn out.println("");rn out.println("");rn out.println(" HelloWorld");rn out.println("");rn out.println(" ");rn out.println("HelloWorld");rn out.println("你好");rn out.println("new java.util.Date()");rn out.println("");rn rn rn rn public void doPost(HttpServletRequest req,HttpServletResponse resp)rn throws ServletException, IOExceptionrn rn doGet(req,resp);rn rn rnrnrnrnrnrn然后把编译后的class文件拷到拷贝到C:\Program Files\apache-tomcat-6.0.14\webapps\ch7\WEB-INF\classes下面。rnweb.xml配置如下rnrnrn rnrn rn rn HelloWorldServletrn HelloWorldServlet rn rn rn rn HelloWorldServletrn /hellorn rn rnrnrnrn可是访问的时候提示rnrnHTTP Status 404 - Servlet HelloWorldServlet is not availablernrn--------------------------------------------------------------------------------rnrntype Status reportrnrnmessage Servlet HelloWorldServlet is not availablernrndescription The requested resource (Servlet HelloWorldServlet is not available) is not available.rnrnrn本人学java不长,发下这个配置太麻烦了,大家帮帮我啊,谢谢了rnrn
求救JSP 使用servlet 出现 http 500错误
源代码大致意思是实现一个注册的效果rn下面是一个servletrn主要是判断前台提交过来的用户名,密码,等信息rnpublic class RegServlet extends HttpServlet implements Servlet rnrn rn public void doGet(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn //直接调用doPost方法处理rn doPost(request , response);rn rn rn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn //获取前台的信息rn String path = request.getContextPath();rn String username = request.getParameter("username");rn String userpassword = request.getParameter("userpassword");rn String userpassword1 = request.getParameter("userpassword1");rn //判断用户名是否为空rn if(username.equals(""))rn //如果为空响应到一个页面rn response.sendRedirect(path+"/mcg/regnameempty.jsp");rn //判断密码是否为空rn if(userpassword.equals(""))rn response.sendRedirect(path+"/mcg/regempty.jsp");rn //判断密码是否一致rn if(!userpassword1.equals(userpassword))rn response.sendRedirect(path+"/mcg/regnot.jsp");rn elsern response.sendRedirect(path+"/mcg/regsuc.jsp");rn rn rn rn rnrn这三个响应我操作的时候,比如我不写用户名,他则会跳到用户名为空的那个页面rn然后我写了用户名,不写密码,他就跳不过去了.直接跳到映射的那个页面去了rn然后我再重试一次,就直接报错http statur -500rn然后再试试不输入用户名,结果连第一次跳到用户名为空的那个页面都不行了rn也是报http statur -500 错误或者也是直接跳到映射的页面去了.rn反正一直重试,结果一会这样一会那样.头搞大了.rn错误代码如下:rnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjava.lang.IllegalStateExceptionrn org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)rn cn.cstp.org.servlet.RegServlet.doPost(RegServlet.java:33)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.rn自我检查过各个地址或路径或文件名都是正确的.rn请高手帮忙看看吧.感激感激rnrnrn
jboss-3.0.8_tomcat-4.1.24测试实例interest的servlet时,网页出现500错误
具体如下:rnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: Error instantiating servlet class org.jboss.docs.interest.InterestServletrn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912)rn at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:534)rnrnrnroot cause rnrnjava.lang.NoClassDefFoundError: javax/ejb/EJBObjectrn at java.lang.ClassLoader.defineClass0(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:537)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1679)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:968)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1409)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)rn at java.lang.Class.getDeclaredConstructors0(Native Method)rn at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)rn at java.lang.Class.getConstructor0(Class.java:1922)rn at java.lang.Class.newInstance0(Class.java:278)rn at java.lang.Class.newInstance(Class.java:261)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903)rn at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)rn at java.lang.Thread.run(Thread.java:534)rnrnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/4.1.24-LE-jdk14
myeclipse重命名servlet之后跳转该servlet出现404错误的解决方法
当我们在myeclipse中编写完servlet之后,突然发现servlet的名字写错了,当我们重命名之后,发现我们运行需要跳转该servlet的程序时会出现404错误,这是为什么呢? 其实在myeclipse重命名给servlet之后,并不会自动的修改该servlet的配置,需要手动的去修改该servlet的配置,一般是在该servlet的注解中直接修改URL映射。
servlet与html
在servlet中可不可以重新返回html的页面,rn这个是在网上找的例子,但是在实机实验时候老是出错误,是需要加什么声明吗还是?rn谢谢! if(username!=null&&username.length()>5&&pass!=null&&pass.length()>5&&pass.equals(pass2)&&iage>=0)rnrn //要连接数据库,先从配置表中获取初始化参数传给JDBSUtil的构造函数rn ServletContext ctx = this.getServletContext();rn String url = ctx.getInitParameter("url");rn String dbuser = ctx.getInitParameter("dbuser");rn String dbpass = ctx.getInitParameter("dbpass"); rn JDBCUtil util = new JDBCUtil(url, dbuser, dbpass);rnrn //userdao--->util--->数据库rn //然后将util作为参数传给操作类rn UserDao dao = new UserDao();rn dao.setUtil(util);rnrn //将获取的的参数存到uer中,调用操作类中的方法保存rn User user = new User(username, pass, iage, sex, hobby, sheng, ipaddr, info);rn dao.saveUser(user);rnrn out.println(" 恭喜你!注册成功");rn out.println(" 点此登录");rn elsernrn out.println(" 参数有误,注册失败!");rn out.println(" 重新注册");rnrn rnrn out.flush();rn out.close();rn
一个servlet 导致HTTP 500错误
package com.bw.mmsinterface.servlet;rnrnpublic class DataImportor extends HttpServlet rn rn private HttpClient httpClient;rn rn protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException rn try arg1.setStatus(process(arg0.getInputStream(),arg1.getOutputStream(),arg1.getOutputStream()));rn rn rn rnrn protected synchronized int process(InputStream input,OutputStream output1,OutputStream output2)rn rn int result = 200;rn rn rn processData(dePack(input,output1),output2);rn rn return result;rn rn rn protected void processData(Collection data,OutputStream output)rn rn processMo(data,output);rn rn rn public Collection dePack(InputStream input,OutputStream output) throws PackException rn rn return setBean(input,output);rn rn public Collection setBean(InputStream is,OutputStream output) throws DocumentExceptionrnrn ArrayList list = new ArrayList();rn Document document = null;rn SAXReader reader = new SAXReader();rn document = reader.read(is);rn Element root = document.getRootElement();rn Iterator lv = root.elementIterator();rn Element el = null;rn Element record = null;rn SmsMoBean smb = null;rn Document dm = DocumentHelper.createDocument();rn Element eltRoot=DocumentHelper.createElement("ipf"); rn dm.setRootElement(eltRoot); rn Element headElement = eltRoot.addElement("head");rn Element transactionIdElement = headElement.addElement("transactionId");rn Element packageTypeElement = headElement.addElement("packageType");rn Element bodyElement = eltRoot.addElement("body");rn Element resultElement = bodyElement.addElement("result");rn String packageType = "";rn String transactionId = "";rn String spCode = "";rn String terminalId = "";rn String msgContent = "";rn String linkid = "";rn rn while(lv.hasNext())rn rn smb = new SmsMoBean();rn record = (Element)lv.next();rn rn rn tryrn el = (Element)record.selectSingleNode("//head/packageType");rn packageType = new String(el.getTextTrim());rn rn catch(Exception e)rn rn rn rn rn rn if(packageType.equalsIgnoreCase("SMSMORequest"))rn smb.setPackageType(packageType); rn smb.setTransactionId(transactionId);rn smb.setSpCode(spCode);rn smb.setSrcTerminalId(terminalId);rn smb.setMsgContent(msgContent);rn smb.setLinkid(linkid);rn transactionIdElement.setText(transactionId); rn packageTypeElement.setText("SMSMOResponse");rn resultElement.setText("0"); rn OutputFormat format = OutputFormat.createPrettyPrint();rn format.setEncoding("UTF-8");rn XMLWriter outputXml;rn rn try rn outputXml = new XMLWriter(output,format);rn outputXml.write(dm);rn catch (UnsupportedEncodingException e) rn e.printStackTrace();rn catch (IOException e) rn e.printStackTrace();rn rn output.flush();rn list.add(smb); rn rn rn return list;rnrn rn public void processMo(Collection data,OutputStream output) throws ProcessException rn Iterator itor = data.iterator();rn SmsMoBean record;rn Document dm = DocumentHelper.createDocument();rn Element eltRoot=DocumentHelper.createElement("ipf"); rn dm.setRootElement(eltRoot); rn Element headElement = eltRoot.addElement("head");rn Element transactionIdElement = headElement.addElement("transactionId");rn Element userElement = headElement.addElement("user");rn Element passwdElement = headElement.addElement("passwd");rn Element packageTypeElement = headElement.addElement("packageType");rn Element bodyElement = eltRoot.addElement("body");rn Element actIdElement = bodyElement.addElement("actId");rn Element feeTerminalIdElement = bodyElement.addElement("feeTerminalId");rn Element destTerminalIdElement = bodyElement.addElement("destTerminalId");rn Element ccTerminalIdElement = bodyElement.addElement("ccTerminalId");rn Element serviceIdElement = bodyElement.addElement("serviceId");rn Element feeElement = bodyElement.addElement("fee");rn Element needReportElement = bodyElement.addElement("needReport");rn Element msgTitleElement = bodyElement.addElement("msgTitle");rn Element msgContentElement = bodyElement.addElement("msgContent");rn Element linkidElement = bodyElement.addElement("linkid"); rn rn httpClient = new HttpClient();rn rn while(itor.hasNext())rn rn tryrn record = (SmsMoBean)itor.next();rn String transactionId = record.getTransactionId();rn if (transactionId == null) rn logger.warn("the request flag is not right!"); rn continue;rn rn String terminalId = record.getSrcTerminalId();rn rn rn rn rn rn String singleParamUrl = ".."; rn String path = this.getServletContext().getRealPath("/") + "zip";rnrn try rn String url = "";rn rn url = singleParamUrl + "?item=" + item + "&" + "text="+ URLEncoder.encode(text, "utf8") + "&"+ "width=" + width;rn logger.info(url);rn GetMethod get = new GetMethod(url);rn rn httpClient.executeMethod(get);rn rn if (HttpStatus.SC_OK == get.getStatusCode()) rn byte[] buffer = get.getResponseBody();rn String picAddress = new String(buffer);rn rn picAddress = picAddress.replaceAll("\\\\", "/");rn logger.info("add :" + picAddress);rn GetMethod getpic = new GetMethod(picAddress);rn HttpClient hc = new HttpClient();rn hc.executeMethod(getpic);rn byte[] picbuffer = getpic.getResponseBody();rn if (HttpStatus.SC_OK == getpic.getStatusCode()) rn rn File picture = new File(path + File.separator+ "pic1.gif");rn FileOutputStream out = new FileOutputStream(picture, false);rn out.write(picbuffer);rn rn String outputFileName = path + File.separator + "MMS" + transactionId + ".zip";rn rn rn tryrn FileOutputStream file=new FileOutputStream(outputFileName);rn CheckedOutputStream csum=new CheckedOutputStream(file,new Adler32());rn ZipOutputStream zip=new ZipOutputStream(new BufferedOutputStream(csum));rn BufferedReader reader=new BufferedReader(new FileReader(path + File.separator+ "pic1.gif"));rn zip.putNextEntry(new ZipEntry("pic1.gif"));rn int c;rn while((c=reader.read())!=-1)rn zip.write(c);rn zip.close();rn rn catch(IOException e)rn e.printStackTrace();rn rn rnrn rn File zipFile = new File(outputFileName);rn FileInputStream in = new FileInputStream(zipFile); rn byte[] buf=new byte[35840];rn in.read(buf);rn rn msgContent = Base64.encode(buf);rn rn rn rn rn linkidElement.setText(linkid);rn OutputFormat format = OutputFormat.createPrettyPrint();rn format.setEncoding("UTF-8");rn XMLWriter outputXml;rn rn rn outputXml = new XMLWriter(output,format);rn outputXml.write(dm);rn rn rn output.flush();rn rn rn rn rn rn rn rn rn rnrn
我在tomcat里的Server.xml部署web项目报Error instantiating servlet class
rnjsp可以访问,servlet就报错了,是因为没有打包成jar配置到webapps下吗rnrn要是的话有没有现成的ant代码
Servlet运行时总是报500错误
HTTP Status 500 - Error instantiating servlet 改了一下这里就可以了
想问一个关于Servlet跳转html的问题
public void doGet(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn response.sendRedirect(request.getParameter("name") + ".html");rn rnrn名字为“name”的html文件是自动生成在WebInf目录下的,并且生成后不断在往里写东西。那么问题来了。 我通过这个请求想跳转到这个正在写的html,我第一次请求的时候如果他没写完,就是没写完的状态。那么当这个html完全写好(我直接去点开可以看到完全写好了), 这个Servlet重定向过去还是当时第一次请求时没写完的状态。 求大神告知其中的具体原理,或者提供一下解决方案,谢谢了!
html提交表单之后跳转不到servlet的问题
一年前学过一点。。现在全忘了n新建了一个项目,注册页面是放在webcontent里的reg文件夹,usrservlet放在javaresource图里这个路径n![图片说明](https://img-ask.csdn.net/upload/201707/10/1499657804_422374.png)nweb.xml配置了servlet,usrServlet里有路径n![图片说明](https://img-ask.csdn.net/upload/201707/10/1499657878_351342.png)n![图片说明](https://img-ask.csdn.net/upload/201707/10/1499657886_728486.png)n把表单提交到usrServletn![图片说明](https://img-ask.csdn.net/upload/201707/10/1499657937_980840.png)n提交之后发现usrServlet的路径不对,而且提示是在reg下,n![图片说明](https://img-ask.csdn.net/upload/201707/10/1499658044_189163.png)n搞了半天不知道怎么弄啊。。。有没有好心人帮忙看一下。。。
急!这是什么错! jbuilder+struts javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.Act
D:\j2sdk1.4.2_05\bin\javaw -classpath "D:\JBuilder9\thirdparty\jakarta-tomcat-4.0.6-LE-jdk14\bin\bootstrap.jar;D:\JBuilder9\jdk1.4\lib\tools.jar" -Dcatalina.home="D:/JBuilder9/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14" org.apache.catalina.startup.Bootstrap -config E:\test\java\rscx\Tomcat\conf\server8083.xml start rnHttpConnector Opening server socket on all host IP addressesrnrnStarting service Tomcat-StandalonernrnApache Tomcat/4.0.6rnrnWebappLoader[/rscx]: Deploying class repositories to work directory E:\test\java\rscx\Tomcat\work\rscxrnrnWebappLoader[/rscx]: Deploy JAR /WEB-INF/lib/commons-dbcp.jar to E:\test\java\rscx\rscx\WEB-INF\lib\commons-dbcp.jarrnrnWebappLoader[/rscx]: Deploy JAR /WEB-INF/lib/commons-logging.jar to E:\test\java\rscx\rscx\WEB-INF\lib\commons-logging.jarrnrnWebappLoader[/rscx]: Deploy JAR /WEB-INF/lib/mysql-connector-java-3.0.14-production-bin.jar to E:\test\java\rscx\rscx\WEB-INF\lib\mysql-connector-java-3.0.14-production-bin.jarrnrnWebappLoader[/rscx]: Deploy JAR /WEB-INF/lib/struts-legacy.jar to E:\test\java\rscx\rscx\WEB-INF\lib\struts-legacy.jarrnrnWebappLoader[/rscx]: Deploy JAR /WEB-INF/lib/struts.jar to E:\test\java\rscx\rscx\WEB-INF\lib\struts.jarrnrnWebappLoader[/rscx]: Reloading checks are enabled for this ContextrnrnStandardManager[/rscx]: Seeding random number generator class java.security.SecureRandomrnrnStandardManager[/rscx]: Seeding of random number generator has been completedrnrnContextConfig[/rscx]: Added certificates -> request attribute ValvernrnStandardWrapper[/rscx:default]: Loading container servlet defaultrnrnStandardWrapper[/rscx:action]: Marking servlet action as unavailablernrnStandardContext[/rscx]: Servlet /rscx threw load() exception: javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrnjavax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServletrnrn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:895)rnrn at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)rnrn at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)rnrn at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)rnrn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)rnrn at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)rnrn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)rnrn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)rnrn at org.apache.catalina.core.StandardService.start(StandardService.java:388)rnrn at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)rnrn at org.apache.catalina.startup.Catalina.start(Catalina.java:781)rnrn at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)rnrn at org.apache.catalina.startup.Catalina.process(Catalina.java:179)rnrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rnrn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rnrn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rnrn at java.lang.reflect.Method.invoke(Method.java:324)rnrn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)rnrnStandardWrapper[/rscx:invoker]: Loading container servlet invokerrnrnWebappLoader[]: Deploying class repositories to work directory E:\test\java\rscx\Tomcat\workrnrnWebappLoader[]: Reloading checks are enabled for this ContextrnrnStandardManager[]: Seeding random number generator class java.security.SecureRandomrnrnStandardManager[]: Seeding of random number generator has been completedrnrnContextConfig[]: Added certificates -> request attribute ValvernrnStandardWrapper[:default]: Loading container servlet defaultrnrnStandardWrapper[:invoker]: Loading container servlet invokerrnrnHttpConnector[8083] Starting background threadrnrn
运行servlet时出现404错误
求解决!!!!!rn[img=https://img-bbs.csdn.net/upload/201703/02/1488444052_537819.png][/img]rn[img=https://img-bbs.csdn.net/upload/201703/02/1488444071_707947.png][/img]rn[img=https://img-bbs.csdn.net/upload/201703/02/1488444085_937424.png][/img]rn[img=https://img-bbs.csdn.net/upload/201703/02/1488444110_202983.png][/img]
建立servlet时出现的错误
出现的问题如下:
运行servlet时出现的错误?
Error 500--Internal Server Error rnjava.lang.ArrayIndexOutOfBoundsException: 3rn at Servlet02.doGet(Servlet02.java:63)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rn at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)rn at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)rn at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)rn at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)rn at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3214)rn at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)rn at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)rn at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)rn at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)rn at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)rn at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)rn at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)rn rn
编译Servlet时出现的错误
程序如下:rnpackage test;rnimport java.io.IOException;rnimport java.io.PrintWriter;rnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnpublic class Test extends HttpServlet rnprotected void doGet(HttpServletRequest request, HttpServletResponse response)rnthrows ServletException, IOException rnPrintWriter out=response.getWriter();rnout.println(" This is a servlet test.");rnout.flush();rnrnrn错误如下:rnC:\>javac test.javarntest.java:8: class Test is public, should be declared in a file named Test.javarnpublic class Test extends HttpServlet rn ^rn1 error
【Servlet】Servlet中的两种跳转方法
方法一: response.sendRedirect("/index.jsp")方法二: RequestDispatcher rd = getServletContext().getRequestDispatcher("/index.jsp"); rd.forward(request,response);
表单提交Servlet出现第一次404,第二次出现500错误
除了网上所说,eclipse没有自动编译,就是没有编译好Servlet, 还有就是xml配置出错,,但我却遇到的是整个工程文件上的问题,例如我在导入jar包的问题上出错,找不到jar包,同样会出现这种情况,所以出现项目文件上有红色感叹号的必须先解决 人生第一次写博客
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制