bloom-filter-scala icon indicating copy to clipboard operation
bloom-filter-scala copied to clipboard

NoClassDefFoundError Product when instatiating a new BloomFilter

Open il-bert opened this issue 6 years ago • 5 comments

Instantiating a simple bloom filter with the following command

    val expectedElements = 10000
    val falsePositiveRate: Double = 0.1
    val bf = BloomFilter[String](expectedElements, falsePositiveRate)

at the last line ( val bf = ...) I am getting the following error


[error] (run-main-0) java.lang.NoClassDefFoundError: scala/Product$class
[error] java.lang.NoClassDefFoundError: scala/Product$class
[error] 	at bloomfilter.CanGenerateHashFrom$CanGenerateHashFromString$.<init>(CanGenerateHashFrom.scala:20)
[error] 	at bloomfilter.CanGenerateHashFrom$CanGenerateHashFromString$.<clinit>(CanGenerateHashFrom.scala)

il-bert avatar Jun 10 '18 08:06 il-bert

Thanks for reporting that. Can you specify Java and Scala versions you use please.

alexandrnikitin avatar Jun 11 '18 07:06 alexandrnikitin

Hi, Scala 2.12.6 on jvm 1.8

il-bert avatar Jun 11 '18 18:06 il-bert

I got the same error with Scala 2.10.6 and Java 1.8. And fixed via turning the maven dependency scope from 'provided' to 'compile'. Hope this may help.

LuckyCamel avatar Jun 25 '19 02:06 LuckyCamel

@il-bert Yes, it could be dependency config related thing. I can't reproduce the issue 😢 . I'll be happy to fix it if you can provide a repro project for it.

alexandrnikitin avatar Jun 25 '19 04:06 alexandrnikitin

I get the same issue. My previouse versions of Scala-library and bloom-filter were inconsistent.But when I set them to be consistent, everything is getting better. Here is my pom.xml

    <dependency>
          <groupId>org.scala-lang</groupId>
          <artifactId>scala-library</artifactId>
          <version>2.10.3</version>
      </dependency>

      <dependency>
          <groupId>com.github.alexandrnikitin</groupId>
          <artifactId>bloom-filter_2.10</artifactId>
          <version>0.11.0</version>
      </dependency>

Maybrittnelson avatar Jul 25 '19 06:07 Maybrittnelson