Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NoClassDefFoundError:org/apache/commons/logging/LogFactory错误_Java_Maven_Junit_Apache Commons_Castor - Fatal编程技术网

Java NoClassDefFoundError:org/apache/commons/logging/LogFactory错误

Java NoClassDefFoundError:org/apache/commons/logging/LogFactory错误,java,maven,junit,apache-commons,castor,Java,Maven,Junit,Apache Commons,Castor,我在将项目升级到Java8后出现此错误 NoClassDefFoundError:org/apache/commons/logging/LogFactory 类路径中肯定存在Commons日志记录,编译代码也没有问题。但是,在运行时JVM无法定位LogFactory。这个问题只有在我运行Java8时才会出现。它适用于Java8以下的所有版本。我们还在项目中使用Maven 1.X java.lang.NoClassDefFoundError: org/apache/commons/logg

我在将项目升级到Java8后出现此错误

NoClassDefFoundError:org/apache/commons/logging/LogFactory

类路径中肯定存在Commons日志记录,编译代码也没有问题。但是,在运行时JVM无法定位LogFactory。这个问题只有在我运行Java8时才会出现。它适用于Java8以下的所有版本。我们还在项目中使用Maven 1.X

    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:121)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 21 more

您的运行时环境缺少一个或多个jar文件。验证您已经部署了所有必需的jar文件,并且它们与构建环境中使用的jar版本相同。这是在运行Junit测试时发生的。所有必要的罐子都准备好了。再一次,我在Java7中没有遇到这个问题,它只在Java8中出现。尽管它报告了ClassNotFound,但可能是LogFactory的静态初始化失败了。这也会导致CNF。您的运行时环境缺少一个或多个jar文件。验证您已经部署了所有必需的jar文件,并且它们与构建环境中使用的jar版本相同。这是在运行Junit测试时发生的。所有必要的罐子都准备好了。再一次,我在Java7中没有遇到这个问题,它只在Java8中出现。尽管它报告了ClassNotFound,但可能是LogFactory的静态初始化失败了。这也将导致CNF。