From: Joe W. <jo...@gm...> - 2012-08-31 21:06:31
|
Hi Adam, I get a "err:XPDY0002 variable '...' is not set" error when I use RESTXQ URL to execute a module that declares variables. Below is a module [1] that causes the error [2]: Once I store this module in the db, I would expect the following results when I call the function in my browser via http://localhost:8080/exist/restxq/test: <hello>world</hello> Instead, I get the error below. The syntax I use above for declaring variables is described in the XQuery spec at http://www.w3.org/TR/xquery/#id-variable-declarations (and http://www.w3.org/TR/xquery-30/#id-variable-declarations for XQuery 3.0). Thanks, Joe [1] module: /db/test.xql xquery version "3.0"; module namespace test="http://exist-db.org/restxq/test"; declare variable $test:hello := element hello {'world'} declare %rest:GET %rest:path("/test") function test:test() { $test:hello }; [2] error from exist.log 2012-08-31 16:51:05,598 [eXistThread-43] ERROR (RestXqServlet.java [service]:110) - err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] org.exquery.restxq.RestXqServiceException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:140) at org.exquery.restxq.impl.AbstractRestXqService.service(AbstractRestXqService.java:107) at org.exist.extensions.exquery.restxq.impl.RestXqServiceImpl.service(RestXqServiceImpl.java:118) at org.exist.extensions.exquery.restxq.impl.RestXqServlet.service(RestXqServlet.java:96) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:224) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98) at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:47) at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:211) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) at java.lang.Thread.run(Thread.java:680) Caused by: org.exist.xquery.XPathException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.xquery.VariableReference.analyze(VariableReference.java:61) at org.exist.xquery.UserDefinedFunction.analyze(UserDefinedFunction.java:110) at org.exist.xquery.FunctionCall.analyze(FunctionCall.java:147) at org.exist.xquery.value.FunctionReference.analyze(FunctionReference.java:65) at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:131) ... 43 more 2012-08-31 16:51:05,891 [eXistThread-43] ERROR (RestXqServlet.java [service]:110) - err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] org.exquery.restxq.RestXqServiceException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:140) at org.exquery.restxq.impl.AbstractRestXqService.service(AbstractRestXqService.java:107) at org.exist.extensions.exquery.restxq.impl.RestXqServiceImpl.service(RestXqServiceImpl.java:118) at org.exist.extensions.exquery.restxq.impl.RestXqServlet.service(RestXqServlet.java:96) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:224) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98) at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:47) at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:211) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) at java.lang.Thread.run(Thread.java:680) Caused by: org.exist.xquery.XPathException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.xquery.VariableReference.analyze(VariableReference.java:61) at org.exist.xquery.UserDefinedFunction.analyze(UserDefinedFunction.java:110) at org.exist.xquery.FunctionCall.analyze(FunctionCall.java:147) at org.exist.xquery.value.FunctionReference.analyze(FunctionReference.java:65) at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:131) ... 43 more 2012-08-31 16:56:25,754 [eXistThread-43] ERROR (RestXqServlet.java [service]:110) - err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] org.exquery.restxq.RestXqServiceException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:140) at org.exquery.restxq.impl.AbstractRestXqService.service(AbstractRestXqService.java:107) at org.exist.extensions.exquery.restxq.impl.RestXqServiceImpl.service(RestXqServiceImpl.java:118) at org.exist.extensions.exquery.restxq.impl.RestXqServlet.service(RestXqServlet.java:96) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:224) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98) at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:47) at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:211) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:499) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) at java.lang.Thread.run(Thread.java:680) Caused by: org.exist.xquery.XPathException: err:XPDY0002 variable '$test:hello' is not set. [at line 11, column 6, source: /db/test.xql] at org.exist.xquery.VariableReference.analyze(VariableReference.java:61) at org.exist.xquery.UserDefinedFunction.analyze(UserDefinedFunction.java:110) at org.exist.xquery.FunctionCall.analyze(FunctionCall.java:147) at org.exist.xquery.value.FunctionReference.analyze(FunctionReference.java:65) at org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl.execute(ResourceFunctionExecutorImpl.java:131) ... 43 more |