• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Aimee Best
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:160)
at org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:85)
at org.apache.xmlbeans.impl.store.Query.cursorExecQuery(Query.java:80)
at org.apache.xmlbeans.impl.store.Cursor._execQuery(Cursor.java:1336)
at org.apache.xmlbeans.impl.store.Cursor._execQuery(Cursor.java:1331)
at org.apache.xmlbeans.impl.store.Cursor.execQuery(Cursor.java:3839)
at XMLBeansCursor.selectWithXQuery(TestXMLBeansCursor.java:40)
at TestXMLBeansCursor.main(TestXMLBeansCursor.java:106)

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
Posts: 22185
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!