java.lang.ClassNotFoundException 가져 오기 : org.apache.commons.logging.LogFactory 예외
스프링의 간단한 의존성 주입 프로그램을 실행 중이며이 예외가 발생합니다. 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
아래 URL에서 jar 파일을 다운로드하여 수정하기 위해 동일한 문제에 직면했습니다.
http://commons.apache.org/logging/download_logging.cgi
lib 폴더에 복사하면 문제가 해결됩니다.
의존성을 관리하기 위해 maven을 사용하는 경우 pom.xml에 다음 행을 추가하십시오.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
commons-logging-1.1.2.jar을 다운로드 한 다음이 파일을 libs에 복사하면됩니다.
마침내 작동합니다.
나는 같은 문제가 있었고 commons-logging.jar
클래스 경로에를 추가하여 해결했습니다 .
commons-logging-1.1.1.jar 또는 jcl-over-slf4j-1.7.6.jar al
maven을 사용하는 경우 아래 코드를 사용하십시오.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
commons-logging.jar 또는 commons-logging-1.1.jar를 추가하면이 문제가 해결됩니다 ...
나는 이미 common-logging1.1.1.jar을 포함했고 ...
JAR 파일 이름의 철자를 정확히 맞습니까? 아마 그것이 있어야한다고 생각합니다 commons-logging-1.1.1.jar
( -
이름에 여분 의 것을 주목하십시오 ). 디렉토리 이름이 올바른지 확인하십시오.
NoClassDefFoundError
항상 클래스를 찾을 수 없으므로 클래스 경로가 올바르지 않을 가능성이 높습니다.
컴파일 할 범위를 설정하면 나에게 도움이되었습니다.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
오래된 라이브러리 jar을 제거하려면 앱의 대상 / 배포 디렉토리를 완전히 정리하십시오. 새로 빌드하고 commons-logging.jar이 실제로 올바른 lib 폴더에 있는지 확인하십시오. 애플리케이션의 라이브러리를 빌드 할 때 포함되지 않을 수 있습니다.
commons-logging.jar를 추가하여 해결 된 문제
Imp 파일은
antlr-runtime-3.0.1
org.springframework.aop-3.1.0.M2
org.springframework.asm-3.1.0.M2
org.springframework.aspects-3.1.0.M2
org.springframework.beans-3.1.0.M2
org.springframework.context.support-3.1.0.M2
org.springframework.context-3.1.0.M2
org.springframework.core-3.1.0.M2
org.springframework.expression-3.1.0.M2
commons-logging-1.1.1
두 가지 옵션 (적어도) :
- commons-logging jar을 로컬 폴더에 복사하여 파일에 추가하십시오.
참고 : jar을 연결하면 서버에 문제가 발생하고 빌드 경로에 추가되었지만 서버 시작 문제를 해결하지 못하는 이유가 발생할 수 있습니다.
따라서 항아리를 외부 폴더로 가리 키지 마십시오.
또는...
- 프로젝트간에 jar 파일을 공유하고 있기 때문에 로컬로 추가하고 싶지 않으면 ...
tc 서버 인스턴스를 사용하는 경우 서버 인스턴스 실행 구성에 항아리를 외부 항아리로 추가해야합니다.
다음으로 실행, 구성 실행 ..., {your tc server instance}, 클래스 경로 탭으로 이동하십시오.
그런 다음 commons-logging jar을 추가하십시오.
당신과 같은 문제가 있습니다. 마지막으로 클래스를 소유 한 아파치 버전을 확인했습니다. 버전 1.0.4에 클래스가 있음을 발견했습니다.
Try to use the version 1.0.4 instead of 1.1.X or 1.2.X
My dependencies :
<dependencies>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-client-java</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
My Java Code
J4pClient j4pClient = new J4pClient("http://localhost:8080/jolokia");
J4pReadRequest req = new J4pReadRequest("java.lang:type=Memory","HeapMemoryUsage");
req.setPath("used");
J4pReadResponse resp = j4pClient.execute(req);
System.out.println(resp.getValue());
My Result :
130489168
Double check also that your maven dependencies are well imported.
http://commons.apache.org/logging/download_logging.cgi
use this url to download jar files and include them in your class path, issue will be solved
Just check whether the commons-logging.jar has been added to your libs and the classpath.. I had the same issue and that was because of this. dhammikas-
I generally assign the classpath to a variable and then verify it. I've written a small ruby script which I include in a my startup scripts which validates the classpath before launching java. Validating the classpath before the JVM starts has saved me lots of time troubleshooting these types of problems.
Hey I was following the tutorial on tutorialpoint.com. Add after you complete Step 2 - Install Apache Common Logging API: You must import external jar libraries to the project from the files downloaded at this step. For me the file name was "commons-logging-1.1.1".
If you're running this on Android then note that apparently java.beans
package is not complete on Android. To attempt to fix it on Android try the following:
- Download android-java-air-bridge.jar (currently the download button is on the bottom of the page or direct link here)
- Copy the downloaded jar to your [APPROOT]/app/libs directory (or link the jar in any other way)
- Change the
import ***
statements to that of air-bridge. Egimport javadz.beanutils.BeanUtils
instead ofimport org.apache.commons.beanutils.BeanUtils;
- Clean and rebuild the project
I apologise as I realise this is not exactly answering the question, though this SO page comes up a lot when searching for android-generated NoClassDefFoundError: Failed resolution of: beanUtils
errors.
I was getting the same error while the jar was present. No solution worked. What worked was deleting the jar from the file system (from .m2 directory) and then cleaning the maven project.
I have the same problem in eclipse IDE, my solution was: Right click in My project > Properties
Click in Maven and write: jar in the Active Maven Project
Finally, Apply and Close
In my case I was testing a Tomcat app in eclipse and got this error. I solved it by checking the .classpath
file and corrected this entry:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
The attribute org.eclipse.jst.component.dependency
had been missing.
Check whether the jars are imported properly. I imported them using build path. But it didn't recognise the jar in WAR/lib folder. Later, I copied the same jar to war/lib folder. It works fine now. You can refresh / clean your project.
Hello friends if your getting any not class found exception in hibernate code it is the problem of jar files.here mainly two problems
1.I mean to say your working old version of hibernate may be 3.2 bellow.So if u try above 3.6 it will works fine
2.first checkes database connection.if it database working properly their was a mistake in ur program or jar file.
please check these two prioblems if it also not working you tried to IDE . I am using netbeanside 6.9 version.here hibernate working fine.you dont get any error from class not founnd exception..
I hope this one helps more
Solution is to Add common-logging.x.x jar file
try adding this dependency org.apache.commons commons-exec 1.3
If all else fails, as it had for me, try putting the commons-logging-x.y.z.jar in your Tomcat lib directory. It solved the problem! BTW, I am using Tomcat 6.
'Programing' 카테고리의 다른 글
Injectable 클래스가 인스턴스화 될 때 ngOnInit가 호출되지 않음 (0) | 2020.05.22 |
---|---|
InvokeRequired 코드 패턴 자동화 (0) | 2020.05.22 |
웹앱에서 모바일 카메라에 액세스하는 방법은 무엇입니까? (0) | 2020.05.22 |
스크립트 자체 내에서 전체 셸 스크립트의 출력을 어떻게 리디렉션합니까? (0) | 2020.05.22 |
페이지의 일부에 어떻게 링크합니까? (0) | 2020.05.22 |