调试openfire的JSP页面,openfire debug

欢迎来到Raigor的园子,我的博客地址是:http://www.cnblogs.com/raigor/ 

找到这篇博客的朋友,一定是遇到了和我类似的问题:

(我的调试环境是Linux Mint 13 + Eclipse3.6 + openfire 3.8.1)

首先,参照各种”openfire开发配置“、“openfire开发调试”等文章,成功启动服务,并实现对java类的断点调试。(如果这一步还没有完成 推荐这篇:http://blog.csdn.net/ares1201/article/details/7737872

然而我们会发现,/src/web/目录下的JSP页面,含有大量java代码,但此时对页面的断点却不能生效,十分痛苦。而这对于学习研究openfire源码,是非常需要的。

经过多番搜索,发现有不少朋友讨论到调试的话题,但都不是能够解决上述问题的,于是,还是自己研究吧。

如果是tomcat,我们知道使用jpda即可启动debug模式,进行页面的调试,但openfire内置的是jetty服务器,尝试使用jpda的方法后并没有成功。

终于,一个意外的发现,解决了我的问题,请看:

在/src/bin/目录下,有一个文件:openfire-dev.bat,显然,它是Win下使用的,所以之前并没有注意到这个文件。其中一段注释是这样的:

REM # Starts Openfire in development mode, which means that JSP pages in the admin console will
REM # be compiled dynamically out of the web src directory. This makes it much easier to admin
REM # console development.

原来,openfire已经准备了开发模式,只要启用就可以调试JSP页面了,但是为何只写在这么一个bat文件中,坑啊!

好了,启用的方法:在VM arguments中,增加-DdevelopmentMode="true",再次启动openfire服务器,启动信息多了一行“使用开发模式”了:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/raigor/dev/workspace/openfire/build/lib/dist/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/raigor/dev/workspace/openfire/target/openfire/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Openfire 3.8.1 [2013-3-30 18:20:23]
使用开发模式
管理平台开始监听:

通过浏览器打开管理控制台,会奇怪的报错:

HTTP ERROR 500

Problem accessing /. Reason:

    Unable to compile class for JSP

Caused by:

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

Caused by:

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

解决的办法是:在Run Configurations中,Classpath中添加 jdk/lib/tools.jar,

("%JAVA_HOME%明明配好的,可是这里需要指定一下)再次运行,就没有错误了。

本文地址:http://www.cnblogs.com/raigor/archive/2013/03/30/2990813.html

现在开始调试页面吧! 如果有疑问,欢迎交流!

posted @ 2013-03-30 18:46  Raigor Jiang  阅读(1552)  评论(1编辑  收藏  举报