I have been trying run a scheduled xquery but I receive the following
an error (in the scheduler.log) :
2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
(JobRunShell.java [run]:207) - Job eXist.User.XQuery:
/db/test/test.xql threw a JobExecutionException:
org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
in the Job: XPDY0002 : undefined context sequence for
'child::test.xql'! Unscheduling UserXQueryJob.
at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
I can't go any further and I will really appreciate any help.
Regards,
Tom
Bellow is the code I am trying to run:
----- run-test.xql -----
xquery version "1.0" encoding "UTF-8";
declare default function namespace "
http://www.w3.org/2005/xpath-functions";
declare namespace request="
http://exist-db.org/xquery/request";
declare namespace xdb="
http://exist-db.org/xquery/xmldb";
declare boundary-space strip;
declare option exist:serialize "method=xml media-type=text/xml";
let $login := xmldb:login( "/db", "admin", "pass" )
let $sheduled := 'test.xql'
let $coll-path := '/db/test'
let $xquery-path := concat( $coll-path, '/', $sheduled )
let $cron := '0,10,20,30,40,50 * * * * ?'
let $mode := request:request-parameter('mode', 'check')
let $collection-ok := if( not( xdb:collection-exists ( $coll-path )) )
then xdb:create-collection( '/db' , 'test' )
else ()
let $result :=
if( $mode = 'start' )
then (
scheduler:delete-scheduled-job( concat( 'XQuery: ',
$xquery-path ) ),
xdb:store( $coll-path, $sheduled, $sheduled ),
scheduler:schedule-xquery-cron-job( $xquery-path, $cron )
)else if( $mode = 'stop' )
then (
scheduler:delete-scheduled-job( concat( 'XQuery: ',
$xquery-path ) )
)else ()
return
<result>
{ $result }
{ scheduler:get-scheduled-jobs()//scheduler:group[
@name="eXist.User" ] }
</result>
----- test.xql ------------------
xquery version "1.0" encoding "UTF-8";
declare default function namespace "
http://www.w3.org/2005/xpath-functions";
declare namespace xdb="
http://exist-db.org/xquery/xmldb";
declare boundary-space strip;
declare option exist:serialize "method=xhtml media-type=text/html
omit-xml-declaration=no indent=yes";
let $login := xdb:login( "/db", "admin", "pass" )
let $log := 'log.xml'
let $coll-path := '/db/test'
let $log-path := concat( $coll-path, '/', $log )
let $step := <test >{ current-time() }</test>
let $temp := update insert $step into doc( $log-path )/*
return
<div>
{ $step }
</div>
--- log.xml --
<root/>
-------------------------------------------------------------------------
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