my dog learned polymorphism
The moose likes XML and Related Technologies and the fly likes ==> saxonb : but : RuntimeException: No query engine found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "==> saxonb : but : RuntimeException: No query engine found" Watch "==> saxonb : but : RuntimeException: No query engine found" New topic

==> saxonb : but : RuntimeException: No query engine found

Aimee Best

Joined: Feb 27, 2010
Posts: 4

I am trying to use saxon to xquery an xml file with Java, below is the code just to give you an idea what I am trying to do (there is nothing wrong with it).

The thing is, if I try to run it, I get

Exception in thread "main" java.lang.RuntimeException: No query engine found
at XMLBeansCursor.selectWithXQuery(
at TestXMLBeansCursor.main(

even though I have saxonb in the classpath

set cp=%classpath%;books.jar
set cp=%cp%;%saxon%\saxon9-dom4j.jar
set cp=%cp%;%saxon%\saxon9-jdom.jar
set cp=%cp%;%saxon%\saxon9-s9api.jar
set cp=%cp%;%saxon%\saxon9-sql.jar
set cp=%cp%;%saxon%\saxon9-xom.jar
set cp=%cp%;%saxon%\saxon9-xpath.jar
set cp=%cp%;%saxon%\saxon9-xqj.jar

java -cp %cp% TestXMLBeansCursor

The funny thing is, in eclipse this runs ok.

I can't see what's wrong, why does it work in eclipse but not on the command line?

Has anybody seen something like this before? Any ideas?

I am using java 6 update 18.

Thanks a lot in advance for any hints.

public void selectWithXQuery(File xmlFile) {
try {
InventoryDocument inventory =
XmlCursor cursor = inventory.newCursor();

String query =
"for $a in $this/inventory/book[1]"
+ "return $a/@author";

XmlCursor result = cursor.execQuery(query);

catch (IOException e){
catch (XmlException e){

} // end selectWithXQuery

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Perhaps, contrary to what you think, Saxon is not in your classpath. I would review what's actually in that %saxon% variable, and also the list of Saxon jars which you have in your Eclipse build path compared to that list.
I agree. Here's the link:
subject: ==> saxonb : but : RuntimeException: No query engine found
It's not a secret anymore!