Page 1 of 1

Error importing function modules with eXist

Posted: Sat Mar 04, 2006 7:27 pm
by duck1123
I have been testing out the new integration with an eXist db. I have done everything I'm supposed to, including compiling the latest version from CVS, and copying all of the relevant jars, and I am able to send XQuries to eXist and get the propper results back. (a little slowly maybe, but that just may be my computer.)

I am opening a XQuery from /db/kronk/mycyclopedia/ by using the Webdav interface. Everything works fine, until I try to open a query that references a *.xqm (XQuery Module) located in the same collection/folder.

My XQuery looks like this:
(: snip :)
import module namespace mycf="" at "functions.xqm";
(: snip :)

when I try to run or validate this query, I get the error:
SystemID: http://kronk@ ... irthday.xq
Description: error found while loading module mycf: source for module not found: cannot read module source from file at C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\exist\functions.xqm

shouldn't Oxygen try to load that file from: http://kronk@ ... ctions.xqm and not from the exist webapp directory in Tomcat? Is this a bug, or am I just doing something wrong. (The query works from within eXist)

Daniel E. Renfer (

Posted: Mon Mar 06, 2006 3:40 pm
by stefan
The eXist server loads modules relative to its own context and we cannot change that from oXygen (that connects to the server remotely - through XML-RPC). You will get the same result running eXist Client Shell and using the Remote type to connect.

It is a good practice to not use relative paths for imported modules but use instead the following:

- if the module is in your database : xmldb:exist:///db/path/module.xq
- if the module is in your file system : file:///C:/path/module.xq
- if the module is available through http : http://server/path/module.xq.

In your case, the import will look like that:

import module namespace mycf="" at "xmldb:exist:///db/kronk/mycyclopedia/functions.xqm";