Abdeslam Nasri
2017-07-12 22:18:00 UTC
Hello,
We are using eXist DB 2.0 to store XML documents. The CRUD operations are
orchestrated by an Apache ServiceMix. In conf.xml we scheduled a database
backup every night through a cron XML tag. Recently we started to have a
recurrent issue in that the scheduled backup do not fire over night because
an update operation crashes in the day causing a document set to stay
locked until a database restart is performed.
On the basis of the stacktrace bellow we are suggesting a small change in
the method "org.exist.xquery.update.Modification.selectAndLock()" in
Modification.java at 157 and an unlockDocuments() in the catch block. Can
anybody help validate the suggested change ? Because the test case can only
be produced in production.
The stacktrace:
========================
An unknown error occurred: null</pre></p><h3>Caused
by:</h3><pre>javax.servlet.ServletException: An unknown error occurred: null
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
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:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.exist.xquery.update.Modification.selectAndLock(Modification.java:157)
at org.exist.xquery.update.Replace.eval(Replace.java:125)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at
org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
at org.exist.xquery.Atomize.eval(Atomize.java:66)
at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.SequenceConstructor.eval(SequenceConstructor.java:84)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.EnclosedExpr.eval(EnclosedExpr.java:80)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.ElementConstructor.eval(ElementConstructor.java:307)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:57)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:64)
at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.XQuery.execute(XQuery.java:257)
at org.exist.xquery.XQuery.execute(XQuery.java:204)
at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1525)
at org.exist.http.RESTServer.doPost(RESTServer.java:663)
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:445)
... 41 more
</pre>
<h3>Caused by:</h3><pre>java.lang.NullPointerException
at org.exist.xquery.update.Modification.selectAndLock(Modification.java:157)
at org.exist.xquery.update.Replace.eval(Replace.java:125)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at
org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
at org.exist.xquery.Atomize.eval(Atomize.java:66)
at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.SequenceConstructor.eval(SequenceConstructor.java:84)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.EnclosedExpr.eval(EnclosedExpr.java:80)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.ElementConstructor.eval(ElementConstructor.java:307)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:57)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:64)
at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.XQuery.execute(XQuery.java:257)
at org.exist.xquery.XQuery.execute(XQuery.java:204)
at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1525)
at org.exist.http.RESTServer.doPost(RESTServer.java:663)
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:445)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
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:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
===============
The new lines are in bold font face :
protected StoredNode[] selectAndLock(Txn transaction, Sequence nodes)
throws LockException, PermissionDeniedException,
XPathException, TriggerException {
Lock globalLock =
context.getBroker().getBrokerPool().getGlobalUpdateLock();
try {
globalLock.acquire(Lock.READ_LOCK);
lockedDocuments = nodes.getDocumentSet();
// acquire a lock on all documents
// we have to avoid that node positions change
// during the modification
lockedDocuments.lock(context.getBroker(), true, false);
StoredNode ql[] = new StoredNode[nodes.getItemCount()];
for (int i = 0; i < ql.length; i++) {
Item item = nodes.itemAt(i);
if (!Type.subTypeOf(item.getType(), Type.NODE))
throw new XPathException(this, "XQuery update
expressions can only be applied to nodes. Got: " +
item.getStringValue());
NodeValue nv = (NodeValue)item;
if (nv.getImplementationType() == NodeValue.IN_MEMORY_NODE)
throw new XPathException(this, "XQuery update
expressions can not be applied to in-memory nodes.");
Node n = nv.getNode();
* // ANI : sometimes n is null, so check it first*
* if (null == n)*
* throw new XPathException(this, "XQuery update
expressions can not be continued when node value is empty. Item is: " +*
* item.getStringValue() + ", node value is: " +
nv.getStringValue());*
if (n.getNodeType() == Node.DOCUMENT_NODE)
throw new XPathException(this, "Updating the document
object is not allowed.");
ql[i] = (StoredNode) n;
DocumentImpl doc = (DocumentImpl)ql[i].getOwnerDocument();
//prepare Trigger
prepareTrigger(transaction, doc);
}
return ql;
} finally {
globalLock.release(Lock.READ_LOCK);
* //ANI : In case: nv.getNode() returns a null pointer, we should
unlock the locked documents so cron jobs can proceed.*
* unlockDocuments();*
}
}
Any help is highly appreciated.
We are using eXist DB 2.0 to store XML documents. The CRUD operations are
orchestrated by an Apache ServiceMix. In conf.xml we scheduled a database
backup every night through a cron XML tag. Recently we started to have a
recurrent issue in that the scheduled backup do not fire over night because
an update operation crashes in the day causing a document set to stay
locked until a database restart is performed.
On the basis of the stacktrace bellow we are suggesting a small change in
the method "org.exist.xquery.update.Modification.selectAndLock()" in
Modification.java at 157 and an unlockDocuments() in the catch block. Can
anybody help validate the suggested change ? Because the test case can only
be produced in production.
The stacktrace:
========================
An unknown error occurred: null</pre></p><h3>Caused
by:</h3><pre>javax.servlet.ServletException: An unknown error occurred: null
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
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:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.exist.xquery.update.Modification.selectAndLock(Modification.java:157)
at org.exist.xquery.update.Replace.eval(Replace.java:125)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at
org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
at org.exist.xquery.Atomize.eval(Atomize.java:66)
at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.SequenceConstructor.eval(SequenceConstructor.java:84)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.EnclosedExpr.eval(EnclosedExpr.java:80)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.ElementConstructor.eval(ElementConstructor.java:307)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:57)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:64)
at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.XQuery.execute(XQuery.java:257)
at org.exist.xquery.XQuery.execute(XQuery.java:204)
at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1525)
at org.exist.http.RESTServer.doPost(RESTServer.java:663)
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:445)
... 41 more
</pre>
<h3>Caused by:</h3><pre>java.lang.NullPointerException
at org.exist.xquery.update.Modification.selectAndLock(Modification.java:157)
at org.exist.xquery.update.Replace.eval(Replace.java:125)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at
org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
at org.exist.xquery.Atomize.eval(Atomize.java:66)
at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:153)
at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:324)
at org.exist.xquery.FunctionCall.eval(FunctionCall.java:229)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.SequenceConstructor.eval(SequenceConstructor.java:84)
at
org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:96)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.EnclosedExpr.eval(EnclosedExpr.java:80)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.ElementConstructor.eval(ElementConstructor.java:307)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:57)
at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:64)
at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
at org.exist.xquery.BindingExpression.eval(BindingExpression.java:156)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.PathExpr.eval(PathExpr.java:264)
at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
at org.exist.xquery.XQuery.execute(XQuery.java:257)
at org.exist.xquery.XQuery.execute(XQuery.java:204)
at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1525)
at org.exist.http.RESTServer.doPost(RESTServer.java:663)
at org.exist.http.servlets.EXistServlet.doPost(EXistServlet.java:445)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
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:669)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
===============
The new lines are in bold font face :
protected StoredNode[] selectAndLock(Txn transaction, Sequence nodes)
throws LockException, PermissionDeniedException,
XPathException, TriggerException {
Lock globalLock =
context.getBroker().getBrokerPool().getGlobalUpdateLock();
try {
globalLock.acquire(Lock.READ_LOCK);
lockedDocuments = nodes.getDocumentSet();
// acquire a lock on all documents
// we have to avoid that node positions change
// during the modification
lockedDocuments.lock(context.getBroker(), true, false);
StoredNode ql[] = new StoredNode[nodes.getItemCount()];
for (int i = 0; i < ql.length; i++) {
Item item = nodes.itemAt(i);
if (!Type.subTypeOf(item.getType(), Type.NODE))
throw new XPathException(this, "XQuery update
expressions can only be applied to nodes. Got: " +
item.getStringValue());
NodeValue nv = (NodeValue)item;
if (nv.getImplementationType() == NodeValue.IN_MEMORY_NODE)
throw new XPathException(this, "XQuery update
expressions can not be applied to in-memory nodes.");
Node n = nv.getNode();
* // ANI : sometimes n is null, so check it first*
* if (null == n)*
* throw new XPathException(this, "XQuery update
expressions can not be continued when node value is empty. Item is: " +*
* item.getStringValue() + ", node value is: " +
nv.getStringValue());*
if (n.getNodeType() == Node.DOCUMENT_NODE)
throw new XPathException(this, "Updating the document
object is not allowed.");
ql[i] = (StoredNode) n;
DocumentImpl doc = (DocumentImpl)ql[i].getOwnerDocument();
//prepare Trigger
prepareTrigger(transaction, doc);
}
return ql;
} finally {
globalLock.release(Lock.READ_LOCK);
* //ANI : In case: nv.getNode() returns a null pointer, we should
unlock the locked documents so cron jobs can proceed.*
* unlockDocuments();*
}
}
Any help is highly appreciated.
--
Kind Regards,
Kind Regards,