« Return to Thread: Error 400 after update, solved by querying Function Library

Re: Error 400 after update, solved by querying Function Library

by Joe Wicentowski :: Rate this Message:

Reply to Author | View in Thread

Hi Dannes,

I've responded to your suggestions below.  (A disclaimer: Thanks again
for your help.  I wouldn't be continuing to ask the list if I didn't
think there might be an eXist bug at the bottom of this, since it is
puzzling that my page would only work after opening up a built-in
page.  Perhaps my coding is at fault here, but I hope this ends up
exposing an otherwise unknown issue for the eXist developer & user
community.)  Here are my findings:

I inspected the included files (header.xq and footer.xq) and found no
circular references; I did find two get-parameter calls that were no
longer necessary, so I removed those.  I also noticed that both files
lacked a 'serialize as xhtml' declaration, so I added that.  (Is that
necessary to add to included .xq files if the file that calls them
already has this declaration?)  Also, for your information, all 3
files (index.xq, header.xq, footer.xq) validate in oXygen's
eXist-based XQuery validator.

After these changes and repeating my experiment (deleting the
collection and re-uploading it), the log file now shows the following
when I call up index.xq:

2008-05-14 19:39:14,294 [P1-2] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:39:14,294 [P1-2] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:39:14,294 [P1-2] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
method = xhtml
2008-05-14 19:39:14,294 [P1-2] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
media-type = text/html
2008-05-14 19:39:14,305 [P1-2] DEBUG (XQuery.java [execute]:222) -
Execution took 10 ms
2008-05-14 19:39:14,305 [P1-2] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0
2008-05-14 19:39:14,306 [P1-2] DEBUG (XIncludeFilter.java
[startElement]:212) - processing include ...
2008-05-14 19:39:14,306 [P1-2] DEBUG (XIncludeFilter.java
[processXInclude]:268) - found href="/db/frus/includes/header.xq"
2008-05-14 19:39:14,307 [P1-2] WARN  (RESTServer.java [printResults]:1195) -
java.lang.NullPointerException
        at org.exist.storage.serializers.XIncludeFilter.processXInclude(XIncludeFilter.java:365)
        at org.exist.storage.serializers.XIncludeFilter.startElement(XIncludeFilter.java:214)
        at org.exist.memtree.DocumentImpl.startNode(DocumentImpl.java:933)
        at org.exist.memtree.DocumentImpl.streamTo(DocumentImpl.java:875)
        at org.exist.memtree.NodeImpl.streamTo(NodeImpl.java:635)
        at org.exist.storage.serializers.Serializer.serializeToReceiver(Serializer.java:871)
        at org.exist.storage.serializers.Serializer.serializeToReceiver(Serializer.java:864)
        at org.exist.storage.serializers.Serializer.toSAX(Serializer.java:819)
        at org.exist.http.RESTServer.printResults(RESTServer.java:1186)
        at org.exist.http.RESTServer.executeXQuery(RESTServer.java:987)
        at org.exist.http.RESTServer.doGet(RESTServer.java:309)
        at org.exist.http.servlets.EXistServlet.doGet(EXistServlet.java:316)
        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.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)

Then I began to do my workaround -- opening up the
xquery/functions.xq.  But as soon as I opened up the exist/index.xml,
my page began displaying properly.  Here is the log for the display of
exist/index.xml:

2008-05-14 19:47:37,216 [P1-13] INFO  (XQueryServlet.java [init]:135)
- form-encoding = UTF-8
2008-05-14 19:47:37,216 [P1-13] INFO  (XQueryServlet.java [init]:139)
- container-encoding = UTF-8
2008-05-14 19:47:37,216 [P1-13] INFO  (XQueryServlet.java [init]:143)
- encoding = UTF-8
2008-05-14 19:47:37,269 [P1-13] DEBUG (XQuery.java [compile]:163) -
Query diagnostics:

declare variable $atom:server <5> {
    "http://atomic.exist-db.org"
}


declare variable $atom:uri <6> {
    concat($atom:server, "/atom/summary/wiki/blogs/eXist/")
}

let  <26>
    $uri := $atom:uri cast as xs:anyURI,
    let  <27>
        $response := doc(untyped-value-check[xs:string, $uri])
    return
        atom:format-entry($response/child::atom:feed)
2008-05-14 19:47:37,269 [P1-13] DEBUG (XQuery.java [compile]:169) -
Compilation took 14 ms
2008-05-14 19:47:38,373 [P1-13] DEBUG (NativeBroker.java
[getOrCreateCollection]:600) - Creating collection
'/db/system/temp'...
2008-05-14 19:47:38,396 [P1-13] DEBUG (XQueryContext.java
[storeTemporaryDoc]:2133) - Stored: 941:
/db/system/temp/c813cf857969e8764b0ed5b64f7d88df.xml
2008-05-14 19:47:38,411 [P1-13] DEBUG (XQuery.java [execute]:222) -
Execution took 1,141 ms
2008-05-14 19:47:38,412 [P1-13] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0

And here is the log for the display of my index.xq (sorry this is long):

2008-05-14 19:48:24,783 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,783 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,801 [P1-13] DEBUG (XQuery.java [compile]:165) -
Query diagnostics:
[skipped: more than 150 expressions]
2008-05-14 19:48:24,802 [P1-13] DEBUG (XQuery.java [compile]:169) -
Compilation took 18 ms
2008-05-14 19:48:24,802 [P1-13] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
method = xhtml
2008-05-14 19:48:24,805 [P1-13] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
media-type = text/html
2008-05-14 19:48:24,810 [P1-13] DEBUG (XQuery.java [execute]:222) -
Execution took 5 ms
2008-05-14 19:48:24,811 [P1-13] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0
2008-05-14 19:48:24,811 [P1-13] DEBUG (XIncludeFilter.java
[startElement]:212) - processing include ...
2008-05-14 19:48:24,811 [P1-13] DEBUG (XIncludeFilter.java
[processXInclude]:268) - found href="/db/frus/includes/header.xq"
2008-05-14 19:48:24,816 [P1-13] DEBUG (XQuery.java [compile]:165) -
Query diagnostics:
[skipped: more than 150 expressions]
2008-05-14 19:48:24,816 [P1-13] DEBUG (XQuery.java [compile]:169) -
Compilation took 4 ms
2008-05-14 19:48:24,817 [P1-13] INFO  (XIncludeFilter.java
[processXInclude]:389) - xpointer query: [[[[code removed by joe!]]]]
2008-05-14 19:48:24,818 [P1-13] DEBUG (XQuery.java [execute]:222) -
Execution took 1 ms
2008-05-14 19:48:24,818 [P1-13] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0
2008-05-14 19:48:24,819 [P1-13] DEBUG (XIncludeFilter.java
[processXInclude]:394) - xpointer found: 5
2008-05-14 19:48:24,824 [P1-13] DEBUG (XIncludeFilter.java
[startElement]:212) - processing include ...
2008-05-14 19:48:24,824 [P1-13] DEBUG (XIncludeFilter.java
[processXInclude]:268) - found href="/db/frus/includes/footer.xq"
2008-05-14 19:48:24,834 [P1-13] DEBUG (XQuery.java [compile]:163) -
Query diagnostics: [[[[code removed by joe!]]]]
2008-05-14 19:48:24,835 [P1-13] DEBUG (XQuery.java [compile]:169) -
Compilation took 10 ms
2008-05-14 19:48:24,835 [P1-13] INFO  (XIncludeFilter.java
[processXInclude]:389) - xpointer query: [[[[code removed by joe!]]]]
2008-05-14 19:48:24,836 [P1-13] DEBUG (XQuery.java [execute]:222) -
Execution took 1 ms
2008-05-14 19:48:24,836 [P1-13] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0
2008-05-14 19:48:24,837 [P1-13] DEBUG (XIncludeFilter.java
[processXInclude]:394) - xpointer found: 3
2008-05-14 19:48:24,842 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,842 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,860 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,861 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,862 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,862 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,864 [P1-15] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,864 [P1-15] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,886 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,888 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,889 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,890 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,891 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,891 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,891 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,892 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,893 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,893 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,894 [P1-15] DEBUG (TextSearchEngine.java
[<init>]:112) - using tokenizer:
org.exist.storage.analysis.SimpleTokenizer
2008-05-14 19:48:24,894 [P1-15] DEBUG (NativeBroker.java [<init>]:167)
- Initializing broker 14036251
2008-05-14 19:48:24,895 [P1-15] DEBUG (BrokerPool.java
[createBroker]:1068) - created broker
'org.exist.storage.NativeBroker_exist_2 for database instance 'exist'
2008-05-14 19:48:24,895 [P1-15] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,895 [P1-15] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,896 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,896 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,901 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,901 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,902 [P1-13] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,902 [P1-13] DEBUG (RESTServer.java [doGet]:272) -
query = null
2008-05-14 19:48:24,904 [P1-15] DEBUG (RESTServer.java [doGet]:271) -
stylesheet = null
2008-05-14 19:48:24,905 [P1-15] DEBUG (RESTServer.java [doGet]:272) -
query = null

Thanks very much for any ideas you have,
Joe


On Wed, May 14, 2008 at 1:42 AM, Dannes Wessels <dizzzz@...> wrote:

> Hi,
>
> On Wed, May 14, 2008 at 2:51 AM, Joe Wicentowski <joewiz@...> wrote:
>
>>  First, the 400 code says:
>>    HTTP ERROR: 400
>>    Error while serializing xml: java.lang.NullPointerException
>>    RequestURI=/exist/rest/db/frus/index.xq
>>    Powered by Jetty://
>
> Hmmm this NPE is something what never should happen. Strangely the log
> does not give any clues on this.
>>  2008-05-13 20:39:12,474 [P1-19] DEBUG (RESTServer.java [doGet]:271) -
>>  stylesheet = null
>>  2008-05-13 20:39:12,474 [P1-19] DEBUG (RESTServer.java [doGet]:272) -
>>  query = null
>
> (many times)
>
>>  This file is very simple, basically:
>>  declare namespace xi="http://www.w3.org/2001/XInclude";
>>     <xi:include href="/db/frus/includes/header.xq" />
>>     <xi:include href="/db/frus/includes/footer.xq" />
>
> hmmmm maybe the xincludefilter has a problem here. Are these files
> actually there? do they have circular references?
>
> regards
>
> Dannes
>
> --
> # Dannes Wessels # The Netherlands #
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

 « Return to Thread: Error 400 after update, solved by querying Function Library

LightInTheBox - Buy quality products at wholesale price