random(?) NullPointerException with eXist-2.2

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

random(?) NullPointerException with eXist-2.2

ron.vandenbranden
Hi,

This is a hard one, but I'll try to report what happens. I'm developing
a webapp in eXist-2.2, stored in the db (on Windows 7 Pro, 64 bit,
Oracle JRE-1.8.0_31). From time to time I get a NullPointerException
when requesting a page of my app. The requests are processed by the URL
XQueryURLRewrite servlet. What's strange is that the error seems to
occur randomly: normally, the request (to, say, page1) succeeds without
problem, until the error is thrown. Yet, after some time (and some
successful requests to other pages) the request to page1 succeeds again
without error. What's noticeable is that for some time after the
successful requests to other pages take very long to complete.

Unfortunately, I don't have much more precise information about possible
triggers, apart from the fact that last time I had been editing in eXide
the controller.xql file and some XSLT files for processing the request.
But I can confirm they didn't contain any errors that might have
influenced the request.

I'll attach a relevant fragment from the console output window.

Best,

Ron

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open

nullpointer.log (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

Dmitriy Shabanov
Do you have 'descriptor.xml' file? (try to search for it)

On Thu, Mar 19, 2015 at 6:38 PM, [hidden email]
<[hidden email]> wrote:

> Hi,
>
> This is a hard one, but I'll try to report what happens. I'm developing a
> webapp in eXist-2.2, stored in the db (on Windows 7 Pro, 64 bit, Oracle
> JRE-1.8.0_31). From time to time I get a NullPointerException when
> requesting a page of my app. The requests are processed by the URL
> XQueryURLRewrite servlet. What's strange is that the error seems to occur
> randomly: normally, the request (to, say, page1) succeeds without problem,
> until the error is thrown. Yet, after some time (and some successful
> requests to other pages) the request to page1 succeeds again without error.
> What's noticeable is that for some time after the successful requests to
> other pages take very long to complete.
>
> Unfortunately, I don't have much more precise information about possible
> triggers, apart from the fact that last time I had been editing in eXide the
> controller.xql file and some XSLT files for processing the request. But I
> can confirm they didn't contain any errors that might have influenced the
> request.
>
> I'll attach a relevant fragment from the console output window.
>
> Best,
>
> Ron
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>



--
Dmitriy Shabanov

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

ron.vandenbranden
Hi Dmitriy,

On 20/03/2015 12:18, Dmitriy Shabanov wrote:
> Do you have 'descriptor.xml' file? (try to search for it)
>

Yes, I have it in the eXist installation folder. I haven't changed
anything there, should I?

Best,

Ron


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

Dmitriy Shabanov
What is there?

On Fri, Mar 20, 2015 at 2:35 PM, [hidden email]
<[hidden email]> wrote:

> Hi Dmitriy,
>
> On 20/03/2015 12:18, Dmitriy Shabanov wrote:
>>
>> Do you have 'descriptor.xml' file? (try to search for it)
>>
>
> Yes, I have it in the eXist installation folder. I haven't changed anything
> there, should I?
>
> Best,
>
> Ron
>



--
Dmitriy Shabanov

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

ron.vandenbranden
This is everything, without the comments:

   <xquery-app request-replay-log="false" filtered="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema/descriptor.xsd">
     <allow-source>
       <xquery path="${WEBAPP_HOME}/sandbox/sandbox.xql"/>
       <xquery path="${WEBAPP_HOME}/xquery/guess.xql"/>
       <xquery path="${WEBAPP_HOME}/xquery/transform.xql"/>
       <xquery path="${WEBAPP_HOME}/xquery/login.xql"/>
       <xquery path="${WEBAPP_HOME}/xquery/session.xql"/>
       <xquery path="${WEBAPP_HOME}/xquery/call.xql"/>
     </allow-source>
     <maps>
     </maps>
   </xquery-app>


Best,

Ron

On 20/03/2015 12:34, Dmitriy Shabanov wrote:

> What is there?
>
> On Fri, Mar 20, 2015 at 2:35 PM, [hidden email]
> <[hidden email]> wrote:
>> Hi Dmitriy,
>>
>> On 20/03/2015 12:18, Dmitriy Shabanov wrote:
>>> Do you have 'descriptor.xml' file? (try to search for it)
>>>
>> Yes, I have it in the eXist installation folder. I haven't changed anything
>> there, should I?
>>
>> Best,
>>
>> Ron
>>
>
>


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

Dmitriy Shabanov
Ok, so but code if/when request.getPathTranslated(); return null used
value from getServletContext().getRealPath(path); where path =
request.getRequestURI().substring(request.getContextPath().length());

What logs do you have at time of request that fail?

On Fri, Mar 20, 2015 at 2:40 PM, [hidden email]
<[hidden email]> wrote:

> This is everything, without the comments:
>
>   <xquery-app request-replay-log="false" filtered="true"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="schema/descriptor.xsd">
>     <allow-source>
>       <xquery path="${WEBAPP_HOME}/sandbox/sandbox.xql"/>
>       <xquery path="${WEBAPP_HOME}/xquery/guess.xql"/>
>       <xquery path="${WEBAPP_HOME}/xquery/transform.xql"/>
>       <xquery path="${WEBAPP_HOME}/xquery/login.xql"/>
>       <xquery path="${WEBAPP_HOME}/xquery/session.xql"/>
>       <xquery path="${WEBAPP_HOME}/xquery/call.xql"/>
>     </allow-source>
>     <maps>
>     </maps>
>   </xquery-app>
>
>
> Best,
>
> Ron
>
>
> On 20/03/2015 12:34, Dmitriy Shabanov wrote:
>>
>> What is there?
>>
>> On Fri, Mar 20, 2015 at 2:35 PM, [hidden email]
>> <[hidden email]> wrote:
>>>
>>> Hi Dmitriy,
>>>
>>> On 20/03/2015 12:18, Dmitriy Shabanov wrote:
>>>>
>>>> Do you have 'descriptor.xml' file? (try to search for it)
>>>>
>>> Yes, I have it in the eXist installation folder. I haven't changed
>>> anything
>>> there, should I?
>>>
>>> Best,
>>>
>>> Ron
>>>
>>
>>
>



--
Dmitriy Shabanov

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

ron.vandenbranden
Hi Dmitriy,

On 20/03/2015 12:44, Dmitriy Shabanov wrote:
> Ok, so but code if/when request.getPathTranslated(); return null used
> value from getServletContext().getRealPath(path); where path =
> request.getRequestURI().substring(request.getContextPath().length());
>

Sorry, I don't understand. My code is all XQuery/XSLT, without any
direct Java commands.

> What logs do you have at time of request that fail?
>

Well, strangely enough: none, it seems (apart from the console output I
posted yesterday. The "Open exist log" command from the eXist context
menu (or what is it called) fails with "Failed to open log file".

The last changed date for all of the logs in
/eXist-2.2/webapp/WEB-INF/logs is 18/03, while the error I reported
yesterday happened one day later on 19/03. Looking into
/eXist-2.2/webapp/WEB-INF/logs/exist.log, the last entry reads:

     2015-03-18 10:22:58,996 [Thread-4] INFO  (JettyStart.java [lifeCycleStarting]:413) - Jetty server starting...

Nothing after that.

I've just retested by deleting all logs and restarting the server. This
creates new log files, but my first request already throws a
NullPointerException. Yet, nothing is logged after "Jetty server
starting...", and opening the log file from the eXist context menu still
fails. The console messages in the 'Tool Window' do contain some errors
about incorrect filename syntax; I'll attach the full output of the
console messages.

So, two things seem strange:
     -the NullPointerException (and the fact that it doesn't occur
consistently)
     -the partial logging

Best,

Ron

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open

console.out (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

Dmitriy Shabanov
On Fri, Mar 20, 2015 at 3:08 PM, [hidden email]
<[hidden email]> wrote:
> On 20/03/2015 12:44, Dmitriy Shabanov wrote:
>>
>> Ok, so but code if/when request.getPathTranslated(); return null used
>> value from getServletContext().getRealPath(path); where path =
>> request.getRequestURI().substring(request.getContextPath().length());
>>
>
> Sorry, I don't understand. My code is all XQuery/XSLT, without any direct
> Java commands.

that is eXist's code, for some reason jetty return null instead of
string. So, I'm trying to understand why that happen.

>> What logs do you have at time of request that fail?
>>
>
> Well, strangely enough: none, it seems (apart from the console output I
> posted yesterday. The "Open exist log" command from the eXist context menu
> (or what is it called) fails with "Failed to open log file".
>
> The last changed date for all of the logs in /eXist-2.2/webapp/WEB-INF/logs
> is 18/03, while the error I reported yesterday happened one day later on
> 19/03. Looking into /eXist-2.2/webapp/WEB-INF/logs/exist.log, the last entry
> reads:
>
>     2015-03-18 10:22:58,996 [Thread-4] INFO  (JettyStart.java
> [lifeCycleStarting]:413) - Jetty server starting...
>
> Nothing after that.
>
> I've just retested by deleting all logs and restarting the server. This
> creates new log files, but my first request already throws a
> NullPointerException. Yet, nothing is logged after "Jetty server
> starting...", and opening the log file from the eXist context menu still
> fails. The console messages in the 'Tool Window' do contain some errors
> about incorrect filename syntax; I'll attach the full output of the console
> messages.
>
> So, two things seem strange:
>     -the NullPointerException (and the fact that it doesn't occur
> consistently)
>     -the partial logging

you should search for jetty logs

--
Dmitriy Shabanov

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

ron.vandenbranden
Hi Dmitryi,

On 20/03/2015 13:13, Dmitriy Shabanov wrote:
> that is eXist's code, for some reason jetty return null instead of
> string. So, I'm trying to understand why that happen.

Ok sorry, I didn't realize you were thinking at the Jetty level.


>
> Looking into /eXist-2.2/webapp/WEB-INF/logs/exist.log, the last entry
> reads:
>
>      2015-03-18 10:22:58,996 [Thread-4] INFO  (JettyStart.java
> [lifeCycleStarting]:413) - Jetty server starting...
>
> Nothing after that.
>

This is probably unrelated, but in answer to my previous observation
about partial logging: when looking for Jetty logs, I found that the
/eXist-2.2/loggerdir duplicates the eXist logs, and those in loggerdir
are up-to-date. Strange, still.

> you should search for jetty logs
>

The only Jetty logs I find are in /eXist-2.2/tools/jetty/logs, and are
all request.log files, without much information it seems. For failed
requests, I find nothing more than:

     127.0.0.1 -  -  [20/Mar/2015:12:08:51 +0000] "GET /exist/apps/streuvels/streuvels_site/ed/DALF.db.lms330818 HTTP/1.1" 500 5449

I'm using a standard eXist-2.2 installation with the embedded Jetty
server. Should I do anything to enable more verbose Jetty logging?

Best,

Ron

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: random(?) NullPointerException with eXist-2.2

ron.vandenbranden
Hi again,

I have found the problem. Fortunately, it is less critical than it seemed.

Apparently, some backup files had slipped in my data set, and went
unnoticed. Since their filenames have the form "test.xml.bak", they had
been indexed as binary resources. When the doc() function in an XQuery
module of my app is passed an URL to such a backup file, this doc() call
obviously fails, because it only works for well-formed XML resources. In
other words: this was the error I should have seen:

   err:FODC0005 Error while evaluating expression: doc(). exerr:ERROR Document /db/apps/myapp/data/test.xml.bak is a binary resource, not an XML document.
   Please consider using the function util:binary-doc() to retrieve a reference to it.

Now, in the app's controller following error handler was configured:

   <error-handler>
     <forward url="{$exist:root}/{$exist:controller}/xquery/error-handler.xql"/>
   </error-handler>

Apparently, this made eXist look at the wrong location, where it didn't
find the error-handler.xql file, and because of that the
NullPointerException was thrown.

Removing the "{$exist:root}/" part from the error handler URL solved
this issue, and made the doc() error visible.

Apologies, I got confused by this masked error. Still, if this
NullPointerException is considered abnormal, I hope this info can be of use.

Best,

Ron

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open