Hello,
I've some problems with hibernate-validation 4.1.
I've change pom dependency from hibernate-validation 4.0.1 to 4.1 and now I can't start my application on glassfish 3.0.1 (don't know how about any other server) because server throw following error:
Code:
org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageInterpolator' defined in ServletContext resource [/WEB-INF/config/spring-messages.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.hibernate.validator.util.LoggerFactory.make()Lorg/slf4j/Logger;" the class loader (instance of org/glassfish/web/loader/WebappClassLoader) of the current class, org/hibernate/validator/resourceloading/PlatformResourceBundleLocator, and the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) for resolved class, org/hibernate/validator/util/LoggerFactory, have different Class objects for the type org/slf4j/Logger used in the signature
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5289)
at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
...
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.hibernate.validator.util.LoggerFactory.make()Lorg/slf4j/Logger;" the class loader (instance of org/glassfish/web/loader/WebappClassLoader) of the current class, org/hibernate/validator/resourceloading/PlatformResourceBundleLocator, and the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) for resolved class, org/hibernate/validator/util/LoggerFactory, have different Class objects for the type org/slf4j/Logger used in the signature
at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.<clinit>(PlatformResourceBundleLocator.java:38)
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:100)
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 57 more
It seems, problem is in implementation of the org/hibernate/validator/util/LoggerFactory that cause two different ways for loading sl4j-api, but I can't imagine how to resolve it
Logger.class.getClassLoader().getClass() in old revision of application (witout hibernate-validation 4.1) returns org/glassfish/web/loader/WebappClassLoader
If you have any idea about it, please help me
Thanks
Here is fragment from my pom.xml
Code:
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.2.Final</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Beta2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Logging -->
<properties>
<!-- slf4jversion>1.5.6</slf4jversion-->
<!-- slf4jversion>1.5.8</slf4jversion-->
<slf4jversion>1.6.1</slf4jversion>
</properties>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jversion}</version>
</dependency>
<dependency>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
<version>${slf4jversion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jversion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>compile</scope>
</dependency>