Author Topic: storeDocument() using CMOD 8.4 to CMOD 9.0  (Read 3754 times)

RanjithMRK

  • Guest
storeDocument() using CMOD 8.4 to CMOD 9.0
« on: April 17, 2014, 12:02:11 AM »
Hi Team,
                  I am trying to develop a POC for archiving a pdf report into IBM CMOD 9.0.0 using ODWEK

                Server: IBM CMOD 9.0.0
                Client: IBM CMOD 8.4.1, jdk1.6
                 
1)   I installed ODWEK in my machine.
2)   Copied all the *.dll files into system32
3)   Added ODWEK installation directory to PATH
4)   Added ODAPI.jar in CLASSPATH
5)   Developed a java program to archive a pdf report from my local.
6)   Server logon is successful and I am also able to open the folder, application group and application through my program.

But got a null pointer exception com.ibm.edms.od.ODException: A value must be specified for '(null)'
      I manually hardcoded the value to be non-null value and ran it. I am getting the following exception.

com.ibm.edms.od.ODException: CsvRestoreHitFromBuffer Failed (I have attached the screenshots)

Following is the code i am using,

/**
* To Archive reports to IBM CMOD from a local directory
*/
package utility;

import com.ibm.edms.od.ODConfig;
import com.ibm.edms.od.ODConstant;
import com.ibm.edms.od.ODException;
import com.ibm.edms.od.ODFolder;
import com.ibm.edms.od.ODServer;

/**
* @author Ranjith
*
 */
public class ArchiveReports {

       ODConfig odConfig = null;
       ODServer odServer = null;
       
       public void logon(String serverName, String portNo, String userName,
                                       String password) {
                       
                       odConfig = new ODConfig();
                       odServer= new ODServer(odConfig);
                       try {
                                       odServer.setConnectType(ODConstant.CONNECT_TYPE_TCPIP);
                       } catch (ODException e1) {
                                       // TODO Auto-generated catch block
                                       e1.printStackTrace();
                       }

                       odServer.setServerName(serverName);
                       odServer.setPort(Integer.parseInt(portNo));
                       odServer.setUserId(userName);
                       odServer.setPassword(password);
                       try {
                                       odServer.initialize(ArchiveReports.class.getName());
                       } catch (ODException e) {
                                       // TODO Auto-generated catch block
                                       e.printStackTrace();
                       }

                       // logon to the ODServer
                       try {
                                       odServer.logon();

                                       System.out.println("OnDemand server " + odServer.getServerName()
                                                                       + " is alive");
                       
                       } catch (ODException e) {

                                       if (e.getErrorId() == 2107) {
                                                       System.out.print("OnDemand server " + odServer.getServerName()
                                                                                       + " is alive but: ");
                                                       System.out.println(e.getErrorMsg());
                                       } else {
                                                       System.err.println("Encountered error: " + e.getErrorMsg());
                                                       System.err.println(" Error code: " + e.getErrorId());
                                       }
                       } catch (Exception e) {
                                       // Unknown problem
                                       e.printStackTrace();
                       } finally {

                                       /*try {
                                                       odServer.logoff();
                                       } catch (Exception e) {
                                       }
                                       odServer.terminate();*/
                       }
       }
       
       public void addReportToFolder(String folderName, String path, String applicationGroup, String application, String[] values)
       {
                       try {
                                       ODFolder odFolder = odServer.openFolder(folderName);
                                       odFolder.storeDocument(path, applicationGroup, application,values);
                                       //odFolder.getApplGroupNames();
                                       /*odFolder.storeDocument(String path,
                                                                       String appl_grp_name,
                                                                       String appl_name,
                                                                       
                                                                       String[] values);*/
                                       

                       } catch (Exception e) {
                                       // TODO Auto-generated catch block
                                       e.printStackTrace();
                       }
       }
       
       public static void main(String[] args) {
                       

                       String serverName = "xxxx"; // parameters and credentials masked for security
                       String portNo = "xxxxxx";
                       String userName = "xxxx";
                       String password = "xxxx";
                       String folderName ="xxxx";
                       
                       String path ="C:\\Documents and Settings\\p8admin.P8DOMAIN.000\\Desktop\\CMOD Application\\BPF_Explorer_Handbook.pdf";
                       String applicationGroup ="DEMOAG1";
                       String application ="DEMOAPDF";
                       String[] values = {"112233","Ranjith","01/01/70", "Report1","Sample Report", "4/16/14"};
                       
                       ArchiveReports archiveReports = new ArchiveReports();
                       try {
                                       archiveReports.logon(serverName, portNo, userName, password);
                                       archiveReports.addReportToFolder(folderName, path, applicationGroup, application,values);
                       } catch (Exception e) {
                                       e.printStackTrace();
                       }
       }
}


« Last Edit: April 17, 2014, 12:13:59 AM by RanjithMRK »

pankaj.puranik

  • Guest
Re: storeDocument() using CMOD 8.4 to CMOD 9.0
« Reply #1 on: April 17, 2014, 09:40:44 AM »
Did you check the CMOD System Log folder to see if there were any error messages logged there?

RanjithMRK

  • Guest
Re: storeDocument() using CMOD 8.4 to CMOD 9.0
« Reply #2 on: April 19, 2014, 01:57:00 AM »
Yes Pankaj. ODWEK8.4 is not compatible with CMOD 9.0.
Trying with ODWEK 9.0

Thanks anyways.