JSP+Tomcat学习日记(-) 配置JSP运行环境

Windows 操作系统环境下.

1. 所需软件:

软件名称          安装包名称               下载地址
  j2sdk         j2sdk-1_4_2-windows-i586.exe     http://java.sun.com/
  Jakarta-Tomcat    jakarta-tomcat-5.0.28.zip       http://jakarta.apache.org/Apache-Tomcat

2.安装( 些步骤省略)

3. 配置环境:

我的电脑/属性/高级/系统环境变量/

classpath  加"E:/j2sdk1.4.2/lib/dt.jar;d:/j2sdk142/lib/tools.jar;d:/j2sdk142/lib;.;" ;($catalina_home%/common/lib/servlet-api.jar;$catalina_home%/common/lib/jsp-api.jar;编译Java Servlet时所要用到的)  注意后面那个点,它表示当前目录,包含了该目录后,就可以到任意目录下去执行需要用到该目录下某个类的Java程序;                           

Java_Homa=java所安装的目录..

Catalina_home=tomcat 所安装的目录..

Path=java所安装的目录/bin.

3. 测试: .

http://localhost:8080/出现欢迎界面.. 表示..

 

4以下为一些具体的错误提示及解答:

一.

Exception  message

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

exception

javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/myServlet
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:388)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


root cause

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class myServlet with modifiers ""
sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

此时多数情况下, 是因为你没有都声明你的Servlet为public.

二. 页面信息如下:

 

 

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

 此是的原因有可能是你的servlet 重载方法了doPost(). 些时将 doPost()改为doGet()..

正常.

 

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

 此是的原因有可能是你的servlet 重载方法了doPost(). 些时将 doPost()改为doGet()..

正常.

 

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

 此是的原因有可能是你的servlet 重载方法了doPost(). 些时将 doPost()改为doGet()..正常.

另一种方法. 由于在你的servlet里面没有处理doGet请求啊。
试着在你的servlet文件里面加入
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
{doPost(request,response);}

 

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

 此是的原因有可能是你的servlet 重载方法了doPost(). 些时将 doPost()改为doGet()..

正常.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值