0

When using tika-1.4 getting this:

Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/core/DebuggingClassWriter
at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
... 5 more
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.core.DebuggingClassWriter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Added these two lines into BuildConfig.groovy:

compile ("org.apache.tika:tika-core:1.4")
compile ("org.apache.tika:tika-parsers:1.4") {excludes "tika-core"}

If I don't exclude tika-core from tika-parsers, I'm getting 2 versions of tika-core (version 1.0 pulled by vorbis-java-tika dependency) and version tika-core version 1.4.

If I replace tika version to be 1.3, exception is gone.

UPDATE 1

This solution seems works:

compile ("org.apache.tika:tika-core:${tikaVersion}")
compile ("org.apache.tika:tika-parsers:${tikaVersion}") { excludes "tika-core", "commons-codec", "commons-logging", "slf4j-api" }
Archer
  • 5,073
  • 8
  • 50
  • 96

1 Answers1

1

This may or may not be the issue you're seeing -- we're working with tika 1.5 (snapshot). That version pulls in asm-debug-all, which was the cause of our troubles (similar stacktrace to yours). Try using 'asm-debug-all' in your tika-parsers excludes instead of 'tika-core'.