使用Mahout用户推荐协同过滤算法(UserCF)

如下为运行后的异常:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/math3/primes/Primes
at org.apache.mahout.common.RandomUtils.nextTwinPrime(RandomUtils.java:93)
at org.apache.mahout.cf.taste.impl.common.FastByIDMap.growAndRehash(FastByIDMap.java:283)
at org.apache.mahout.cf.taste.impl.common.FastByIDMap.put(FastByIDMap.java:184)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processLine(FileDataModel.java:530)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processFile(FileDataModel.java:363)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.buildModel(FileDataModel.java:259)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.reload(FileDataModel.java:231)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:221)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:169)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.(FileDataModel.java:149)
at com.elan.compute.UserCF.main(UserCF.java:36)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.math3.primes.Primes
at java.net.URLClassLoader$1.run(URLClassLoader.java:370)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
Caused by: java.util.zip.ZipException: invalid distance too far back
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at sun.misc.Resource.getBytes(Resource.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
... 17 more

2个回答

解决了, 问题是jar包版本不对,所以才出现如上问题.

之前还能使用, 然后我上个项目配置出现问题后我新加的一个项目 。 突然就变成这样了。 求大神指点

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐