您的位置:首页 > 运维架构 > Tomcat

tomcat 6 SSI 配置问题的解决

2009-12-25 16:47 423 查看
你也可能遇到了:java.lang.SecurityException: Filter of class org.apache.catalina.ssi.SSIFilter is privileged and cannot be loaded by this web application

tomcat 6 SSI的配置与5.x版本不同,从网上搜索的结果来看,5.xx中要改一个.jar中的文件,而6.x中,却没有这个文件
1.首先想到的还是看官方文档http://tomcat.apache.org/tomcat-6.0-doc/ssi-howto.html,文档里说得很清楚:只需把
$CATALINA_BASE/conf/web.xml文件里
ssi 相关的 servlet servlet-mapping filter filter-mapping注释去掉就行
2 启动,出错,报了一个安全方面的异常,
java.lang.SecurityException: Filter of class org.apache.catalina.ssi.SSIFilter is privileged and cannot be loaded by this web application再看文档还有这样一句话:Only Contexts which are marked as privileged may use SSI features (see the privileged property of the Context element).
我对privileged property of the Context element的理解有误,先是把
$CATALINA_BASE/conf/servlet.xml下的当前项目的 Context中加入了
privileged="true"的属性(这不正是Context元素的 privileged 属性吗),启动还是报错.无奈,崩溃中.......
3.我使用的版本 6.0.13中
$CATALINA_BASE/conf/下还有一个context.xml 这里面也有一个context的元素, 加上 privileged="true" 属性后,再启动,这次启动成功了

补充:以上的配置并没有解决乱码问题
乱码的解决:在
$CATALINA_BASE/conf/web.xml中的ssi servlet配置中添加以下初始配置:

<init-param>
<param-name>inputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>
其中
utf-8应该与你页面的编码方式相同


在shtml页面里
<!--#include file="test.html"-->就可以引用静态文件了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: