In the following line in my Java program, col returns null:
XPathQueryService service = (XPathQueryService)
col.getService("XPathQueryService","1.0");* This error is equivalent to the database not being present.
* I have tried several known-good versions of the code and database;
all fail with the same error.
* I receive the same error with Xindice 1.0 and 1.1.
* I have tested it under Windows and Linux (both with Tomcat 4.1.27),
both produce the same error.
* The xindice "UglyBrowser" allows me to successfully view my database
through Tomcat.
* The database table is currently in the default location of
~/tomcat/webapps/xindice/WEB-INF/db
* I have tried db.setProperty("db-home") using relative and absolute
paths, to no availI'm starting to run out of ideas now! :-( Niggling questions include:
* What broke? I haven't changed Tomcat or Xindice 1.0 on my Linux box since it was working, whilst the Windows box is a "fresh" installation. * How come the UglyBrowser works, but my code doesn't? My code used to work.
Any help or pointers would be very much appreciated!
Cheers,
Jon
PS: Here's the code I'm using to connect to the database:
------------------------------
public void connect() throws RepositoryException {
try {
Class driver =
Class.forName("org.apache.xindice.client.xmldb.embed.DatabaseImpl"); // initialize a new database, then register it globally
Database db = (Database) driver.newInstance();
db.setProperty("db-home","/home/jon/tomcat/webapps/xindice/WEB-INF"); db.setProperty("managed","true");
DatabaseManager.registerDatabase(db);
col =
DatabaseManager.getCollection("xmldb:xindice-embed:///db/sne/");
if (col==null) {
throw new RepositoryException("Col is null!");
}
}
------------------------------
PPS: Apologies if this mail is duplicated, but I don't seem to be recieving a copy from the list. :-(
