Hi,
I'm trying to store a document against a distributed repository (Single repository distributed filestore) using a custom DFC client. When I try to create a new object and save it in docbase, I get a ClassCastException with the following stack trace:
Exception in thread "main" java.lang.ClassCastException: com.documentum.admin.object.DfDistributedStorage___PROXY cannot be cast to com.documentum.fc.client.content.impl.IStore
at com.documentum.fc.client.content.impl.StoreManager.getStore(StoreManager.java:76)
at com.documentum.fc.client.content.impl.StoreManager.getDefaultStoreForType(StoreManager.java:118)
at com.documentum.fc.client.content.impl.StoreManager.getDefaultStoreForType(StoreManager.java:135)
at com.documentum.fc.client.content.impl.storePicker.StorePickerUtils.computeStorageType(StorePickerUtils.java:89)
at com.documentum.fc.client.content.impl.storePicker.AddNewContentStorePicker.determineStore(AddNewContentStorePicker.java:28)
at com.documentum.fc.client.content.impl.ContentManager.makeContentInternal(ContentManager.java:504)
at com.documentum.fc.client.content.impl.ContentManager.verifySetContentandLink(ContentManager.java:475)
at com.documentum.fc.client.content.impl.ContentManager.setStream(ContentManager.java:264)
at com.documentum.fc.client.DfSysObject.doSetContent(DfSysObject.java:1949)
at com.documentum.fc.client.DfSysObject.setContentEx2(DfSysObject.java:1931)
at com.documentum.fc.client.DfSysObject.setContentEx(DfSysObject.java:1925)
at com.documentum.fc.client.DfSysObject.setContent(DfSysObject.java:1920)
at com.documentum.fc.client.DfDocument___PROXY.setContent(DfDocument___PROXY.java)
at com.rmb.edoc.distributedexport.DistributedExportService.storeDocument(DistributedExportService.java:79)
at com.rmb.edoc.distributedexport.DistributedExportService.main(DistributedExportService.java:125)
Am using the following code:
public void storeDocument(String path) {
getSession();
File file = new File(path);
byte [] fileContents = new byte[(int)file.length()];
try {
FileInputStream fos = new FileInputStream(file);
fos.read(fileContents, 0, (int)file.length());
fos.close();
}
catch(IOException ioe) {
ioe.printStackTrace();
}
try {
IDfSysObject object = (IDfSysObject)session.newObject("dm_document");
object.setContentType("pdf");
ByteArrayOutputStream out = new ByteArrayOutputStream();
object.setObjectName("TestDocument");
out.write(fileContents, 0, (int)file.length());
object.setContent(out);
object.save();
}
catch(DfException dfe) {
dfe.printStackTrace();
}
releaseSession(session);
}
I would appreciate any help