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

3

18

I have a big problem with Hibernate (use with seam) on weblogic 10.3.

When I publish my application, I get this error:

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)

I read on the web that this error can come from compatibily between hibernate jar. But, I read the matrix and I have the good jar with good version (hibernate-validator 3.1, hibernate-search 3.1, hibernate core 3.3.0)

I haven't idea to resolve this problem. Someone can help me ?

Thanks.

PS: Here is the full stack trace:

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)
    > 
Pettigrew answered 27/7, 2010 at 14:0 Comment(1)
I tried this, many time ;) and nothing has changedPettigrew
I
13

It happens when you use newer version of Hibernate in your application while pre-packaged hibernate jars (that come with jboss server) are of older version. For details on how to properly upgrade your application server's hibernate jars, read this.

Incur answered 25/11, 2010 at 19:52 Comment(4)
brilliant! How can you know that?Enterogastrone
Because i've gone through this pain.Incur
just a little question, do you know the best way to avoid conflict? It seems the error when conflict happens doesn't give much inFormationEnterogastrone
These kind of issues do arise when we use various frameworks together. But the art of guess-work comes with experience :)Incur
P
12

I solved this problem adding this two properties in my hibernate config.

<property name="hibernate.validator.apply_to_ddl">false</property> 
<property name="hibernate.validator.autoregister_listeners">false</property>
Protrusile answered 13/2, 2012 at 22:34 Comment(4)
That's it !! Worked for me with Hibernate 3.6.0.Final and JBoss 4.2.1.GA. Many many thanks !!Barbarous
You saved my day... how did you found this out ?Woodie
is this hibernate config file is present in server ?Raman
No, the hibernate config should be in your resources folder.Spitfire
R
1

If you happen to hit this issue on Weblogic Server, I solved this problem on Weblogic 10.3.0.0 with placing the package org.hibernate to prefer-application-packages at weblogic-application.xml in the EAR:

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

With a properly built application this will prevent Weblogic Server loading the older, conflicting library from the server's classpath and make it work as expected.

Ran answered 10/3, 2014 at 20:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.