你的位置:首页 > Java教程

[Java教程]java.lang.SecurityException: Filter of class org.apache.catalina.ssi.SSIFilter is privileged and cannot be loaded by this web application


错误:

 1 java.lang.SecurityException: Filter of class org.apache.catalina.ssi.SSIFilter is privileged and cannot be loaded by this web application 2   at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:271) 3   at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) 4   at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115) 5   at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072) 6   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726) 7   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) 8   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) 9   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)10   at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)11   at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)12   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)13   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)14   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)15   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)16   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)17   at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)18   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)19   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)20   at org.apache.catalina.core.StandardService.start(StandardService.java:525)21   at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)22   at org.apache.catalina.startup.Catalina.start(Catalina.java:595)23   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)24   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)25   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)26   at java.lang.reflect.Method.invoke(Unknown Source)27   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)28   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

View Code

错误原因:

     因为tomcat-->conf-->web.

解决方案:

     找到这个文件。注释掉以下内容:

 1 <!--  2   <servlet> 3     <servlet-name>ssi</servlet-name> 4     <servlet-class> 5      org.apache.catalina.ssi.SSIServlet 6     </servlet-class> 7     <init-param> 8      <param-name>buffered</param-name> 9      <param-value>1</param-value>10     </init-param>11     <init-param>12      <param-name>debug</param-name>13      <param-value>0</param-value>14     </init-param>15     <init-param>16      <param-name>expires</param-name>17      <param-value>666</param-value>18     </init-param>19     <init-param>20      <param-name>isVirtualWebappRelative</param-name>21      <param-value>0</param-value>22     </init-param>23    <init-param>24       <param-name>inputEncoding</param-name>25       <param-value>utf-8</param-value>26     </init-param>27     <init-param>28       <param-name>outputEncoding</param-name>29       <param-value>utf-8</param-value>30     </init-param>31     <load-on-startup>4</load-on-startup>32   </servlet>33 -->

View Code
1 <!-- 2   <servlet-mapping>3     <servlet-name>ssi</servlet-name>4     <url-pattern>*.shtml</url-pattern>5   </servlet-mapping>6 7 -->

View Code
1 <!--2   <filter-mapping>3     <filter-name>ssi</filter-name>4     <url-pattern>*.shtml</url-pattern>5   </filter-mapping>6 -->

View Code
 1 <!--  2   <filter> 3     <filter-name>ssi</filter-name> 4     <filter-class> 5      org.apache.catalina.ssi.SSIFilter 6     </filter-class> 7     <init-param> 8      <param-name>contentType</param-name> 9      <param-value>text/x-server-parsed-html(;.*)?</param-value>10     </init-param>11     <init-param>12      <param-name>debug</param-name>13      <param-value>0</param-value>14     </init-param>15     <init-param>16      <param-name>expires</param-name>17      <param-value>666</param-value>18     </init-param>19     <init-param>20      <param-name>isVirtualWebappRelative</param-name>21      <param-value>0</param-value>22     </init-param>23   </filter>24 -->

View Code

 注:因为tomcat5和tomcat6对ssi的支持方式不一样。肯能解决方法也不一样。上面的方法只解决了我的问题。网上也有好多解决方法。