Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating XML using in house REST server #26

Open
hunterhector opened this issue Jun 10, 2018 · 7 comments
Open

Error creating XML using in house REST server #26

hunterhector opened this issue Jun 10, 2018 · 7 comments

Comments

@hunterhector
Copy link
Member

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

@hunterhector hunterhector changed the title Error creating XML using in house XML Error creating XML using in house REST server Jun 10, 2018
@sandroacoelho
Copy link
Collaborator

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
Copy link
Member Author

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
Copy link
Collaborator

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
Copy link
Member Author

hunterhector commented Jun 11, 2018

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
Copy link

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

@agill3
Copy link

agill3 commented Feb 26, 2020

Me too. Any hint since the last post?

@juhaszhenderson
Copy link

Getting this too, any word on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants