eldur / jwbf

Java Wiki Bot Framework is a library to maintain Wikis like Wikipedia based on MediaWiki.
http://jwbf.sourceforge.net/
Apache License 2.0
78 stars 33 forks source link

NoClassDefFound exception when instantiating classes #52

Closed ktrieu closed 9 years ago

ktrieu commented 9 years ago

I recently tried to use the 4.0.0-SNAPSHOT version with IntelliJ and Maven, but it throws a NoClassDefFound exception when I try and instantiate your classes. I've pretty much copy-and-pasted the dependency tags you put in the README. This is probably not the place to put this, but I couldn't find any email associated with you. I tried asking StackOverflow, assuming it was my problem, but they can't seem to find an answer. I was hoping you could help.

My pom.xml

eldur commented 9 years ago

Can you paste(bin) your stacktrace and the maven command line which causes your exception too?

ktrieu commented 9 years ago

My stacktrace:

Exception in thread "main" java.lang.NoClassDefFoundError: net/sourceforge/jwbf/core/actions/HttpActionClient
    at com.FactFinder.WikiParser.makeBot(WikiParser.java:22)
    at com.FactFinder.WikiParser.<init>(WikiParser.java:17)
    at com.FactFinder.App.main(App.java:15)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.jwbf.core.actions.HttpActionClient
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 3 more

I was running package from IntelliJ, though I tried it with install just now and got the same error. I have cleaned the build directory multiple times, and it doesn't seem to affect anything.

eldur commented 9 years ago

hmm feels strange, your pom looks good.

... have you tried to reimport your maven project?

ktrieu commented 9 years ago

I have auto re-import set as the default in IntelliJ. I just forced a re-import and nothing has changed. I also made a fresh, new project, and I get the same error.

eldur commented 9 years ago

Have you tried the released version or an other artifact?

ktrieu commented 9 years ago

I tried 3.1.0, and it works, save a warning about missing Log4J, which is apparently a common-ish problem. Unfortunately, I would like to use the features in 4.0.0, primarily the search class you have.

eldur commented 9 years ago

feels like a local maven problem. You can override this by installing the snapshot to your local repo.

git clone https://github.com/eldur/jwbf.git
cd jwbf
mvn clean install
ktrieu commented 9 years ago

During the clean install it complains about 3510 checkstyle errors, mainly anomalous line endings. Any way to just ignore those?

ktrieu commented 9 years ago

I found a switch to ignore the checkstyle warnings, and after the manual way you suggested, it finally works! Thanks for your help.