NutzCN Logo
问答 slf4j 问题,jar包冲突了吗?
发布于 2461天前 作者 苍蓝猛兽 3149 次浏览 复制 上一个帖子 下一个帖子
标签:

问题日志

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/noc/nocserver/./lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/noc/nocserver/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

lib下slf4j相关包

./jcl-over-slf4j-1.7.25.jar
./jul-to-slf4j-1.7.25.jar
./log4j-over-slf4j-1.7.25.jar
./slf4j-api-1.7.25.jar

貌似也没有冲突呀

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.hoperun</groupId>
	<artifactId>noc-server</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>noc-server</name>
	<description>noc-server project for Spring Boot</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.9.RELEASE</version>
		<relativePath/>
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<druid.version>1.1.0</druid.version>
		<mybatis.version>1.2.0</mybatis.version>
		<nutz.version>1.r.63</nutz.version>
		<shiro.version>1.2.4</shiro.version>
		<fastjson.version>1.2.46</fastjson.version>
		<pageHelper.version>4.1.1</pageHelper.version>
		<guava.version>20.0</guava.version>
		<java.version>1.7</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
			<!-- 排除tomcat -->
			<exclusions>
				<exclusion>
		            <groupId>org.springframework.boot</groupId>
		            <artifactId>spring-boot-starter-tomcat</artifactId>
		        </exclusion>
            </exclusions>
		</dependency>
		
		<!-- 热部署 -->
		<dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-devtools</artifactId>
           <optional>true</optional>
      	</dependency>
      	
      	<!-- aop -->
      	<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-aop</artifactId>
		</dependency>
		
		<!-- mysql驱动 -->
		<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        
		<!-- druid -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>druid-spring-boot-starter</artifactId>
			<version>${druid.version}</version>
		</dependency>
		
		<!-- mybatis -->
		<dependency>  
      		<groupId>org.mybatis.spring.boot</groupId>  
      		<artifactId>mybatis-spring-boot-starter</artifactId> 
      		<version>${mybatis.version}</version> 
    	</dependency>
    	
    	<!-- 分页插件  -->  
	    <dependency>  
	      <groupId>com.github.pagehelper</groupId>  
	      <artifactId>pagehelper</artifactId>  
	      <version>${pageHelper.version}</version>  
	    </dependency>
    	
    	<!-- nutz -->
		<dependency>  
      		<groupId>org.nutz</groupId>  
      		<artifactId>nutz</artifactId> 
      		<version>${nutz.version}</version> 
    	</dependency>
    	
    	<!-- shiro -->
    	<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-core</artifactId>
			<version>${shiro.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.shiro</groupId>
			<artifactId>shiro-spring</artifactId>
			<version>${shiro.version}</version>
		</dependency>
		
		<!-- fastjson -->
		<dependency>
		    <groupId>com.alibaba</groupId>
		    <artifactId>fastjson</artifactId>
		    <version>${fastjson.version}</version>
		</dependency>
		<!-- guava -->
		<dependency>
		    <groupId>com.google.guava</groupId>
		    <artifactId>guava</artifactId>
		    <version>${guava.version}</version>
		</dependency>
		
		<!-- rabbitmq  -->
		<dependency>
	        <groupId>org.springframework.boot</groupId>
	        <artifactId>spring-boot-starter-amqp</artifactId>
	    </dependency>
	    <!-- mongodb -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-mongodb</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		<!-- test -->
		<dependency>
		    <groupId>org.springframework.boot</groupId>
		    <artifactId>spring-boot-starter-test</artifactId>
		    <scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>target/lib</outputDirectory>
							<excludeTransitive>false</excludeTransitive>
							<stripVersion>false</stripVersion>
							<includeScope>runtime</includeScope>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<layout>ZIP</layout>
					<includes>
						<include>
							<groupId>non-exists</groupId>
							<artifactId>non-exists</artifactId>
						</include>
					</includes>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
						<configuration>
							<classifier>classes</classifier>
							<attach>false</attach>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>**/*.properties</exclude>
						<exclude>*.xml</exclude>
						<exclude>**/*.yml</exclude>
						<exclude>static/**</exclude>
						<exclude>templates/**</exclude>
					</excludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<property name="dist">target/distribution</property>
								<property name="dist-tmp">target/distribution/tmp</property>
								<property name="app-name">${project.artifactId}-${project.version}</property>
								<mkdir dir="${dist-tmp}" />
								<copy file="target/${app-name}.jar" tofile="${dist-tmp}/${app-name}.jar" />
								<unzip src="${dist-tmp}/${app-name}.jar" dest="${dist-tmp}" />
								<delete file="${dist-tmp}/${app-name}.jar" />

								<move file="target/${app-name}-classes.jar" tofile="${dist}/noc-server.jar" />
								<move todir="${dist}/lib">
									<fileset dir="target/lib" />
								</move>

								<delete dir="${dist-tmp}" />

								<copy todir="${dist}">
									<fileset dir="target/classes">
										<include name="**/*.properties" />
										<include name="**/*.xml" />
										<include name="**/*.yml" />
									</fileset>
								</copy>
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- 解决资源文件的编码问题 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>


</project>

WHY

1 回复

classpath设置得有问题吧

SLF4J: Found binding in [jar:file:/home/noc/nocserver/./lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/noc/nocserver/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
添加回复
请先登陆
回到顶部