[MRL 1748] Wikidatafetcher didn't work anaymore

Hi ! Does some had the same problem ?

The service can't work anymore. ( I did't use eclipse, only the jar )

This is the error when I call a wdf.getdescription :

 wikiAnswer = wdf.getDescription(word) # recupere la description su wikidata
        at org.wikidata.wdtk.wikibaseapi.ApiConnection.<init>(ApiConnection.java:185)
        at org.wikidata.wdtk.wikibaseapi.ApiConnection.getWikidataApiConnection(ApiConnection.java:205)
        at org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher.getWikidataDataFetcher(WikibaseDataFetcher.java:77)
        at org.myrobotlab.service.WikiDataFetcher.getWiki(WikiDataFetcher.java:72)
        at org.myrobotlab.service.WikiDataFetcher.getDescription(WikiDataFetcher.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper

        at org.python.core.Py.JavaError(Py.java:546)
        at org.python.core.Py.JavaError(Py.java:537)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
        at org.python.core.PyObject.__call__(PyObject.java:478)
        at org.python.core.PyObject.__call__(PyObject.java:482)
        at org.python.core.PyMethod.__call__(PyMethod.java:141)
        at org.python.pycode._pyx80.askWiki$1(INMOOV-AI_KnowledgeFetchers.py:62)
        at org.python.pycode._pyx80.call_function(INMOOV-AI_KnowledgeFetchers.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:167)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:188)
        at org.python.core.PyFunction.__call__(PyFunction.java:446)
        at org.python.pycode._pyx112.f$0(<string>:1)
        at org.python.pycode._pyx112.call_function(<string>)
        at org.python.core.PyTableCode.call(PyTableCode.java:167)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1386)
        at org.python.core.Py.exec(Py.java:1430)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:267)
        at org.myrobotlab.service.Python$PIThread.run(Python.java:161)
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
        at org.wikidata.wdtk.wikibaseapi.ApiConnection.<init>(ApiConnection.java:185)
        at org.wikidata.wdtk.wikibaseapi.ApiConnection.getWikidataApiConnection(ApiConnection.java:205)
        at org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher.getWikidataDataFetcher(WikibaseDataFetcher.java:77)
        at org.myrobotlab.service.WikiDataFetcher.getWiki(WikiDataFetcher.java:72)
        at org.myrobotlab.service.WikiDataFetcher.getDescription(WikiDataFetcher.java:93)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
        ... 17 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 27 more

Mats's picture

Same Error

Hi Moz4r

Not that it helps you much currenty, but I can confirm that the same problem occurs when using Eclipse too.

/Mats

kwatters's picture

Wiki jar caused problems

So.. this was probably me and grog that broke this. Turns out that the original wiki data client jar file bundled together a bunch of additional libraries that caused version conflicts, especially with the http client libraries.

Long story short we seem to have missed a library and that is the error you are seeing.

Best way to avoid this is to ensure that there is a unit test for this service. I'm away from my laptop at the moment, but maybe later tonight or tomorrow I'll check in a fix.

beetlejuice's picture

Hi, For me, it work well . In

Hi,

For me, it work well .

In eclipse, it don't work but the generated jar can use the service without problem ! ( compiled from develop branch )

 

GroG's picture

Ehi ! Yep.. previously it

Ehi !

Yep.. previously it included everything in a single jar.  This is not a good plan because it prevents the ability to attempt dependency version management.

HttpClient versions were colliding with wiki data fetcher and other services.

I get an error in eclipse too .. was trying to chase dependencies down.

Whenever you see fasterxml jackson - its the json parser (or lack thereof)

Started manually chasing down dependencies .. but then found 

https://www.mediawiki.org/wiki/Wikidata_Toolkit - where they have a maven pom dependency definition YAY !

Maven can be wonderful sometimes:
All I did was ->  mvn dependency:copy-dependencies and magically all the dependency libraries were downloaded.

I am going to put all the necessary ones in the repo..  

This should fix it for all.

Junit testing should occur !!! 

Additionally, going forward the libraries defined in Maven central should be utilized (Ivy has this capability) and removed from the  github library.

GroG's picture

Ok ... I got it worky again

Ok ... I got it worky again ..

I'll work on checking in all the pieces and adding a unit test..

moz4r's picture

Ok I don't understand all

Ok I don't understand all because I didn't use mrl eclipse envionement, but I thank you !

GroG's picture

All cleaned up - new

All cleaned up - new release 

develop & master should be in sync - https://github.com/MyRobotLab/myrobotlab/releases

1.0.1758

should be all worky

moz4r's picture

Thank you grog ! have a nice

Thank you grog ! have a nice day guys

beetlejuice's picture

All work perfectly for me :D

All work perfectly for me :D thx Grog .