Hi, Following is the stack trace: java.lang.NoSuchMethodError: 'javax.servlet.ServletContext javax.servlet.http.HttpServletRequest.getServletContext()' at org.apache.jena.fuseki.servlets.ActionLib.actionURI(ActionLib.java:161) ~[jena-fuseki-core-3.12.0.jar:3.12.0] at org.apache.jena.fuseki.servlets.FusekiFilter.doFilter(FusekiFilter.java:56) ~[jena-fuseki-core-3.12.0.jar:3.12.0] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) ~[jetty-servlet-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) ~[jetty-servlet-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[jetty-servlet-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.Server.handle(Server.java:503) ~[jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [jetty-server-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [jetty-io-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) [jetty-util-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) [jetty-util-9.4.12.v20180830.jar:9.4.12.v20180830] at java.lang.Thread.run(Thread.java:834) [?:?]
Regards, Mohamed On Mon, Jan 6, 2020 at 5:17 PM Andy Seaborne <[email protected]> wrote: > > > On 06/01/2020 15:28, Mohamed Morsey wrote: > > Hi An, > > > > now I did some investigation for the problem and now I get exception > > "java.lang.NoSuchMethodError: 'javax.servlet.ServletContext > > javax.servlet.http.HttpServletRequest.getServletContext()". This > exception > > indicates that there is a problem with dependency "*javax.servlet-api*". > > > > This dependency is added to the pom already and it is the same version > used > > by Fuseki which is "3.1.0". > > > > Do you have a clue on how this problem can be resolved? > > What is the stacktrace for this? > > javax.servlet.http.HttpServletRequest is an interface - there needs to > be an implementation at runtime. It should come from Eclipse Jetty for > FusekiServer. > > NoSuchMethodError means that the runtime does not have the method but > the compile time did. > > There are quite a few reasons this java Error is thrown. > > It can be because there are multiple jars containing the same classes on > the runtime classpath as well as no suitable jar at runtime. > > Andy > > > > > Thank you! > > Regards, > > Mohamed > > > > On Mon, Jan 6, 2020 at 12:22 PM Andy Seaborne <[email protected]> wrote: > > > >> Hi there, > >> > >> Which version are you running? > >> > >> What does the server log say? It logs all requests - you may need > >> > >> static { FusekiLogging.setLogging(); } > >> > >> in your test class and make sure you haven't turned off logginbg by > >> level with log4j.properties somewhere. > >> > >> Andy > >> > >> On 06/01/2020 11:05, Mohamed Morsey wrote: > >>> Hi all, > >>> > >>> I have a problem with getting Fuseki server working with unit tests. > >>> > >>> What I do is the following: > >>> 1- Create and start Fuseki server via the following piece of code: > >>> > >>> > >>> > >>> > >>> *fusekiServer = FusekiServer.create().add("/sparql", > >>> > >> > DatasetFactory.create(ModelFactory.createDefaultModel())).port(9090).build();fusekiServer.start();* > >>> > >>> 2- Load data as follows: > >>> > >>> > >>> *try (RDFConnection conn = > >>> RDFConnectionFactory.connect("http://localhost:9090/sparql > >>> <http://localhost:9090/sparql>")) {* > >>> *conn.load(dataModel);**}* > >>> > >>> 3- I can then send SPARQL queries to that endpoint. > >>> > >>> This works fine in runtime. However, in unit tests mode I get > >>> "org.apache.jena.atlas.web.HttpException" exception with message "500 - > >>> Server Error" when loading the data. > >>> Further, if I try to send a query I get > >>> "org.apache.jena.sparql.engine.http.QueryExceptionHTTP" exception." > with > >>> message "HTTP 500 error making the query: Server Error". > >>> > >>> Can you please help me out with this? > >>> Thank you! > >>> kind regards, > >>> Mohamed Morsey > >>> > >> > > >
