Web.xml中
<filter>
<filter-name>ESAPI-WAF</filter-name>
<filter-class>org.owasp.esapi.waf.ESAPIWebApplicationFirewallFilter</filter-class>
<init-param>
<param-name>log_settings</param-name>
<param-value>/WEB-INF/log4j-waf.xml</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>/WEB-INF/waf-policy.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ESAPI-WAF</filter-name>
<url-pattern>/webresources/*</url-pattern>
</filter-mapping>
在服务器上运行时出错:
Jun 01, 2015 5:02:00 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter ESAPI-WAF
java.lang.ClassNotFoundException: org.owasp.esapi.waf.ESAPIWebApplicationFirewallFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
似乎您正在使用的库在运行时不在应用程序类路径中。请务必在
中添加该库的JAR文件<WEBAPP>/WEB-INF/lib
或将其放入您的Web容器库目录中。例如,如果Apache Tomcat将该JAR文件放入
<CATALINA_HOME>/lib
目录并且不要忘记重新启动容器或重新部署您的应用程序以使该更改生效。