From: Jason S. <js...@in...> - 2011-02-22 16:41:07
|
It looks like you have an XQuery that is calling back into your own code, into a command called "enrich." Inside that method, you make a call to addAineistoKuvaus, which in turn is trying to do something with a Xerces DOM document. You are attempting to insert a node where it is not permitted. There isn't really any eXist code involved in the error at this point - it's all MetariV2 and Xerces. Maybe you are trying to do something directly to the document, when you mean to use the documentElement??? Jason Smith ________________________________ From: Lauri Hyttinen [lau...@ho...] Sent: Tuesday, February 22, 2011 5:44 AM To: exi...@li... Subject: Re: [Exist-development] Java exceptions crash the server This is the tailend of the stacktrace + end of the exist output (from startup.sh). The metariv2.MetariV2 stuff is my code. org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source) at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source) at metariv2.MetariV2.addAineistoKuvaus(MetariV2.java:664) at metariv2.MetariV2.enrich(MetariV2.java:1339) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.exist.xquery.JavaCall.eval(JavaCall.java:266) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.LetExpr.eval(LetExpr.java:155) at org.exist.xquery.BindingExpression.eval(BindingExpression.java:158) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:71) at org.exist.xquery.functions.util.CatchFunction.eval(CatchFunction.java:83) at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:56) at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:63) at org.exist.xquery.LetExpr.eval(LetExpr.java:208) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.BindingExpression.eval(BindingExpression.java:158) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:137) at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:274) at org.exist.xquery.FunctionCall.eval(FunctionCall.java:201) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:56) at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:102) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:71) at org.exist.xquery.functions.util.CatchFunction.eval(CatchFunction.java:83) at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:55) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:56) at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:63) at org.exist.xquery.LetExpr.eval(LetExpr.java:208) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.LetExpr.eval(LetExpr.java:206) at org.exist.xquery.BindingExpression.eval(BindingExpression.java:158) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:137) at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:274) at org.exist.xquery.FunctionCall.eval(FunctionCall.java:201) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.PathExpr.eval(PathExpr.java:241) at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61) at org.exist.xquery.XQuery.execute(XQuery.java:228) at org.exist.xquery.XQuery.execute(XQuery.java:183) at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1233) at org.exist.http.RESTServer.doGet(RESTServer.java:435) at org.exist.http.servlets.EXistServlet.doGet(EXistServlet.java:323) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473) at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:263) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171) at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:44) at org.exist.http.urlrewrite.XQueryURLRewrite.doFilter(XQueryURLRewrite.java:203) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568) at org.mortbay.http.HttpContext.handle(HttpContext.java:1530) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633) at org.mortbay.http.HttpContext.handle(HttpContext.java:1482) at org.mortbay.http.HttpServer.service(HttpServer.java:909) at org.mortbay.http.HttpConnection.service(HttpConnection.java:820) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) 22 helmi 2011 13:58:59,906 [Shutdown] INFO (Server.java [run]:555) - Shutdown hook executing 22 helmi 2011 13:58:59,907 [Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080]] INFO (ThreadedServer.java [run]:659) - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080] 22 helmi 2011 13:59:00,026 [Shutdown] INFO (SocketListener.java [stop]:213) - Stopped SocketListener on 0.0.0.0:8080 22 helmi 2011 13:59:00,053 [Shutdown] INFO (Container.java [stop]:156) - Stopped org.mortbay.jetty.servlet.WebApplicationHandler@22ce00 22 helmi 2011 13:59:00,379 [Shutdown] INFO (Container.java [stop]:156) - Stopped WebApplicationContext[/exist,eXist XML Database] 22 helmi 2011 13:59:00,380 [Shutdown] INFO (Container.java [stop]:156) - Stopped org.mortbay.jetty.Server@1c297a3 22 helmi 2011 13:59:00,380 [Shutdown] INFO (Server.java [run]:565) - Shutdown hook complete Failed to release query result on server: Failed to create input stream: Connection refused Failed to release query result on server: Failed to read server's response: Connection refused Failed to release query result on server: Failed to read server's response: Connection refused Failed to release query result on server: Failed to read server's response: Connection refused Failed to release query result on server: Failed to read server's response: Connection refused Failed to release query result on server: Failed to read server's response: Connection refused 22 helmi 2011 14:01:00,131 [Shutdown] ERROR (JettyStart.java [shutdown]:241) - Database shutdown: stopping server in 1sec ... Afterwards when I restart the server: user@server:~/bin/startup.sh Using locale: fi_FI.UTF-8 22 helmi 2011 14:02:58,453 [main] INFO (JettyStart.java [run]:90) - Configuring eXist from /usr/local/exist/conf.xml 22 helmi 2011 14:02:58,454 [main] INFO (JettyStart.java [run]:91) - 22 helmi 2011 14:02:58,454 [main] INFO (JettyStart.java [run]:92) - Running with Java 1.6.0 [Sun Microsystems Inc. (Java HotSpot(TM) Server VM) in /usr/lib/jvm/java-6-sun-1.6.0.00/jre] 22 helmi 2011 14:02:58,455 [main] INFO (JettyStart.java [run]:97) - 22 helmi 2011 14:02:58,456 [main] INFO (JettyStart.java [run]:101) - [eXist Version : 1.4.0] 22 helmi 2011 14:02:58,456 [main] INFO (JettyStart.java [run]:103) - [eXist Build : 20091111] 22 helmi 2011 14:02:58,457 [main] INFO (JettyStart.java [run]:105) - [eXist Home : /usr/local/exist] 22 helmi 2011 14:02:58,457 [main] INFO (JettyStart.java [run]:107) - [SVN Revision : 10440] 22 helmi 2011 14:02:58,458 [main] INFO (JettyStart.java [run]:115) - [Operating System : Linux 2.6.15-53-server i386] 22 helmi 2011 14:02:58,458 [main] INFO (JettyStart.java [run]:118) - [jetty.home : /usr/local/exist/tools/jetty] 22 helmi 2011 14:02:58,459 [main] INFO (JettyStart.java [run]:120) - [log4j.configuration : file:/usr/local/exist/log4j.xml] Redo [=============================================== ] (94 %)= ] (94 %) It gets stuck here. Nothing happens for minutes, until I get bored and ctrl+c it. I may have jumped the gun on this one though, because the the next time server starts the index is broken. PS. I have zeroed on the offending code on my metariv2 stuff to be this part if it helps in any way. while(i2.hasMoreResources()) { XMLResource s = (XMLResource)i2.nextResource(); Node node = s.getContentAsDOM(); Node statmeta_import = node.getFirstChild(); for (int j = 0; j < statmeta_old_classifications.getLength(); j++) { Element link = (Element)statmeta_old_classifications.item(j); if (link.getAttribute("classificationId").equals(luokitusID)) { //Replace the old empty classfication with the one retrieved Node korvattava = statmeta_old_classifications.item(j); Node korvattavan_parent = korvattava.getParentNode(); korvattavan_parent.replaceChild(statmeta_docu.importNode(statmeta_import, true),korvattava); } } } Best regards, Lauri Hyttinen ________________________________ From: da...@ex... Date: Tue, 22 Feb 2011 09:28:01 +0100 Subject: Re: [Exist-development] Java exceptions crash the server To: lau...@ho... CC: exi...@li... Hi, On Tue, Feb 22, 2011 at 8:35 AM, Lauri Hyttinen <lau...@ho...<mailto:lau...@ho...>> wrote: My code causes an org.w3c.dom.DOMException with a HIERACHY REQUEST ERROR being the cause and this causes eXist to shut down. Earlier I had a null pointer exception which also caused the same effect. The null pointer exception is fixed and I am in the process of addressing the DOMException. But regardless of the exception is eXist supposed to shut down when a java module does these things? I know I have to write better java code :) but still it would be easier on the mind when I did not crash the server with my faulty java module. it is unlikely that such an exception crashes the database. To understand your issue better I'd need to see the stacktraces. In general: if the databases stops to respond, in many cases the 'broker' is never returned to the 'brokerpool'. This is fatal since there is just a limited number of brokers available. regards Dannes -- eXist-db Native XML Database - http://exist-db.org Join us on linked-in: http://www.linkedin.com/groups?gid=35624 |