java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/model/DataModel

Probleem

23:32:36 margusja@IRack> vimjava -classpath target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/model/DataModel
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getMethod0(Class.java:2685)
at java.lang.Class.getMethod(Class.java:1620)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:492)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:484)
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.cf.taste.model.DataModel
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
… 6 more

Lahendus

Puudus viide org/apache/mahout/cf/taste/model/DataModel, mida saab häda pärast täpsustada:

00:06:39 margusja@IRack> javjava -classpath target/my-app-1.0-SNAPSHOT.jar:target/mahout-core-0.8-20121116.235610-121.jar  com.mycompany.app.App

Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Could not find artifact org.apache.mahout:mahout-core:jar:0.8-SNAPSHOT

Probleem

22:52:46 margusja@IRack> cp mvn compile
[INFO] Scanning for projects…
[INFO]
[INFO] ————————————————————————
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ————————————————————————
[WARNING] The POM for org.apache.mahout:mahout-core:jar:0.8-SNAPSHOT is missing, no dependency information available
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 0.409s
[INFO] Finished at: Sat Nov 17 22:52:51 EET 2012
[INFO] Final Memory: 2M/81M
[INFO] ————————————————————————
[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Could not find artifact org.apache.mahout:mahout-core:jar:0.8-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Lahendus

Tirime kohale jar faili, mida vajame. Antud juhul mahout-core…

Paneme oma reposse

23:10:12 margusja@IRack> vimmvn install:install-file -DgroupId=org.apache.mahout -DartifactId=mahout-core -Dversion=0.8-SNAPSHOT -Dpackaging=jar -Dfile=target/mahout-core-0.8-20121116.235610-121.jar
[INFO] Scanning for projects…
[INFO]
[INFO] ————————————————————————
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ————————————————————————
[INFO]
[INFO] — maven-install-plugin:2.3.1:install-file (default-cli) @ my-app —
[INFO] Installing /Users/margusja/java/my-app/target/mahout-core-0.8-20121116.235610-121.jar to /Users/margusja/.m2/repository/org/apache/mahout/mahout-core/0.8-SNAPSHOT/mahout-core-0.8-SNAPSHOT.jar
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 1.101s
[INFO] Finished at: Sat Nov 17 23:10:53 EET 2012
[INFO] Final Memory: 3M/81M
[INFO] ————————————————————————