java.lang.NoSuchMethodException:org.hibernate.validator.ClassValidator Seam weblogic 10.3

问题描述 投票:0回答:4

我在 weblogic 10.3 上使用 Hibernate(与 seam 一起使用)有一个大问题。

当我发布我的应用程序时,我收到此错误:

java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)

我在网上看到这个错误可能来自hibernate jar之间的兼容性。但是,我阅读了矩阵,并且得到了具有良好版本的好罐子(hibernate-validator 3.1、hibernate-search 3.1、hibernate core 3.3.0)

我不知道如何解决这个问题。有人可以帮助我吗?

谢谢。

PS:这是完整的堆栈跟踪:

weblogic.application.ModuleException: 
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1373)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106)
        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:143)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
        at java.lang.Class.getConstructor0(Class.java:2706)
        at java.lang.Class.getDeclaredConstructor(Class.java:1985)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:352)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:159)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
        at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:81)
        at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
        at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
        at org.jboss.seam.Component.callComponentMethod(Component.java:2257)
        at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
        at org.jboss.seam.Component.newInstance(Component.java:2132)
        at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
        at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
        at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:116)
        at org.jboss.seam.init.Initialization.init(Initialization.java:740)
        at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:465)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(Unknown Source)
        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1785)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3005)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106)
        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:143)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    > 
java hibernate seam weblogic-10.x
4个回答
13
投票

当您在应用程序中使用较新版本的 Hibernate,而预打包的 hibernate jar(与 jboss 服务器一起提供)是旧版本时,就会发生这种情况。有关如何正确升级应用程序服务器的 hibernate jar 的详细信息,请阅读 this


12
投票

我解决了这个问题,在我的休眠配置中添加了这两个属性。

<property name="hibernate.validator.apply_to_ddl">false</property> 
<property name="hibernate.validator.autoregister_listeners">false</property>

1
投票

如果您碰巧在 Weblogic Server 上遇到此问题,我在 Weblogic 10.3.0.0 上解决了此问题,方法是将包

org.hibernate
放置到 EAR 中
prefer-application-packages
处的
weblogic-application.xml

<weblogic-application>
   <prefer-application-packages>
      <package-name>org.hibernate.*</package-name>
   </prefer-application-packages>
</weblogic-application>

通过正确构建的应用程序,这将阻止 Weblogic Server 从服务器的类路径加载旧的、冲突的库,并使其按预期工作。


0
投票

我在下面的行遇到错误

导入 weblogic.diagnostics.harvester.internal.Validators.ValidationError;

任何人请指导我。

© www.soinside.com 2019 - 2024. All rights reserved.