Project

Profile

Help

XQuery from EJB - Can't load file

Added by Anonymous almost 18 years ago

Legacy ID: #4098222 Legacy Poster: pirana01 (pirana01)

Hi, I am trying to do something very basic and am a novice: I am running the following code from an EJB: -------------------------------------------------------------------------- 1. Configuration config = new Configuration(); 2. StaticQueryContext staticContext = new StaticQueryContext(config); 3. DynamicQueryContext dynamicContext = new DynamicQueryContext(config); 4. XQueryExpression exp = StaticContext.compileQuery("doc(&quot;/myFolder/myFile.xml&quot;)/users/user"); 5. SequenceIterator it = exp.iterator(dynamicContext); 6. List users = (List)exp.evaluate(dynamicContext); -------------------------------------------------------------------------- This gives me the list of all users in the file. However, since file i/o is not allowed from within EJB, I get the following exception on running the code. (The exception occurs in line 5) <b> net.sf.saxon.trans.DynamicError: java.io.FileNotFoundException: \myFolder\myFile.xml (Access is denied) </b>


Replies (1)

RE: XQuery from EJB - Can't load file - Added by Anonymous almost 18 years ago

Legacy ID: #4099960 Legacy Poster: Michael Kay (mhkay)

I'm sorry, I don't know much about EJB. If you want to run a Saxon query in an environment where file I/O isn't allowed, then you'll have to find some way of passing the source document and the query across as objects in memory - either as lexical XML in a stream, or as a pre-built tree in memory.

    (1-1/1)

    Please register to reply