There are multiple issues here...

Jonathan Melhuish wrote:

public void connect() throws RepositoryException {
try {
Class driver = Class.forName("org.apache.xindice.client.xmldb.embed.DatabaseImpl");


You are using embedded driver. This means, *database will be running within the JVM of this java program*.


// initialize a new database, then register it globally
Database db = (Database) driver.newInstance();
db.setProperty("db-home","/home/jon/tomcat/webapps/xindice/WEB-INF");


Database, running within this JVM, will mount database files from the specified location.
IMPORTANT: You HAVE TO guarantee that no other process (no other JVM) accesses this database.



db.setProperty("managed","true");


This means that driver will NOT start database automatically. You have to manually start the database, and manually manage database instance.


DatabaseManager.registerDatabase(db);
col = DatabaseManager.getCollection("xmldb:xindice-embed:///db/sne/");


Because you asked for managed mode, and you have not started the database, this method will return null.


Vadim



       if (col==null) {
           throw new RepositoryException("Col is null!");
       }
 }
------------------------------




Reply via email to