I'm trying to use Bliki to access and parse wiki pages. I just downloaded the zip file and put the bliki-core-3.0.19.jar into my eclipse build path.
However, when I tried to connect using sample code. there was an error. The sample code is here:
public static void test(){
String pageName = "File:Mona Lisa.jpg";
User user = new User("", "", "http://en.wikipedia.org/w/api.php");
Connector con = new Connector();
user = con.login(user);
List<Page> pages = user.queryImageinfo(new String[]{pageName});
if(pages != null)
System.out.println(pages.size());
}
And I got errors as:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod
at info.bliki.api.User.<init>(User.java:98)
at info.bliki.api.User.<init>(User.java:71)
at main.wiki.WikiCall.test(WikiCall.java:23)
at main.wiki.WikiCall.main(WikiCall.java:32)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpMethod
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)
... 4 more
It seems like I'm missing the http jar for the connection, but there's no one the zip file and i thought the bliki-core.jar should contain it.
Any suggestions?
This issue is that even once you have added HttpClient you will likely get other errors as the Bliki library depends on a number of 3rd party libraries.
If you are not familiar with the Maven build tool it may be worth having a look as one feature is that it will transitively resolve dependencies.
As a quick start:
In Eclipse do:
File > New > Other > Maven Project
Select the 'Create Simple Project' checkbox.
Enter my.bliki.project as the group id and bliki-test as the Artifact id.
Replace the contents of the generated pom.xml with the below.
Right click on the project and select 'Maven > Update project.
You now have a project with Bliki and all 3rd p;arty dependencies on the buildpath (expand the Maven Dependencies folder to see what they are).