第一次使用Jetty9时,出现的问题

第一次使用Jetty9时,出现的问题 当现在好Jetty9后(可以在官方网站上下载,当前的最新版为Revision 9.1.0-SNAPSHOT),之后解压到本地,不用配置,看解压后目录文件:

在jetty的根目录也就是${JETTY_HOME},打开cmd,或打开cmd后,切换到${JETTY_HOME}下,
>java -jar start.jar

这样就可以启动Jetty服务器了,但是,你在页面中是访问不到的,比如输入http://localhost:8080,是得不到任何的返回结果的,为什么呢?请看下面的摘录:

You can point a browser at this server athttp://localhost:8080.Since release 9.1.0, the jetty  distribution does not deploy any demo web applications, so to see a more  interesting demonstration of the server you need to run from the demo-base  directory as follows:

意思是说:从9.1.0版本开始,不是默认的部署示例应用,需要自己去启动

> cd $JETTY_HOME/demo-base/
> java -jar ../start.jar

将路径切换到demo-base目录下:

D:\JAVA\jetty-distribution-9.1.0.v20131115>cd demo-base

这样的话你就可以在浏览器中看到示例页面了。

再看看官网的介绍:

Creating a new Jetty Base

The demo-base directory described above is an example of the    jetty.base mechanism added in Jetty 9.1. A jetty base allows the    configuration and web applications of a server instance to be stored    separately from the jetty distribution, so that upgrades can be done with    minimal disruption. Jetty's default configuration is based on two    properties:

jetty.homeThe property that defines the location of the jetty distribution, its libs, default modules and default XML files (typically start.jar, lib, etc)

jetty.baseThe property that defines the location of a specific instance of a jetty server, its configuration, logs and web applications(typically start.ini, start.d, logs and webapps)

这说明要部署应用,都需要自己的BASE,从上面部署demo时就可以看出来。

但是,问题出来了:

当我新建好mybase文件夹后,将以前做好的web app放到该目录的webapps后,在启动etty时 ,出现以下问题:

2013-11-27 12:05:22.981:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Suppo
rt for /, did not find org.apache.jasper.servlet.JspServlet
2013-11-27 12:05:23.012:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppCo
ntext@1c86116{/,file:/D:/JAVA/jetty-distribution-9.1.0.v20131115/mybase/webapps/
ROOT/,AVAILABLE}{D:\JAVA\jetty-distribution-9.1.0.v20131115\mybase\webapps\ROOT}

2013-11-27 12:05:23.075:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Suppo
rt for /MMS1.0, did not find org.apache.jasper.servlet.JspServlet

就是那个NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet,

经过查询,说明文档说的是JSP需要编译,单是Jetty不会默认的保存,编译需要JDK,如果System中也就是系统没有装JDK的话,需要在配置文当中开启使用自己的编译器,但是我有啊,java、javac都能使用,再查说是要加参数:

java -jar jetty.jar OPTIONS=Server,jsp

但是用了,还是没用,最后擦看文档,有个命令可以查看环境:

D:\JAVA\jetty-distribution-9.1.0.v20131115\mybase>java -jar ../start.jar --version

Jetty Server Classpath:
-----------------------
Version Information on 11 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
      changes to the --module=name command line options will be reflected here.
0:                    3.1.0 | ${jetty.home}\lib\servlet-api-3.1.jar
1:                  3.1.RC0 | ${jetty.home}\lib\jetty-schemas-3.1.jar
2:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-http-9.1.0.v20131115.jar
3:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-server-9.1.0.v20131115.jar
4:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-xml-9.1.0.v20131115.jar
5:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-util-9.1.0.v20131115.jar
6:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-io-9.1.0.v20131115.jar
7:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-security-9.1.0.v20131115.jar
8:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-servlet-9.1.0.v20131115.jar
9:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-webapp-9.1.0.v20131115.jar
10:          9.1.0.v20131115 | ${jetty.home}\lib\jetty-deploy-9.1.0.v20131115.jar

我一看,是不是少了编译JSP的jar,试着添加:

D:\JAVA\jetty-distribution-9.1.0.v20131115\mybase>java -jar ../start.jar --add-to-start=jsp

WARNING: jsp             initialised in ${jetty.base}\start.ini (appended)
WARNING: jsp             enabled in     ${jetty.base}\start.ini
WARNING: server          enabled in     ${jetty.base}\start.ini

这一看,添加过了,我才记起,刚才在start.ini中打开了一(ˇˍˇ) 想项配置:

--Dorg.apache.jasper.compiler.disablejsr199=true

这块原先是被注释掉的,可以打开,然后再base目录下的start.ini中出现了一行:

#
# Initialize module jsp
#
--module=jsp

# JSP Configuration
# To use an non-jdk compiler for JSP compilation uncomment next line
# -Dorg.apache.jasper.compiler.disablejsr199=true

我记得原先好像没有出现,现在有了,在他的下面也有那个开启jsp编译的选项,但是被注释点了,不知道是咋弄好的,这时候,可以正常启动了。打开浏览器可以正常访问了。

。。。。。。。

Jetty9 NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet相关推荐

  1. SSH异常——严重:Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException

    严重: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: /userAdd.js ...

  2. org.apache.jasper.JasperException: /jsp/menu.jsp (line: 8, column: 1) Page directive

    org.apache.jasper.JasperException: /jsp/menu.jsp (line: 8, column: 1) Page directive jsp页面编码设置错误,检查设 ...

  3. maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP

    idea 通过maven插件创建一个WEB项目通过内嵌Tomcat加载项目,启动没问题,一访问页面就报错提示无法将jsp编译为class文件: HTTP Status 500 - type Excep ...

  4. org.apache.jasper.JasperException: Unable to compile class for JSP

    一.报错信息 严重: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: Unab ...

  5. org.apache.jasper.JasperException: Unable to compile class for JSP:

    报错信息: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: ...

  6. org.apache.jasper.JasperException: /WEB-INF/menu-page.jsp (line: 108, column: 1) File [modal-menu-a

    记录一个错误 org.apache.jasper.JasperException: /WEB-INF/menu-page.jsp (line: 108, column: 1) File [modal- ...

  7. javaweb项目报错:org.apache.jasper.JasperException: 无法为JSP编译类

    执行相应的跳转页面,出现了报错: HTTP状态 500 - 内部服务器错误 org.apache.jasper.JasperException: 无法为JSP编译类 类型 异常报告消息 无法为JSP编 ...

  8. org.apache.jasper.JasperException:xxx.jsp File xxxx not found

    今天更新代码以后出现以下的错误: 21-Mar-2015 00:57:40.934 INFO [localhost-startStop-2] org.apache.catalina.core.Appl ...

  9. 报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17) equal symbol expected

    现象:写了如下一个jsp文件,导入需要用到的两个包: 运行结果报错: org.apache.jasper.JasperException: /index.jsp (line: 1, column: 1 ...

最新文章

  1. svd奇异值分解_SVD(奇异值分解)到底在干什么
  2. Oracle表的分区update卡着,分区表update global indexes引起表阻塞
  3. Android-Frame布局,UI布局切换,录音,照相机,影音播放器,音频播放器
  4. weblogic 建立websocket连接报404_基于 Serverless 与 Websocket 的聊天工具实现
  5. linux date 天之前,linux date命令前后几天的推导
  6. C语言:强大的函数指针
  7. 把svg图标制作成字体图标_让我们用SVG符号和CSS变量制作彩色图标
  8. JarvisOJ Basic 熟悉的声音
  9. 【cs229-Lecture8】顺序最小优化算法
  10. requestLayout invalidate postInvalidate
  11. tp3.2 BIND_MODULE与DEFAULT_MODULE
  12. Excel VBA编程
  13. 达梦之路——基于Linux平台(redhat)安装部署DM7单库
  14. 2021金山WPS秋招前端笔试题
  15. 【Python 爬虫教程】代理ip网站有哪些?
  16. 港科报道 | 香港科技大学(广州)人工智能产学研合作交流会成功举办
  17. Nutz cnd.wrap传参
  18. Confluence 6 管理协同编辑 - 修改你的 Synchrony 配置
  19. 科学计算与matlab语言期末答案,科学计算与MATLAB语言答案
  20. PAT甲级 1032 Sharing (25分) 测试点5陷阱

热门文章

  1. 智能电池巡检箱监控系统方案
  2. 磁盘最优存储与磁带最优存储问题
  3. 可以识别U盘,但是双击的时候出现Please inert disk into removable drivers?
  4. 对比ubuntu与centos系统 ​​​​
  5. 关于怎么将PDF文件转换成PPT格式的方法
  6. python三门问题_python模拟“三门问题”
  7. 构建工具fis3的使用
  8. 图_SimpleGraph
  9. [C++]豆知识(1条)
  10. linux用户锁住了锁多久,linux(ubuntu)用户连续N次输入错误密码进行登陆时自动锁定X分钟...