Ich erstelle eine Webanwendung, die eine Verbindung zu einer HANA-Datenbank mit Spring und Hibernate auf einem Tomcat 8-Server der SAP Cloud Platform herstellt. Es läuft ohne Probleme bis auf einen Fehler, den ich beim Start des Servers erhalten:Web App mit HANA, SLF4J erhalten: Klassenpfad enthält mehrere SLF4J-Bindungen
13:59:08.662 [localhost-startStop-1] ERROR org.slf4j.helpers.Util - SLF4J: Class path contains multiple SLF4J bindings.
13:59:08.662 [localhost-startStop-1] ERROR org.slf4j.helpers.Util - SLF4J: Found binding in [jar:file:/C:/neo-java-web-sdk-3.31.17.3/repository/.archive/bin/logback-classic.jar!/org/slf4j/impl/StaticLoggerBinder.class]
13:59:08.662 [localhost-startStop-1] ERROR org.slf4j.helpers.Util - SLF4J: Found binding in [jar:file:/C:/Eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/rbuswebapp/WEB-INF/lib/slf4j-log4j12-1.7.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
13:59:08.662 [localhost-startStop-1] ERROR org.slf4j.helpers.Util - SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
13:59:08.662 [localhost-startStop-1] ERROR org.slf4j.helpers.Util - SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Denn was konnte ich auf andere Stellen finden, das Problem ist, dass es widersprüchliche .jar-Dateien zwischen meinem Maven Abhängigkeiten und meinem Server Runtime , aber ich verstehe nicht vollständig, wie man die korrekte Abhängigkeit ausschließt oder die richtige Bibliothek benutzt.
Dies ist meine pom.xml-Datei:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rbus.hana</groupId>
<artifactId>rbuswebapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>2.0.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Need this for json to/from object -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/java/main</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>${basedir}/src/java/webapp</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
Dies ist die Ausgabe für mvn Abhängigkeit: Baum:
mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rbuswebapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ rbuswebapp ---
[INFO] com.rbus.hana:rbuswebapp:war:0.0.1-SNAPSHOT
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.6.4:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.4:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.4:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.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:4.0.5.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:4.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.2.4.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.9.2.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.11.2.RELEASE:compile
[INFO] | +- org.springframework:spring-orm:jar:4.2.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.2.4.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-tx:jar:4.2.4.RELEASE:compile
[INFO] | \- org.aspectj:aspectjrt:jar:1.8.7:compile
[INFO] +- javax.servlet:jstl:jar:1.2:provided
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.13:runtime
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.13:runtime
[INFO] \- log4j:log4j:jar:1.2.17:runtime
Jede Idee, wie diese zu lösen?
Vielen Dank im Voraus.