D2Method ClassCastException
I am trying to invoke the D2CoreMethod from a Java program using the D2Method class. When I call the D2Method.start() method, I get the following exception:
java.lang.ClassCastException: com.documentum.fc.client.DfSysObject___PROXY cannot be cast to com.emc.common.dctm.methods.IC6MethodReturn at com.emc.d2.api.methods.D2Method.start(D2Method.java:484) at com.emc.d2.api.methods.D2Method.start(D2Method.java:298) at com.emc.d2.api.methods.D2Method.start(D2Method.java:275)
This D2Method and D2CoreMethod classes are in the D2-API-20.2.0.jar file. Has anyone used this D2Method successfully in D2 v20.2? This is a new content server and D2 installation.
TIA!
Comments
-
Hi @paul_wms , I see that your post hasn't garnered any comments from the community. Have you been able to resolve this on your own, or is it still open for discussion?
0 -
I have not resolved that issue. Due to the lack of response, I quit that approach and am invoking the method asynchronously on the server using session.apply(null, "DO_METHOD",...) instead. I don't think the method can be invoked successfully using the D2-API-20.2.0.jar as it is now.
0 -
I'm calling D2CoreMethod from a job and it works fine, e.g :
D2CoreMethod.execute(userName, session, job, sysobjList, false, false, true, true, false);
You need to retrieve the job first like this
job = (IDfSysObject) session.getObjectByQualification("dm_job where object_name = 'D2JobCore'");
if (job == null) {
throw new JobException("Failed to retrieve D2JobCore");
}
// seems to be required before calling D2CoreMethod to avoid class cast issues
D2Session.initTBO(session);
0 -
The exaception thrown to indicate that your code has attempted to cast an object to a subclass of which it is not an instance. This means that ClassCastException occurs when you try to cast an instance of an Object to a type that it is not. Type Casting 5 only works when the casted object follows an is a relationship to the type you are trying to cast to.
It is good practice to guard any explicit casts with an instanceof check first:
if (myApple instanceof Fruit) {
Fruit myFruit = (Fruit)myApple;
}
When will be ClassCastException is thrown:
- When you try to cast an object of Parent class to its Child class type, this exception will be thrown.
- When you try to cast an object of one class into another class type that has not extended the other class or they don’t have any relationship between them
0
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management