Custom module and method issue

Options
Imran_Yusubov
edited February 7, 2013 in Documentum #1

Hello Experts,

I am facing a very strange situation, please share your knowladge if you had encountered such an issue.

I have created one sever method and now I want to call another module from this method. So, I have created  interface and implementation classes for the module and deployed it to the docbase. Now, the problem is that, if I call this module using a Test class or using process builder, it runs without an issue.

If I call the method which should fire this module too, it fails to cast the implementation class to the interace.

=========================

2013-02-07 16:37:14,426 ERROR [STDERR] (http-0.0.0.0-9080-1) java.lang.ClassCastException: com.sinam.modules.PostApprovalCaseProcessingImpl cannot be cast to com.sinam.modules.PostApprovalCaseProcessing

My interface

=========================

package com.sinam.modules;import com.documentum.fc.client.IDfModule;import com.documentum.fc.common.IDfId;public interface PostApprovalCaseProcessing extends IDfModule {    public void doProcessing(IDfId docObjId) throws Exception;}

My Implementation class

=========================

package com.sinam.modules;import com.documentum.fc.client.DfSingleDocbaseModule;import com.sinam.modules.PostApprovalCaseProcessing;public class PostApprovalCaseProcessingImpl extends DfSingleDocbaseModule implements PostApprovalCaseProcessing {    @Override    public void doProcessing(IDfId docObjId)throws Exception {       System.out.println("Hello");            }}

My custom test method for firing the module

=========================


package com.sinam.test;  import com.sinam.modules.PostApprovalCaseProcessing;import com.documentum.fc.common.DfId;import com.documentum.fc.common.IDfId;import com.documentum.fc.common.IDfLoginInfo;import com.documentum.fc.client.IDfSession;import com.documentum.fc.client.IDfSessionManager;import com.documentum.com.DfClientX;import com.documentum.com.IDfClientX;public class Test {        public static void main(String args[]) throws Exception{                //Create a session        IDfClientX clientx=new DfClientX();        IDfClient client=clientx.getLocalClient();        IDfLoginInfo logInfo=clientx.getLoginInfo();        logInfo.setUser("dmadmin");        logInfo.setPassword("--");        logInfo.setDomain(null);                IDfSessionManager sessionManager=client.newSessionManager();        sessionManager.setIdentity("Test",logInfo);        IDfSession session=sessionManager.newSession("Test");        System.out.println("New session created for docbase "+session.getDocbaseName()+" with ID "+session.getDocbaseId());               //Doc id        IDfId docObjId=new DfId("09026c198000b134");                    PostApprovalCaseProcessing pp=  (PostApprovalCaseProcessing) client.newModule(session.getDocbaseName(), PostApprovalCaseProcessing.class.getName(), session.getSessionManager());        pp.doProcessing(docObjId);          }}

There is no reason for it to fail, and I don't know why it fails in JMS but works in Test class.

Thanks in advance

Tagged:

Best Answer

  • PanfilovAB
    edited February 7, 2013 #2 Answer ✓
    Options

    Your problem can be relatd to classloader, so at first you should investigate where JMS loads PostApprovalCaseProcessing class from. The best way is run JMS JVM with -verbose:class option.

Answers

  • PanfilovAB
    edited February 7, 2013 #3 Answer ✓
    Options

    Your problem can be relatd to classloader, so at first you should investigate where JMS loads PostApprovalCaseProcessing class from. The best way is run JMS JVM with -verbose:class option.

  • Imran_Yusubov
    edited February 7, 2013 #4
    Options

    Hello Expert,

    Thank you very much. Right after your post, I turned on the option and found out that, the same interface class is being downloaded from docbase as part of two different jar files. After correcting this situation, it worked finally.