在我的log4j.properties中,我有以下一行:
log4j.appender.queue=org.springframework.amqp.log4j.AmqpAppender
在我的pom.xml中,我有以下与弹簧相关的内容:
<!-- Spring dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
当我启动应用程序时,我看到以下异常:
log4j:ERROR Could not instantiate class [org.springframework.amqp.log4j.AmqpAppender].
java.lang.ClassNotFoundException: org.springframework.amqp.log4j.AmqpAppender
...
使用org.springframework.amqp.log4j.AmqpAppender需要什么依赖?
答案 0 :(得分:2)
你有正确的依赖,但是类有点不同:
org.springframework.amqp.rabbit.log4j.AmqpAppender
请注意包裹。
答案 1 :(得分:0)
我不确定你发现的追加者是不同的。有一个appender:
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-amqp</artifactId>
<version>1.3.6.RELEASE</version>
</dependency>
来自spring-ampq。
弹簧版也许不同。