- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我是新手 Java 开发人员,在尝试使用 JBOSS 和 ESAPI 开发一些网站以确保安全时出现异常
java.lang.ClassCastException: org.jboss.logmanager.log4j.BridgeLogger cannot be cast to org.owasp.esapi.Logger
当我尝试使用来自 OWASP 的 ESAPI 包时。
我的 Maven 项目由 2 个模块组成:oak-parent 和 oak-web。
Maven依赖树如下:
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ oak-web ---
[INFO] org.me.oak:oak-web:war:0.0.1-SNAPSHOT
[INFO] +- javax:javaee-api:jar:6.0:provided
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- log4j:log4j:jar:1.2.16:provided
[INFO] +- org.reflections:reflections:jar:0.9.8:compile
[INFO] | +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] +- org.jboss:jboss-vfs:jar:3.0.1.GA:provided
[INFO] | \- org.jboss.logging:jboss-logging:jar:3.0.0.CR1:provided
[INFO] +- org.owasp.esapi:esapi:jar:2.0.1:compile
[INFO] | +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | | +- logkit:logkit:jar:1.0.1:compile
[INFO] | | | +- avalon-framework:avalon-framework:jar:4.1.3:compile
[INFO] | | | \- javax.servlet:servlet-api:jar:2.3:compile
[INFO] | | \- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | \- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | +- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2:compile
[INFO] | +- xom:xom:jar:1.1:compile
[INFO] | | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | | +- xalan:xalan:jar:2.7.0:compile
[INFO] | | \- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] | | \- jdom:jdom:jar:1.0:compile
[INFO] | +- org.beanshell:bsh-core:jar:2.0b4:compile
[INFO] | \- org.owasp.antisamy:antisamy:jar:1.4.3:compile
[INFO] | +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
[INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.12:compile
[INFO] | \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | \- commons-codec:commons-codec:jar:1.7:compile
[INFO] +- org.jsoup:jsoup:jar:0.2.2:compile
[INFO] | \- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- org.apache.xmlgraphics:batik-codec:jar:1.7:compile
[INFO] | +- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
[INFO] | +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
[INFO] | | \- org.apache.xmlgraphics:batik-script:jar:1.7:compile
[INFO] | \- org.apache.xmlgraphics:batik-util:jar:1.7:compile
[INFO] \- org.apache.xmlgraphics:batik-transcoder:jar:1.7:compile
[INFO] +- org.apache.xmlgraphics:fop:jar:0.94:compile
[INFO] | +- org.apache.xmlgraphics:xmlgraphics-commons:jar:1.2:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- org.apache.avalon.framework:avalon-framework-api:jar:4.3.1:compile
[INFO] | \- org.apache.avalon.framework:avalon-framework-impl:jar:4.3.1:compile
[INFO] +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
[INFO] +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
[INFO] +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
[INFO] +- org.apache.xmlgraphics:batik-svggen:jar:1.7:compile
[INFO] +- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
[INFO] \- xml-apis:xml-apis-ext:jar:1.3.04:compile
我已经创建了 jboss-deployment-structure.xml 来尝试排除 log4j(文件是在 oak-parent/META-INF 中创建的:
<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.log4j.logmanager" />
<module name="org.jboss.logmanager.log4j" />
</exclusions>
</deployment>
<sub-deployment name="oak-web.war">
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.log4j.logmanager" />
<module name="org.jboss.logmanager.log4j" />
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
但仍然没有任何帮助。
你们中有人知道这个问题的解决方案吗?与 jboss 5 相比,JBoss 类加载器发生了一些变化。
最佳答案
将 log4j.properties 文件放在资源文件夹下,行:
log4j.loggerFactory=org.owasp.esapi.reference.Log4JLoggerFactory
关于java - jBOSS+ ESAPI java.lang.ClassCastException : org. jboss.logmanager.log4j.BridgeLogger 无法转换为 org.owasp.esapi.Logger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18656369/
我正在使用Visualvm工具并尝试通过jmx建立远程连接。我需要连接到我的远程服务器 ubuntu 14.04。我的 Web 应用程序在 Docker 上运行,jboss/wildfly 在 doc
有人可以详细解释一下吗?在网上搜索但没有得到满意的答案。我正在使用 NLog 登录 csv 文件。 LogManager.GetLogger 方法工作正常,但如果我将使用 LogManager.Get
我有一个运行 Web 应用程序的 WebSphere 应用程序服务器。我从 Eclipse 启动服务器。该应用程序中的主要日志记录框架是 log4j2,但也有一些使用 java.util.loggin
我正在尝试编写一个简单的 log4j2 日志消息。 代码如下所示: package com.company; import java.io.IOException; import org.apache
我已将使用 nuget 的 NLog 添加到项目中并添加了 NLog.config。由于 LogManager.Configuration 为 null,我正在运行调试器并收到 NullReferen
为什么大多数 log4net 示例通过这样做来获取类的记录器: private static ILog logger = LogManager.GetLogger( System.Re
当我执行以下代码时,日志事件仅记录一次。我正在使用 log4j2 记录器。但是当我使用 java.util.logger 时,所有 3 个日志事件均已成功发布。 public class Tes
我知道应该通过 LogManager.getLogger() 创建一个 log4j 记录器实例,它会执行一些反射魔法来检测调用类,因此名称对于特定的日志级别配置很重要。但是,如果我不喜欢手动创建记录器
我正在处理一些遗留代码,其中包含很多代码 private final Logger logger = LogManager.getLogger(ThisClassName.class); 我想知道输入
我有一个重新配置 log4j2 的方法,如下所示: LogManager.shutdown(); // SHUTDOWN log4j2 InputStream in = getClass().
在我的项目中,我得到了一个 NLog.config 文件,但是当我在我的项目中调试 Main 方法时,NLog.LogManager.Configuration 是无效的。 如何确保找到 NLog.c
鉴于此类: class Foo { readonly ILog log; public Foo(ILog log) { this.log = log;
我正在使用 Log4j2,默认记录器实现已在我的项目中广泛使用。我现在需要解析日志消息并替换某些关键字,然后再将它们记录到日志文件中。满足此要求的一个好方法可能是重写记录器方法,例如 info()、e
在我的项目中,我得到了一个 NLog.config 文件,但是当我在我的项目中调试 Main 方法时,NLog.LogManager.Configuration 是无效的。 如何确保找到 NLog.c
我正在尝试使用 log4j 的当前版本 2.0 beta。我已经包含了 log4j 的所有必需的 jar 文件。启动应用程序只会带来: Exception in thread "main" java.
我的 Java 程序在 Linux 上运行,需要在关闭之前关闭一些文件句柄(实际上是设备),因此我在 JVM 上添加了一个关闭 Hook 。但是,我注意到 java.util.logging.LogM
这将是一个冗长的问题,但请耐心等待。我正在尝试为我们的应用程序创建一个日志记录组件,它可以扩展为插入新的日志记录框架(NLog、Log4Net ec)。现在我知道我们已经有了由 Ben Foster
我有带有 log4net 配置的自定义 xml 文件。下面的代码用于配置 log4net。它工作正常。 问题是 LogManager.Getlogger 在不知道配置文件详细信息时如何获取“MyLog
我遇到了一个让我非常困惑的问题。我想尝试使用 JUL 日志记录(JDK 日志记录)做一些事情。我从以下简单程序开始: package biz.ple; import java.util.logging
我希望带有 FileHandler 的记录器使用配置文件中定义的设置。使用 LogManager.readConfiguration(InputStream) 后是否必须使用 Logger.getLo
我是一名优秀的程序员,十分优秀!