I´m glad that you are
right. It simply was an error with my classpath. I checked it different times
but now it works fine. Thx, Christoph Von: CORMIER Mario
[mailto:[EMAIL PROTECTED] The code looks good to
me. It definitely looks like it’s a simple matter of a missing jar
in your classpath. Make sure you have the Xindice jar(s) in your
classpath, and verify that they contain the driver class. Mario -----Original
Message----- I´m running Xindice 1.1b4
on Tomcat 4.1.24. If I try to retrieve a document via console, I have no
problems. Now I tried to search for a document within a java class: import
org.xmldb.api.base.*; import
org.xmldb.api.modules.*; import org.xmldb.api.*; public class Read { public
static void main(String[] args) throws Exception {
Collection col = null;
try {
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col = DatabaseManager.getCollection("xmldb:xindice://localhost:8080/db/test");
String xpath = "/output/ART/A0/SSTW";
XPathQueryService service =
(XPathQueryService) col.getService("XPathQueryService",
"1.0");
ResourceSet resultSet = service.query(xpath);
ResourceIterator results = resultSet.getIterator();
while (results.hasMoreResources()) {
Resource res = results.nextResource();
System.out.println((String)
res.getContent());
}
}
catch (XMLDBException e) {
System.err.println("XML:DB Exception occurred " + e.errorCode);
}
finally {
if (col != null) {
col.close();
}
} } } If I try to run this
program, I get the following errors and have no idea where it comes from. java.lang.ClassNotFoundException:
org.apache.xindice.client.xmldb.DatabaseImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at main.Read.main(Read.java:24) Exception in thread "main" |
- Problem to retrieve a document within a java class Pasche
- RE: Problem to retrieve a document within a java class CORMIER Mario
- AW: Problem to retrieve a document within a java cl... Pasche