Works in Scala REPL but errors with algebird-0.7.0.jar

68 views
Skip to first unread message

Vincent Ohprecio

unread,
Aug 3, 2014, 3:08:46 AM8/3/14
to alge...@googlegroups.com
Hi All,

Summary
I'm pretty new to Scala but I'm learning about Algebird. I've update the wiki with REPL examples found here: https://github.com/twitter/algebird/wiki/Algebird-Examples-with-REPL
Here is the REPL commands I've been learning Algebird with: https://gist.github.com/bigsnarfdude/c48dff7c79228b6180f3
I'm downloaded the project from github, and got the code running without errors via "sbt console" output here: https://gist.github.com/bigsnarfdude/1abb6d53ff36834b5ed0

What I need help with...suggestions?
I used sbt to package the project into a jar and also tried using the 2.10 algebird-core 0.7.0 jar from the maven repo and I keep getting an error here: https://gist.github.com/bigsnarfdude/55b3b6c394f923bcbe66
It looks like its failing on the BloomFilter.scala import of a google bitmap library. I don't understand how it works in the REPL but fails with the jar.

Here is the error code:
scala> val bf = bfMonoid.create("1", "2", "3", "4", "100")
java.lang.NoClassDefFoundError: com/googlecode/javaewah/EWAHCompressedBitmap
at com.twitter.algebird.RichCBitSet$.apply(BloomFilter.scala:26)
at com.twitter.algebird.BFItem.$plus$plus(BloomFilter.scala:137)
at com.twitter.algebird.BloomFilterMonoid.plus(BloomFilter.scala:79)
at com.twitter.algebird.BloomFilterMonoid$$anonfun$create$1.apply(BloomFilter.scala:90)
at com.twitter.algebird.BloomFilterMonoid$$anonfun$create$1.apply(BloomFilter.scala:90)
at scala.collection.IndexedSeqOptimized$class.foldl(IndexedSeqOptimized.scala:51)
at scala.collection.IndexedSeqOptimized$class.foldLeft(IndexedSeqOptimized.scala:60)
at scala.collection.mutable.WrappedArray.foldLeft(WrappedArray.scala:34)
at com.twitter.algebird.BloomFilterMonoid.create(BloomFilter.scala:90)
at .<init>(<console>:22)
at .<clinit>(<console>)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:760)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:805)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:717)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:581)
at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:588)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:591)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:882)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:837)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:837)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:837)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.ClassNotFoundException: com.googlecode.javaewah.EWAHCompressedBitmap
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:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 38 more
 

Oscar Boykin

unread,
Aug 3, 2014, 2:11:41 PM8/3/14
to Vincent Ohprecio, algebird
If you look in the pom file on maven central (or in the sbt build) you see we are using:
        <dependency>
            <groupId>com.googlecode.javaewah</groupId>
            <artifactId>JavaEWAH</artifactId>
            <version>0.6.6</version>
        </dependency>
http://search.maven.org/#artifactdetails%7Ccom.twitter%7Calgebird-core_2.9.3%7C0.7.0%7Cjar

So, you need to have that JavaEWAH jar on your classpath:
https://github.com/lemire/javaewah

The sbt console command sets that up, but your scala -cp did not.

By the way, this is not really an algebird question, it is more of a JVM dependencies or maven question. So you can search with those terms as well for more tips on how to solve it.

Hope this helps.


--
You received this message because you are subscribed to the Google Groups "algebird" group.
To unsubscribe from this group and stop receiving emails from it, send an email to algebird+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Oscar Boykin :: @posco :: http://twitter.com/posco
Reply all
Reply to author
Forward
0 new messages