烫伤NoClassDefFoundError

时间:2014-05-02 11:57:17

标签: java scala sbt scalding

安装java后,在OSX上scala scalding我尝试运行WordCountJob文件时出现以下错误

$ scripts/scald.rb --local  WordCountJob.scala --input someInputfile.txt --output ./someOutputFile.tsv
  

编译WordCountJob.scala scalac -classpath   /Users/me/.sbt/boot/scala-2.9.3/lib/scala-library.jar:/Drive/me/Coding/scalding/scalding-core/target/scala-2.9.3/scalding-core-assembly -0.9.1.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/hadoop-core-1.1.2.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/commons-codec-1.8.jar :/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/commons-configuration-1.9.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/jackson-asl-0.9.5.jar:在/ var /文件夹/ 5Q / 7bth9vvd2tv8q57f737f6jxm0000gn / T /行家/杰克逊映射器-ASL-1.9.13.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/commons-lang-2.6.jar:在/ var /文件夹/ 5Q / 7bth9vvd2tv8q57f737f6jxm0000gn / T /行家/ SLF4J-log4j12-1.6.6.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/log4j-1.2.15.jar:在/ var /文件夹/ 5Q / 7bth9vvd2tv8q57f737f6jxm0000gn / T /行家/ commons- HttpClient的-3.1.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/commons-cli-1.2.jar:在/ var /文件夹/ 5Q / 7bth9vvd2tv8q57f737f6jxm0000gn / T /行家/公地洛G-1.1.1.jar:/var/folders/5q/7bth9vvd2tv8q57f737f6jxm0000gn/T/maven/zookeeper-3.3.4.jar   -d / var / folders / 5q / 7bth9vvd2tv8q57f737f6jxm0000gn / T / script-build WordCountJob.scala线程中的异常" main"   java.lang.NoClassDefFoundError:scala / tools / nsc / Main引起:   java.lang.ClassNotFoundException:scala.tools.nsc.Main at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:202)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(URLClassLoader.java:190)at   java.lang.ClassLoader.loadClass(ClassLoader.java:306)at   sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)at at   java.lang.ClassLoader.loadClass(ClassLoader.java:247)

有人知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

找不到Scala编译器。您需要设置SCALA_HOME并将./bin目录添加到PATH:

 export SCALA_HOME=<where you installed scala>
 export PATH=$PATH:$SCALA_HOME/bin

答案 1 :(得分:0)

在某些论坛上,我在JRE 7中看到此错误不存在所以我已更新到jre 7

$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

使其活跃的唯一方法

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

根据Installing Java on OS X 10.9 (Mavericks)

$ echo $JAVA_HOME
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

我在〜/ .profile

中添加了以下行
export JAVA_HOME=$(/usr/libexec/java_home)
export SCALA_HOME="/usr/local/Cellar/scala/2.9.3"
export PATH=$PATH:$SCALA_HOME/bin

in / scalding我想要运行 - &gt; sbt汇编并出现以下错误

[info] Passed: Total 51, Failed 0, Errors 0, Passed 51
[info] Checking every *.class/*.jar file's SHA-1.
[info] Merging files...
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Strategy 'discard' was applied to a file
[info] Assembly up to date: /Drive/me/Coding/scalding/scalding-date/target/scala-2.9.3/scalding-date-assembly-0.9.1.jar
[error] (maple/compile:compile) javac returned nonzero exit code
[error] Total time: 29 s, completed May 2, 2014 8:27:30 PM

尝试运行WordCountJob时出现以下错误

$ scripts/scald.rb --local WordCountJob.scala --input someInputfile.txt --output ./someOutputFile.tsv
/Drive/me/Coding/scalding/scalding-core/target/scala-2.9.3/scalding-core-assembly-0.9.1.jar is missing, you probably need to run sbt assembly

看起来像是在本地模式下运行烫伤的任务是不可能的。