Skip to Main Content

org.hibernate.validator.HibernateValidator cannot be cast to javax.validation.spi.ValidationProvider

3031150Oct 5 2015 — edited Dec 9 2015

Hi

Im deploying an .EAR file and providing my own Hibernate validator as a lib. I am also providing the validator api as a lib, so they will match.

In my erar/lib I have :

  • validation-api-1.1.0.Final.jar   ( javax.validation  classes )
  • hibernate-validator-5.1.0.Final.jar    ( org.hibernate.validator classes )

And my weblogic-application.xml file contains the following lines ( among others )

<wls:package-name>antlr.*</wls:package-name>

<wls:package-name>com.fasterxml.classmate.*</wls:package-name>

<wls:package-name>javassist.*</wls:package-name>

<wls:package-name>javax.validation.*</wls:package-name>

<wls:package-name>org.jboss.*</wls:package-name>

<wls:package-name>org.hibernate.*</wls:package-name>

<wls:package-name>org.slf4j.*</wls:package-name>

But still ,Im getting a classcast exception.

    

weblogic.application.ModuleException: java.lang.ClassCastException: org.hibernate.validator.HibernateValidator cannot be cast to javax.validation.spi.ValidationProvider

        at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)

        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)

        at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:175)

        at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:170)

        at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)

        at weblogic.work.ContextWrap.run(ContextWrap.java:40)

        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)

        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)

        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

Caused by: java.lang.ClassCastException: org.hibernate.validator.HibernateValidator cannot be cast to javax.validation.spi.ValidationProvider

        at javax.validation.Validation$DefaultValidationProviderResolver.getValidationProviders(Validation.java:332)

        at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:256)

        at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

        at weblogic.servlet.internal.WebAppServletContext.initContextAttributes(WebAppServletContext.java:455)

        at weblogic.servlet.internal.WebAppServletContext.prepare(WebAppServletContext.java:1074)

        at weblogic.servlet.internal.HttpServer.doPostContextInit(HttpServer.java:428)

        at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:403)

        at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:1274)

        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:770)

        at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:295)

        at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)

        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)

        at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)

        ... 8 more

My weblogic server is 12.1.3.0.0 and the jdk is

java version "1.8.0_51"

Java(TM) SE Runtime Environment (build 1.8.0_51-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

Any suggestions much appreciated

Thank you

Comments
Post Details
Added on Oct 5 2015
2 comments
2,648 views