0

我正在尝试为 build forge 配置 build.xml 文件,但似乎我在使用 java servlet 页面所需的库时遇到了问题。我实际上正在尝试使用 OWASP 的 AntiSamy 库,但我不断收到策略异常,然后是找不到文件

org.owasp.validator.html.PolicyException: java.io.FileNotFoundException: C:\Program%20Files\Apache%20Software%20Foundation\apache-tomcat-6.0.29\webapps\XSSDemo\WEB-INF\classes\... \antisamy.xml(系统找不到指定的路径)

然而,antisamy.xml 文件肯定在这个位置。

因此,我尝试使用 Netbeans 清理和构建一个我希望可以工作的 WAR 文件,因为当我通过 Netbeans 运行 Web 应用程序时它可以正常工作。但是,我遇到了同样的问题。当我通过 WAR 部署中未发生的 ide 运行应用程序时,Netbeans 是否可能创建了一些参考?antisamy.xml 位置中的 URL 编码是否会导致问题?

谢谢您的帮助。

编辑:我在这里将长类路径压缩成三个点。实际响应具有实际的类路径。我没有收到任何类型的安全错误。

4

1 回答 1

0

The problem I had was not actually with the deployment--it was the file reference itself in my java servlet. The encoding in the path '%20' in the Program Files folder caused a FileNotFoundException. The reason this did not occur in netbeans is because the deployed files are in a c:\users... folder and there are no spaces to be encoded. The also explained why the application ran well on other computers with their tomcat folders directly on the root directory. This is the actual solution to my problem. Thanks for all your help.

于 2010-07-26T18:12:21.223 回答