dbpedia-spotlight / dbpedia-spotlight-model

DBpedia Spotlight is a tool for automatically annotating mentions of DBpedia resources in text. Improving Efficiency and Accuracy in Multilingual Entity Extraction approach
http://www.dbpedia-spotlight.org
Apache License 2.0
178 stars 43 forks source link

Error creating XML using in house REST server #26

Open hunterhector opened 6 years ago

hunterhector commented 6 years ago

I am running the in-house RESTful server.

Using dbpeidia spotlight 1.0.0 [1] and model 2016-10 [2].

The server can do annotation most of the time, but sometimes throws:

org.dbpedia.spotlight.exceptions.OutputException: Error creating XML output.Error creating XML output.org.dbpedia.spotlight.web.rest.OutputManager.makeXML(OutputManager.java:108)

One minimum test case to reproduce the error is:

curl http://localhost:2222/en/rest/annotate --data-urlencode "text=Crimean peninsula Black Sea" -H "Accept: application/json"

Interestingly, querying the public dbpedia end point is totally fine:

curl http://api.dbpedia-spotlight.org/en/annotate --data-urlencode "text=Crimean peninsula Black Sea" -H "Accept: application/json"

[1] http://downloads.dbpedia-spotlight.org/spotlight/dbpedia-spotlight-1.0.0.jar [2] http://downloads.dbpedia-spotlight.org/2016-10/en/model/en.tar.gz

sandroacoelho commented 6 years ago

Hi @hunterhector ,

Just remove /en from your URL

E.g:

curl http://localhost:2222/rest/annotate --data-urlencode "text=Crimean peninsula Black Sea" -H "Accept: application/json"

Best,

hunterhector commented 6 years ago

In fact, that is not what I mean. The URL I am using is correct.

Since I started the server with: java -jar dbpedia-spotlight-1.0.0.jar /data/hector/dbpedia/en http://localhost:2222/en/rest

And the link works with the following command: curl http://localhost:2222/en/rest/annotate --data-urlencode "text=Crimean peninsula" -H "Accept: application/json"

But does not work with the following: curl http://localhost:2222/en/rest/annotate --data-urlencode "text=Crimean peninsula Black Sea" -H "Accept: application/json"

Some of the stack trace:

org.dbpedia.spotlight.exceptions.OutputException: Error creating XML output.Error creating XML output.org.dbpedia.spotlight.web.rest.OutputManager.makeXML(OutputManager.java:108) org.dbpedia.spotlight.web.rest.SpotlightInterface.getXML(SpotlightInterface.java:250) org.dbpedia.spotlight.web.rest.SpotlightInterface.getJSON(SpotlightInterface.java:328) org.dbpedia.spotlight.web.rest.resources.Annotate.getJSON(Annotate.java:172) org.dbpedia.spotlight.web.rest.resources.Annotate.postJSON(Annotate.java:275) sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

It seems there is something funny happening in converting the output to XML here. However, both the test cases work for the public rest API, which is making me even confusing.

sandroacoelho commented 6 years ago

Spotlight ApplicationPath does not come from the command line parameter as declared here.

If you want to change the path with the current version, I advise you put it behind an Apache / Nginx

hunterhector commented 6 years ago

Hi, Sandro,

Thanks for the quick reply. However, I still find the problem not related to the application path.

I restarted the server as

java -jar dbpedia-spotlight-1.0.0.jar /data/hector/dbpedia/en http://localhost:2222/rest

And then I do the following query:

curl http://localhost:2222/rest/annotate --data-urlencode "text=Crimean peninsula Black Sea" -H "Accept: application/json"

, which gives me the same XML error, here is the full stack trace:

org.dbpedia.spotlight.exceptions.OutputException: Error creating XML output.Error creating XML output.org.dbpedia.spotlight.web.rest.OutputManager.makeXML(OutputManager.java:108) org.dbpedia.spotlight.web.rest.SpotlightInterface.getXML(SpotlightInterface.java:250) org.dbpedia.spotlight.web.rest.SpotlightInterface.getJSON(SpotlightInterface.java:328) org.dbpedia.spotlight.web.rest.resources.Annotate.getJSON(Annotate.java:172) org.dbpedia.spotlight.web.rest.resources.Annotate.postJSON(Annotate.java:275) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) javax.servlet.http.HttpServlet.service(HttpServlet.java:820) com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059) com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999) com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434) com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379) com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) com.sun.grizzly.ContextTask.run(ContextTask.java:71) com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) java.lang.Thread.run(Thread.java:748)

Note that, the following query is fine (no matter which application path I am using):

curl http://localhost:2222/rest/annotate --data-urlencode "text=Crimean peninsula" -H "Accept: application/json"

annishaa88 commented 5 years ago

I'm also experiencing this issue with query: Mediterranean Sea

agill3 commented 4 years ago

Me too. Any hint since the last post?

juhaszhenderson commented 3 years ago

Getting this too, any word on this?