gpt4 book ai didi

java - 获取 java.lang.ClassNotFoundException : org. apache.commons.logging.LogFactory 异常

转载 作者:行者123 更新时间:2023-12-02 04:28:50 26 4
gpt4 key购买 nike

我正在执行简单的 spring 依赖注入(inject)程序并收到此异常。我已经包含了 common-logging1.1.1.jar 和 spring.jar 文件。您能帮忙解决一下吗?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:119)
at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:55)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:56)
at com.client.StoryReader.main(StoryReader.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 6 more

最佳答案

如果您使用 Maven 来管理依赖项,请在 pom.xml 中添加以下行:

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>

关于java - 获取 java.lang.ClassNotFoundException : org. apache.commons.logging.LogFactory 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56596319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com