Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.<init>(DefaultMetricsSystem.java:38) at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.<clinit>(DefaultMetricsSystem.java:36) at org.apache.hadoop.security.UserGroupInformation$UgiMetrics.create(UserGroupInformation.java:120) at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:236) at org.apache.spark.util.Utils$.$anonfun$getCurrentUserName$1(Utils.scala:2539) at scala.Option.getOrElse(Option.scala:189) at org.apache.spark.util.Utils$.getCurrentUserName(Utils.scala:2539) at org.apache.spark.SparkContext.<init>(SparkContext.scala:314) at org.apache.spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:58) at FileTest.main(FileTest.java:10) Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.Configuration at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
时间: 2023-08-06 21:03:59 浏览: 142
druid出现 java.lang.NoClassDefFoundError orgapachelog4j.md
这个错误是因为在运行Java代码时,没有找到 org.apache.commons.configuration.Configuration 这个类。你需要检查你的项目是否正确地导入了 Apache Commons Configuration 库,并且该库的版本是否正确。此外,你也需要检查你的环境变量是否设置正确,确保Java能够正确找到这个类。
阅读全文