this is my function used to add an element of my hansard document as an xml
document in xindice :
/**
* @param sgbdxBaseCollection : la sgbdx + collection vis�e
* @param element : l'�l�ment � ajouter
* Ajoute un seul �l�ment � une collection
*/
private static void addElementToCollection(String sgbdxBaseCollection,
String element) {
String content = null;
Collection col = null;
try {
col = DBConnection.getCollection(sgbdxBaseCollection);
content = (String) element.toString();
XMLResource document = (XMLResource) col.createResource(null,
"XMLResource");
document.setContent(content);
col.storeResource(document);
} catch (XMLDBException e) {
System.err.println("[ ERROR XML:DB ] Exception occured ");
System.out.println("XMLDBException error code " + e.errorCode);
System.out.println("XMLDBException vendor error code " + e.vendorErrorCode);
e.printStackTrace();
} catch (Exception ex) {
System.err.println("[ ERROR ] Exception occured ");
ex.printStackTrace();
} finally {
if (col != null) {
try {
col.close();
} catch (XMLDBException ex) {
System.err.println(ex);
ex.printStackTrace();
}
}
}
}


the exception is thrown in the call
col.storeResource(document);

and this is the trace :

[ ERROR XML:DB ] Exception occured
org.xmldb.api.base.XMLDBException: :Filer is closed
at
org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.runRemoteCommand(Colle
ctionImpl.java:201)
at
org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.storeResource(Collecti
onImpl.java:318)
at
ca.crim.rap.repository.command.RepositoryXindicePopulator.addElementToCollec
tion(RepositoryXindicePopulator.java:279)
at
ca.crim.rap.repository.command.RepositoryXindicePopulator.addToSgbdx(Reposit
oryXindicePopulator.java:195)
at
ca.crim.rap.repository.command.RepositoryXindicePopulator.insertDocuments(Re
positoryXindicePopulator.java:63)
at
ExecuteRepositoryXindicePopulator.main(ExecuteRepositoryXindicePopulator.jav
a:24)



the program run correctly after a lot of iterations. each iteration do a lot
of work (creating subcollections and inserting data in each collection). I
have data for 3 years, it is difficult to put breakpoints....
I use eclipse environnment and I run the program from eclipse on windows. If
I change the database parameter (xmldb:xindice://server:port) to point to
xindice on linux, the program run correctly until the end!....

Reply via email to