gpt4 book ai didi

JBoss EAP 5.1.2 上的 Hibernate4 日志记录错误

转载 作者:行者123 更新时间:2023-12-03 06:44:02 26 4
gpt4 key购买 nike

我希望也许有人以前遇到过这个问题并可以提供建议。我正在 Hibernate 4 和 Spring 3 上编写一个应用程序。这是我的依赖关系树:

+- javax.servlet:servlet-api:jar:2.5:provided
+- org.springframework:spring-webmvc:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-asm:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-beans:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-context:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-context-support:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-core:jar:3.1.3.RELEASE:compile
| +- org.springframework:spring-expression:jar:3.1.3.RELEASE:compile
| \- org.springframework:spring-web:jar:3.1.3.RELEASE:compile
+- org.springframework:spring-orm:jar:3.1.3.RELEASE:compile
+- org.springframework:spring-jdbc:jar:3.1.3.RELEASE:compile
+- org.springframework:spring-tx:jar:3.1.3.RELEASE:compile
| +- aopalliance:aopalliance:jar:1.0:compile
| \- org.springframework:spring-aop:jar:3.1.3.RELEASE:compile
+- org.springframework.security:spring-security-core:jar:3.1.3.RELEASE:compile
+- org.springframework.security:spring-security-web:jar:3.1.3.RELEASE:compile
+- org.springframework.security:spring-security-config:jar:3.1.3.RELEASE:compile
+- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
+- org.hibernate:hibernate-core:jar:4.1.8.Final:compile
| +- antlr:antlr:jar:2.7.7:compile
| +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
| +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
| +- dom4j:dom4j:jar:1.6.1:compile
| +- org.javassist:javassist:jar:3.15.0-GA:compile
| \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
+- org.hibernate:hibernate-entitymanager:jar:4.1.8.Final:compile
+- org.hibernate:hibernate-validator:jar:4.3.0.Final:compile
+- javax.validation:validation-api:jar:1.0.0.GA:compile
+- commons-lang:commons-lang:jar:2.4:compile
+- commons-beanutils:commons-beanutils:jar:1.8.3:compile
+- commons-beanutils:commons-beanutils-core:jar:1.8.3:compile
+- commons-beanutils:commons-beanutils-bean-collections:jar:1.8.3:compile
+- commons-logging:commons-logging:jar:1.1.1:compile
+- org.aspectj:aspectjrt:jar:1.7.1:compile
+- org.aspectj:aspectjweaver:jar:1.7.1:compile
+- log4j:log4j:jar:1.2.17:compile
+- javax.servlet:jstl:jar:1.2:compile
+- cglib:cglib:jar:2.2.2:compile
| \- asm:asm:jar:3.3.1:compile
+- org.slf4j:slf4j-log4j12:jar:1.7.2:compile
+- org.slf4j:slf4j-api:jar:1.7.2:compile
+- junit:junit:jar:4.10:compile
| \- org.hamcrest:hamcrest-core:jar:1.1:compile
+- org.dbunit:dbunit:jar:2.4.9:test
| \- commons-collections:commons-collections:jar:3.2.1:test
+- org.apache.derby:derby:jar:10.9.1.0:compile
+- org.springframework:spring-test:jar:3.1.3.RELEASE:test
+- org.seleniumhq.selenium:selenium-java:jar:2.26.0:test
| +- org.seleniumhq.selenium:selenium-android-driver:jar:2.26.0:test
| \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.26.0:test
| | +- cglib:cglib-nodep:jar:2.1_3:test
| | +- org.json:json:jar:20080701:test
| | \- com.google.guava:guava:jar:13.0.1:test
| +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.26.0:test
| +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.26.0:test
| | +- org.seleniumhq.selenium:selenium-api:jar:2.26.0:test
| | +- net.sourceforge.htmlunit:htmlunit:jar:2.10:test
| | | +- xalan:xalan:jar:2.7.1:test
| | | | \- xalan:serializer:jar:2.7.1:test
| | | +- org.apache.commons:commons-lang3:jar:3.1:test
| | | +- org.apache.httpcomponents:httpmime:jar:4.2.1:test
| | | +- commons-codec:commons-codec:jar:1.6:test
| | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.10:test
| | | +- xerces:xercesImpl:jar:2.9.1:test
| | | | \- xml-apis:xml-apis:jar:1.3.04:test
| | | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.16:test
| | | \- net.sourceforge.cssparser:cssparser:jar:0.9.7:test
| | | \- org.w3c.css:sac:jar:1.3:test
| | \- org.apache.httpcomponents:httpclient:jar:4.2.1:test
| | \- org.apache.httpcomponents:httpcore:jar:4.2.1:test
| +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.26.0:test
| | +- commons-io:commons-io:jar:2.2:test
| | \- org.apache.commons:commons-exec:jar:1.1:test
| +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.26.0:test
| | +- net.java.dev.jna:jna:jar:3.4.0:test
| | \- net.java.dev.jna:platform:jar:3.4.0:test
| +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.26.0:test
| +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.26.0:test
| +- org.seleniumhq.selenium:selenium-support:jar:2.26.0:test
| \- org.webbitserver:webbit:jar:0.4.14:test
| \- io.netty:netty:jar:3.5.2.Final:test

问题是 Hibernate 对 jboss-logging.jar 的依赖。当我将其部署到 JBoss 5.1.2 Enterprise Server 时,出现以下错误:

上下文初始化失败
org.springframework.beans.factory.BeanCreationException:创建 ServletContext 资源中定义的名为“org.springframework.validation.beanvalidation.MethodValidationPostProcessor#0”的 bean 时出错[/WEB-INF/classes/spring/servlet-context.xml]:无法设置 bean 属性“validator”时解析对 bean“validator”的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建在ServletContext资源[/WEB-INF/classes/spring/application-context.xml]中定义的名为“validator”的bean时出错:设置属性值时出错;嵌套异常是 org.springframework.beans.PropertyBatchUpdateException;嵌套的 PropertyAccessExceptions (1) 是:
PropertyAccessException 1:org.springframework.beans.MethodInitationException:属性“validationMessageSource”引发异常;嵌套异常是 java.lang.NoSuchMethodError: org.jboss.logmanager.LogContext.getAttachment(Ljava/lang/String;Lorg/jboss/logmanager/Logger$AttachmentKeyLjava/lang/Object;
在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)

显然与 jboss-logging.jar 和 EAP 服务器存在一些不兼容性。我尝试从 Hibernate 依赖项中排除该 jar,但随后遇到了此错误:

由以下原因引起:java.lang.ClassNotFoundException:org.jboss.logging.BasicLogger
在 java.net.URLClassLoader$1.run(URLClassLoader.java:202)
在 java.security.AccessController.doPrivileged( native 方法)
在 java.net.URLClassLoader.findClass(URLClassLoader.java:190)
在 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
在 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
在 java.lang.ClassLoader.loadClass(ClassLoader.java:247)
在 java.lang.Class.forName0( native 方法)
在 java.lang.Class.forName(Class.java:247)
在 org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:311)
在 org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1163)
在 org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:862)
在 org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassLoader.java:502)
在 org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:447)
在 java.lang.ClassLoader.loadClass(ClassLoader.java:247)

我没有找到太多可以告诉我如何解决这个依赖问题的信息,所以我希望有人知道如何做到这一点。

谢谢!

最佳答案

嗯,在与同事合作时,我们找到了针对 JBoss 和 Hibernate 4 所遇到问题的解决方法。事实证明,如果我们明确告诉 JBoss EAP 我们的日志记录实现 (-D org.jboss.logging.provider =slf4j),它不会扫描日志记录实现,也没有我看到的 NoSuchMethod 异常。因此,除了设置一个系统属性之外,我们不必进行任何其他更改。

关于JBoss EAP 5.1.2 上的 Hibernate4 日志记录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13886682/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com