Resolve multiple SLF4J bindings in maven project - java

This is a question sounds like bunch of similar questions on SE sites, so I should be quite verbose to make my question clear. So, here is project's minimal pom.xml:
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.shabunc.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
Here is the dependency tree produced by maven.
mvn dependency:tree -Dverbose -Dincludes=org.slf4j:
[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.shabunc:logdebug:jar:1.0-SNAPSHOT
[INFO] \- ch.qos.logback:logback-classic:jar:1.0.6:compile
[INFO] \- org.slf4j:slf4j-api:jar:1.6.5:compile
Now, let's remove exclusion and check dependencies again. We'll get:
[INFO] org.shabunc:logdebug:jar:1.0-SNAPSHOT
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.6:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.6.5:compile
[INFO] \- org.codehaus.gmaven.runtime:gmaven-runtime-1.7:jar:1.3:compile
[INFO] +- (org.slf4j:slf4j-api:jar:1.5.10:compile - omitted for conflict with 1.6.5)
[INFO] +- org.codehaus.gmaven.feature:gmaven-feature-support:jar:1.3:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.5.10:compile - omitted for conflict with 1.6.5)
[INFO] \- org.codehaus.gmaven.runtime:gmaven-runtime-support:jar:1.3:compile
[INFO] +- (org.slf4j:slf4j-api:jar:1.5.10:compile - omitted for conflict with 1.6.5)
[INFO] \- org.sonatype.gshell:gshell-io:jar:2.0:compile
[INFO] \- org.sonatype.gossip:gossip:jar:1.0:compile
[INFO] \- (org.slf4j:slf4j-api:jar:1.5.8:compile - omitted for conflict with 1.6.5)
So, as we can see, everything works as expected, and conflicting dependency is actually get excluded. But the thing is that even with dependency excluded I still get following message while compiling and calling mvn exec:java:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/shabunc/.m2/repository/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/shabunc/.m2/repository/org/sonatype/gossip/gossip/1.0/gossip-1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
The question is: Why I still see this warning and what exactly should be done to make only one version of slf4j reachable during execution?

Your problem isn't getting two copies of the SLF4J API, it's getting two different SLF4J implementations. You need to exclude Gossip, not the API. That means something like:
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>org.sonatype.gossip</groupId>
<artifactId>gossip</artifactId>
</exclusion>
</exclusions>
</dependency>
The Gossip dependency is declared by gshell-io; hopefully, it doesn't actually need Gossip, it just needs an SLF4J SLF4J, which you are supplying in the shape of Logback.

All you need to do is add something like this
compile "org.sonatype.gossip:gossip:1.0" {
exclude module:'slf4j-jcl'
exclude module:'slf4j-log4j12'
}

I guess you need to play with scope of dependencies, see: http://www.mojohaus.org/exec-maven-plugin/java-mojo.html
classpathScope -
defines the scope of the classpath passed to the plugin. Set to compile,test,runtime or system depending on your needs.

Related

How to bypass json-smart:2.3-SNAPSHOT imported

I am building a Java Maven Project and I have a dependency "net.minidev.json-smart:2.3-SNAPSHOT" imported in my package hbase 2.4.9 with another dependency and this displays a warning and Jenkins takes 1 or 2 minutes to resolve only this dependency.
the dependency tree is the following :
org.apache.hbase:hbase-server:2.4.9 -> org.apache.hadoop:hadoop-auth:2.10 -> com.nimbusds:nimbus-jose-jwt:4.41.1 -> net.minidev:json-smart:2.3-SNAPSHOT)
But when I exclude hadoop-auth 2.10 to use latest ...
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>2.4.9</version>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<version>3.3.2</version>
</dependency>
I have this dependency-tree:
[INFO] +- org.apache.hadoop:hadoop-auth:jar:3.3.2:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] | +- com.nimbusds:nimbus-jose-jwt:jar:9.8.1:compile
[INFO] | | \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | +- net.minidev:json-smart:jar:2.4.7:compile
[INFO] | | \- net.minidev:accessors-smart:jar:2.4.7:compile
[INFO] | | \- org.ow2.asm:asm:jar:9.1:compile
and when I build with mvn -U clean install I have this message:
[WARNING] The POM for net.minidev:json-smart:jar:2.3-SNAPSHOT is missing, no dependency information available
The debug logs do not say anything more
how can I completely remove it ?
Thanks a lot for your help
In my project, we had to exclude com.nimbusds:nimbus-jose-jwt from hadoop-auth because of an odd transitive dependency. This ticket: https://issues.apache.org/jira/browse/HADOOP-14903 appears to relate to the problem. We are not using this updated version. Based on your error, maybe this "fix" didn't work.

maven still lists excluded dependency

I have a maven project with these dependencies:
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
<exclusions>
<exclusion>
<groupId>org.slf4</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
If I run mvn tree it still shows the excluded artifact:
$ mvn dependency:tree
...
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # testArtifact ---
[INFO] testGroup:testArtifact:jar:1.0-SNAPSHOT
[INFO] \- org.postgresql:postgresql:jar:9.4-1200-jdbc41:compile
[INFO] +- com.github.dblock.waffle:waffle-jna:jar:1.7:runtime
[INFO] | +- net.java.dev.jna:jna:jar:4.1.0:runtime
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.1.0:runtime
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.7:runtime
[INFO] | \- com.google.guava:guava:jar:18.0:runtime
[INFO] \- org.slf4j:slf4j-simple:jar:1.7.7:runtime ** <--- BAD ONE
And if I run things like dependency:copy-dependencies or the shaded jar plugin, they all pull in the unwanted jar.
Am I missing something?
Using maven 3.6.0
The groupId is incorrect. Should be org.slf4j instead of org.slf4 (the j is missing).

Confusion regarding jdk.tools in Eclipse/Maven

I have a project that at one point had these lines about jdk.tools
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<version>1.8.0</version>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
On my Eclipse, removing these lines would gave me an error of
"Missing artifact jdk.tools:jdk.tools:jar:1.8".
But my colleague used the same pom.xml (without those lines) and she did not see
the error.
Also, on a UNIX machine I could maven build without needing
those lines (this is expected, because the scope has been system).
The dependency tree related to this artifact is this:
[INFO] +- org.apache.hadoop:hadoop-common:jar:2.7.3:compile
[INFO] | +- org.apache.hadoop:hadoop-annotations:jar:2.7.3:compile
[INFO] | | \- jdk.tools:jdk.tools:jar:1.8:system

Transitive dependencies coming from provided scope dependency

I have added vaadin-client-compiler dependency as a provided scope dependency in my vaadin application pom.
As I have read, provided dependency is not transitive, so the dependencies of vaadin-client-compiler should become dependencies of my webapp.
But, I found dependencies of vaadin-client-compiler (commons-lang3-3.1.jar) inside my WEB-INF/lib directory.
Also, these dependencies are shown in mvn dependency:tree output as well.
[INFO] | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | \- javax.validation:validation-api:jar:sources:1.0.0.GA:compile
[INFO] +- com.vaadin:vaadin-client-compiler:jar:7.6.4:provided
[INFO] | +- com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
[INFO] | | \- com.yahoo.platform.yui:yuicompressor:jar:2.4.8:compile
[INFO] | | \- rhino:js:jar:1.7R2:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.2:compile
................................................
.................................................
[INFO] | +- commons-codec:commons-codec:jar:1.8:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
Question: Why did dependencies of a provided scope dependency became dependencies of my webapp?
Indeed, according to official Maven Dependency Mediation, the provided scope would bring in its transitive dependencies as following:
Transitive dependencies in compile scope > would be fetched as provided scope
Transitive dependencies in provided scope > ignored
Transitive dependencies in runtime scope > would be fetched as provided scope
Transitive dependencies in test scope > ignored
Hence, transitive dependencies of a provided dependency would either be ignored or be imported as provided as well and as such no part of the final packaged war.
Adding the following dependency to a sample project:
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>7.6.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
Would lead to the following, executing:
mvn dependency:tree -Dincludes=com.vaadin
We would have as part of the output:
[INFO] \- com.vaadin:vaadin-client-compiler:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-shared:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-server:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-client:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-sass-compiler:jar:0.9.13:provided
[INFO] \- com.vaadin:vaadin-client-compiler-deps:jar:1.2.0:provided
Perfectly consistent with the documentation.
However, if we add to the pom.xml file the following:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>7.6.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
Note: we are overriding the scope of one of its transitive dependencies to compile.
Re-executing the previous command we would have:
[INFO] \- com.vaadin:vaadin-client-compiler:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-shared:jar:7.6.4:compile
[INFO] +- com.vaadin:vaadin-server:jar:7.6.4:compile
[INFO] +- com.vaadin:vaadin-client:jar:7.6.4:provided
[INFO] +- com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
[INFO] \- com.vaadin:vaadin-client-compiler-deps:jar:1.2.0:provided
Which means: the transitive dependency vaadin-server is still brought in by vaadin-client-compiler, but its scope is now at compile as per dependency management.
Hence, you should:
Check whether your pom.xml defines any dependencyManagement section
Check whether your parent pom or any pom in the hierarchy would do so, executing mvn help:effective-pom -Doutput=full-pom.xml would definitely help
Check whether any active profile would also influence the build, executing mvn help:active-profiles would also help
The "non-transitivity" of provided dependencies is tricky. It only means that the provided dependencies of your dependencies are not pulled. On the other hand, compile dependencies of provided dependencies are pulled (as you have experienced). The full truth is in the table shown in:
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf

I have a problem when I deploy a webapp with hibernate 5
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:759) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:490) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 23 more
With Hibernate 4 everything is OK.
I had a look at the class NamedQueryRepository at line 149. That class is calling the method debugf in this way
log.debugf( "Checking %s named HQL queries", namedQueryDefinitionMap.size() );
I can not see the problem
Here is my dependency tree
[INFO] ------------------------------------------------------------------------
[INFO] Building app Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # app---
[INFO] +- org.springframework:spring-aspects:jar:4.1.7.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- org.springframework:spring-tx:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.1.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.1.7.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.1.7.RELEASE:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.0.0.CR2:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.0.CR2:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | \- org.jboss:jandex:jar:1.2.2.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.0.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:5.0.0.CR2:compile
[INFO] | \- com.mchange:c3p0:jar:0.9.2.1:compile
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.3.4:compile
[INFO] +- org.primefaces:primefaces:jar:5.2.RC3:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.2:compile
[INFO] \- net.sourceforge.jtds:jtds:jar:1.2.8:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
In glass fish This problem is caused by collision with dependencies of glassfish modules. If you check lib list in glassfishdir/modules you would see boss-logging.jar. You can delete it and replace with latest such as org.jboss.logging:jboss-logging:jar:3.3.0.Final. It worked for me.
In my case the culprit was the Jersey bean validator artifact.
One of its dependencies, bean-validation-2.4.0-b06.jar contains Jboss logging classes, for some reason.
I had to exclude the jersey-bean-validation and bean-validator artifacts from the spring-boot-starter-jersey dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
<exclusions>
<exclusion>
<artifactId>jersey-bean-validation</artifactId>
<groupId>org.glassfish.jersey.ext</groupId>
</exclusion>
<exclusion>
<artifactId>bean-validator</artifactId>
<groupId>org.glassfish.hk2.external</groupId>
</exclusion>
</exclusions>
</dependency>
EDIT: As of spring-boot 1.3.0, this is fixed and the exclusions above are not necessary anymore.
Try upgrading jboss-logging.jar to a more recent version. The one you are using does not seem to be compatible with Hibernate 5.
I also faced with such kind of problem when deployed ear on weblogic server.
Apparently, weblogic also use jboss logging system, and use old version of it.
My fix:
Add "weblogic-application.xml" to META-INF folder with this content:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
<prefer-application-packages>
<package-name>org.jboss.logging.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/jboss/logging/Logger.class</resource-name>
</prefer-application-resources>
</weblogic-application>
I was getting the same error using jersey-spring-3 and hibernate 5.0.1.Final.Excluding org.glassfish.hk2.external:bean-validator from jersy-spring-3 and adding org.glassfish.jersey.ext:jersey-bean-validation worked for me.Here is my final dependency.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.22.2</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.22.2</version>
</dependency>
from :
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.22.2</version>
</dependency>
In all probability you've got an outdated JBoss Logging JAR on the application's classpath. The ...f methods are a relatively new addition to the Logger API. Hibernate 5 directly depends on Logging version 3.3.0, but it is possible that somehwere in your pom.xml you have an overriding dependency to an earlier version. Another possibility is that you are deploying to a JBoss container where the logging API is container-provided. Then you may need to upgrade the JBoss server, or introduce a workaround to prefer classes contributed by your application.
Check my answer at NoSuchMethodError: org.jboss.logging.Logger.debugf
Even I was having issues after upgrading to Hibernate 5.2 , and the culprit was "jboss-logging 3.3.0.Final" which I see present in your dependencies too.
Following the steps on the link shared in the answer, you can reduce the dependency jboss-logging to 3.2 level which has the required function.
In my case the issue was caused by an older version of jboss-logging coming as transitive dependency from hibernate-ehcache, which I found by looking into the maven dependencies tree. I solved it by adding the exclusion:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
I had the same error, it is solved by
First add the dependency of jboss logging jar as follows
<!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
And if the error still exists then add following exlcusion to the maven dependency.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.12</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2</artifactId>
</exclusion>
</exclusions>
</dependency>
After doing these two things, it is working fine for me.I hope it will work for
you also.
Error that i got was "
Application run failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
:::
:::
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V"
i deleted the jboss-logging folder <.m2\repository\org\jboss\logging\jboss-logging> and restarted the jboss server.
The jars got addedback and the error was gone. (i got some other error after that, but atleast this error was gone)
I too faced this issue. This is what fixed it for me
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
I have the same problen with spring4.2.1+hibernate5.0.2+jersey2.23.1.
My solution is the same: Excluding org.glassfish.hk2.external:bean-validator from jersy-spring-3 and adding org.glassfish.jersey.ext:jersey-bean-validation.
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.23.1</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.23.1</version>
</dependency>
In my product environment, just delete bean-validator-2.4.0-b34.jar and add jersey-bean-validation-2.23.1.jar
This can be caused if a dependency includes
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.2</version>
</dependency>
Exclude it using an exclusions element in dependency.
JBoss 6.1+??
I set org.jboss.logging for jboss-logging-3.3.0.Final-redhat-1.jar in modules of jboss.
Its works for me.
Att.,
You can use Eclipse to find out which jar is causing the problem:
Setup a project with all your jars on the classpath
Navigate -> Open Type...
Type in org.jboss.logging.Logger
This will give you a list of jars which include the class. One of these is out of date and needs to be excluded (refer to other answers for variations on this).
My error was caused by GlassFish and I fixed it by configuring glassfish-web.xml:
The Java Servlet specification recommends that a web module's class loader look in the local class loader before delegating to its parent. You can make this class loader follow the delegation inversion model in the Servlet specification by setting delegate="false" in the class-loader element of the glassfish-web.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<context-root>/myContext</context-root>
<!–– Change this line "true" to "false" -->
<class-loader delegate="false"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

Categories

Resources