web-dev-qa-db-ja.com

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

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)

このエラーは休止状態のjar間の互換性から発生する可能性があることをWebで読みました。しかし、私はマトリックスを読み、良いバージョンの良い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)
    > 
18
Kiva

これは、アプリケーションで新しいバージョンのHibernateを使用しているときに、事前にパッケージ化されたHibernate jar(jbossサーバーに付属)が古いバージョンである場合に発生します。アプリケーションサーバーの休止状態のjarを適切にアップグレードする方法の詳細については、 this を参照してください。

13
user18943

この2つのプロパティを休止状態の構成に追加して、この問題を解決しました。

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

Weblogic Serverでこの問題が発生した場合は、EARのorg.hibernateにパッケージprefer-application-packagesweblogic-application.xmlに配置することで、Weblogic10.3.0.0でこの問題を解決しました。

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

適切に構築されたアプリケーションを使用すると、Weblogic Serverがサーバーのクラスパスから古い競合するライブラリをロードするのを防ぎ、期待どおりに機能するようになります。

1
Kristof Jozsa