Hello,

when I try to delete a collection I get the following error:

org.xmldb.api.base.XMLDBException:
Failed to execute command 'RemoveCollection' on server:
http://localhost:8080/xindice/, message: java.lang.Exception:
java.lang.OutOfMemoryError

I use:
Xindice 1.1b4 (WAR) with Tomcat 5.0.19 and J2SDK 1.4.2_03
(I had the same problem with Xindice 1.1b3.)

Creating a collection and listing the content of a collection works - at
least until I deleted a collection. After deleting a collection, creating
one also leads to a "java.lang.OutOfMemoryError". I added the code for
creating and dropping a collection below. I guess it must be something
simple as I don't do anything complicated. (?)

Thank you very much in advance!

       Lars Beuth


I use the following code to create a collection:

(The methods for creating or dropping a collection are called from a servlet
through an event listener.)

Collection collection = null;
boolean success = false;
try
{
        Class c = Class.forName(dbDriver);
        Database database = (Database)c.newInstance();
        DatabaseManager.registerDatabase(database);

        String collectionName = getDestinationName(destination);
        collection = 
DatabaseManager.getCollection(getDestinationPath(destination)
);
        org.apache.xindice.client.xmldb.services.CollectionManager service =
(org.apache.xindice.client.xmldb.services.CollectionManager)collection.getService("CollectionManager",
"1.0");
        try {service.dropCollection(collectionName); } catch (Exception e) {}

        String collectionConfig =
"<collection compressed=\"true\" name=\"" + collectionName + "\">" +
" <filer class=\"org.apache.xindice.core.filer.BTreeFiler\"/>" +
"</collection>";

        service.createCollection(collectionName,
org.apache.xindice.xml.dom.DOMParser.toDocument(collectionConfig) );
        success = true;
}
catch (Exception exception) {printException(exception, ERRORFILE); }
finally {if (collection != null) collection.close(); }
return success;

... and to delete a collection:

Collection collection = null;
boolean success = false;
try
{
        Class c = Class.forName(dbDriver);
        Database database = (Database)c.newInstance();
        DatabaseManager.registerDatabase(database);

        collection = 
DatabaseManager.getCollection(getDestinationPath(destination)
);
        org.apache.xindice.client.xmldb.services.CollectionManager service =
(org.apache.xindice.client.xmldb.services.CollectionManager)collection.getService("CollectionManager",
"1.0");
        service.dropCollection(getDestinationName(destination) );
        success = true;
}
catch (Exception exception) {printException(exception, ERRORFILE); }
finally {if (collection != null) collection.close(); }
return success;

-- 
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info

Reply via email to