semagrow / docker-fedx-server

FedX-server Docker image
0 stars 0 forks source link

Fedx invalid Character in request target #1

Closed Iranox closed 7 years ago

Iranox commented 7 years ago

I want to use fedx as an application. Querying a public endpoint throws this error:

11-Jan-2017 19:27:13.814 INFO [http-apr-8080-exec-1] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
    Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
    java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
    at org.apache.coyote.http11.InternalAprInputBuffer.parseRequestLine(InternalAprInputBuffer.java:239)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2445)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I use this configuration file:

@prefix fluid: <http://fluidops.org/config#>.

<http://DBpedia>   fluid:store "SPARQLEndpoint";
                   fluid:SPARQLEndpoint "http://dbpedia.org/sparql" .

and this docker-compose.yml

fedex:
  image: semagrow/fedx-server
  ports:
    - "8080:8080"
  volumes:
    - ./map:/etc/fedx
acharal commented 7 years ago

Hi @Iranox, what's the query you are trying to execute? It seems from the exception you pasted that the URL contains invalid characters. Do you mind to also paste the URL you are trying to access fedx? Are you using GET or POST? I am pretty sure that you must URL encode the query parameter of the GET request.

Iranox commented 7 years ago

Hi @acharal,

I try to execute select * where {?s ?o ?p} or select ?s where {?s ?o ?p} as a simple test query. I use GET and this is the url: http://localhost:8080/fedx-3.1/repositories/sparql?query=select%3Fswhere%20{%3Fs%20%3Fo%20%3Fp}

gmouchakis commented 7 years ago

@Iranox when I decode the URL the result is http://localhost:8080/fedx-3.1/repositories/sparql?query=select?swhere {?s ?o ?p} as you can see there are no spaces between select, ?s and where keywords. If you encode it correctly it works fine.

Iranox commented 7 years ago

I added the missing spaches, but i get still the same error. The url is http://localhost:8080/fedx-3.1/repositories/sparql?query=select%20%3Fs%20where{%20%3Fs%20%3Fo%20%3Fp} now.

stasinos commented 7 years ago

I believe the braces should also be %-encoded. Please try http://localhost:8080/fedx-3.1/repositories/sparql?query=select%20%3Fs%20where%20%7B%3Fs%20%3Fo%20%3Fp%7D

Iranox commented 7 years ago

Thanks for the answer. With this encoding the query works and I get a result. But the application threw a new exception.

2017-01-14 15:06:12,344 ERROR - Query evaluation error
 org.openrdf.query.QueryEvaluationException: org.openrdf.query.resultio.QueryResultParseException: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.http.client.QueueCursor.checkException(QueueCursor.java:164)
    at org.openrdf.http.client.QueueCursor.getNextElement(QueueCursor.java:112)
    at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:91)
    at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:60)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at org.openrdf.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:61)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at org.openrdf.query.QueryResults.report(QueryResults.java:155)
    at org.openrdf.http.server.repository.TupleQueryResultView.render(TupleQueryResultView.java:84)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2445)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
 Caused by: org.openrdf.query.resultio.QueryResultParseException: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResultInternal(SPARQLXMLParserBase.java:149)
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResult(SPARQLXMLParserBase.java:59)
    at org.openrdf.http.client.BackgroundTupleResult.run(BackgroundTupleResult.java:110)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    ... 1 more
 Caused by: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.model.impl.URIImpl.setURIString(URIImpl.java:79)
    at org.openrdf.model.impl.URIImpl.<init>(URIImpl.java:68)
    at org.openrdf.model.impl.ValueFactoryImpl.createURI(ValueFactoryImpl.java:50)
    at org.openrdf.query.resultio.sparqlxml.SPARQLResultsSAXParser.startTag(SPARQLResultsSAXParser.java:121)
    at info.aduna.xml.SimpleSAXParser$SimpleSAXDefaultHandler.endElement(SimpleSAXParser.java:336)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1776)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2964)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:642)
    at info.aduna.xml.SimpleSAXParser.parse(SimpleSAXParser.java:226)
    at info.aduna.xml.SimpleSAXParser.parse(SimpleSAXParser.java:201)
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResultInternal(SPARQLXMLParserBase.java:124)
    ... 5 more
 2017-01-14 15:06:12,344 ERROR - Query evaluation error
 org.openrdf.query.QueryEvaluationException: org.openrdf.query.resultio.QueryResultParseException: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.http.client.QueueCursor.checkException(QueueCursor.java:164)
    at org.openrdf.http.client.QueueCursor.getNextElement(QueueCursor.java:112)
    at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:91)
    at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:60)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at org.openrdf.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:61)
    at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:68)
    at org.openrdf.query.QueryResults.report(QueryResults.java:155)
    at org.openrdf.http.server.repository.TupleQueryResultView.render(TupleQueryResultView.java:84)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2445)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
 Caused by: org.openrdf.query.resultio.QueryResultParseException: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResultInternal(SPARQLXMLParserBase.java:149)
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResult(SPARQLXMLParserBase.java:59)
    at org.openrdf.http.client.BackgroundTupleResult.run(BackgroundTupleResult.java:110)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    ... 1 more
 Caused by: java.lang.IllegalArgumentException: Not a valid (absolute) URI: #cohabitant
    at org.openrdf.model.impl.URIImpl.setURIString(URIImpl.java:79)
    at org.openrdf.model.impl.URIImpl.<init>(URIImpl.java:68)
    at org.openrdf.model.impl.ValueFactoryImpl.createURI(ValueFactoryImpl.java:50)
    at org.openrdf.query.resultio.sparqlxml.SPARQLResultsSAXParser.startTag(SPARQLResultsSAXParser.java:121)
    at info.aduna.xml.SimpleSAXParser$SimpleSAXDefaultHandler.endElement(SimpleSAXParser.java:336)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1776)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2964)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:642)
    at info.aduna.xml.SimpleSAXParser.parse(SimpleSAXParser.java:226)
    at info.aduna.xml.SimpleSAXParser.parse(SimpleSAXParser.java:201)
    at org.openrdf.query.resultio.sparqlxml.SPARQLXMLParserBase.parseQueryResultInternal(SPARQLXMLParserBase.java:124)
    ... 5 more
 2017-01-14 15:06:12,418 DEBUG - Could not complete request
 java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
    at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:462)
    at org.openrdf.http.server.repository.TupleQueryResultView.render(TupleQueryResultView.java:92)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2445)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Iranox commented 7 years ago

I added a limit to the query, with this I dont get an error, so I guess the request is too long.