0

I am new to Clojure and working on a project where I am trying to extract text from web pages using Pantomime. I am managing the project with Leiningen and editing using Eclipse / CCW. When I try to use the pantomime.extract/extract function, I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.apache.tika.parser.pkg.PackageParser, compiling:(/tmp/form-init7461469090551574085.clj:1:72)
    at clojure.lang.Compiler.load(Compiler.java:7142)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.tika.parser.pkg.PackageParser
    at org.apache.tika.parser.pkg.ZipContainerDetector.detect(ZipContainerDetector.java:86)
    at org.apache.tika.detect.CompositeDetector.detect(CompositeDetector.java:61)
    at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:113)
    at pantomime.extract$eval1104$fn__1105.invoke(extract.clj:29)
    at pantomime.extract$eval1087$fn__1088$G__1078__1093.invoke(extract.clj:18)
    at pantomime.extract$eval1116$fn__1117.invoke(extract.clj:53)
    at pantomime.extract$eval1087$fn__1088$G__1078__1093.invoke(extract.clj:18)
    at com.scrape$extract_text.invoke(scrape.clj:26)
    at com.scrape$get_words.invoke(scrape.clj:29)
    at com.sis$main.invoke(sis.clj:6)
    at clojure.lang.Var.invoke(Var.java:375)
    at user$eval5.invoke(form-init7461469090551574085.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6693)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    ... 11 more
ABRT problem creation: 'success'

I made sure to include the appropriate dependency line in my project.clj:

  [com.novemberain/pantomime "2.6.0"]

I also made sure that I am requiring the pantomime.extract namespace in my namespace:

(ns com.scrape
  (:require  [pantomime.extract :as extract]))

Here is the function that is calling "extract":

(defn extract-text [url]
  (:text (extract/parse (java.net.URL. url))))

I have tried running "lein clean" and "lein deps". I've also deleted the directory where leiningen stores dependencies (~/.m2) and allowed lein to automatically re-download all the appropriate jar files. Still, whether I am running an REPL from the command line with "lein run" or from Eclipse, I always get the above error.

Why am I getting this error, and how can I fix it?

UPDATE

I tried to recreate this issue in a new project with as little code as possible in order to post the full source here; however, in a new lein project, I was able to copy all my code from my original project; and I am not getting errors anymore.

Any idea what might have happened? Some glitch with leiningen?

qdet
  • 115
  • 3

0 Answers0