Topic
  • No replies
talkietoaster
talkietoaster
4 Posts

Pinned topic RM API issue- unable to initialize file plan object store

‏2009-10-22T23:17:21Z |
I am trying to learn how to use the RM Java API. I have written a very simple program that successfully gets a Session object and connects to an object store.

The next step is to use the ObjectStore object to get a RMObjectStore object (initializing it as a records object store). However, when I attempt to do that, I get an exception which says that it is not a valid file plan object store (which is impossible, because it is the object store that contains our file plan!). I am executing my program from the command prompt; here is a direct cut-and-paste from that window:

Z:\>java ConnectToFPOS_Example .\WcmApiConfig.properties RM845_FPOS p8admin P*Admin
Connected to object store:
WCM: ObjectStoreImpl with id RM845_FPOS in lib RM845_FPOS
Exception in thread "main" com.filenet.rm.api.exception.RMException: Unable to return an instance of RMObjectStore for the ObjectStore WCM: ObjectStoreImpl with id RM845_FPOS in lib RM845_FPOS, which is passed as a parameter. Unable to set the passed objectstore as the Base Object Passed objectstore WCM: ObjectStoreImpl with id RM845_FPOS in lib RM845_FPOS do not support File Plans, the object store is not a valid File Plan objectstore.
at com.filenet.rm.api.exception.RMException.createRMException(RMException.java:249)
at com.filenet.rm.api.exception.RMException.getRMException(RMException.java:199)
at com.filenet.rm.api.util.RMUtil._getRMObjectStore(RMUtil.java:7622)
at ConnectToFPOS_Example.main(ConnectToFPOS_Example.java:67)
Here is my WcmApiConfig.properties file:

RemoteServerUrl = cemp:http://vm-p845dev1:9081/wsi/FNCEWS40DIME/
RemoteServerUploadUrl = cemp:http://vm-p845dev1:9081/wsi/FNCEWS40DIME/
RemoteServerDownloadUrl = cemp:http://vm-p845dev1:9081/wsi/FNCEWS40DIME/

CredentialsProtection = Clear
CredentialsProtection/UserToken = Symmetric

CryptoKeyFile/UserToken = C:\\Program Files\\FileNet\\Authentication\\UTCryptoKeyFile.properties
jaasConfigurationName = FileNetP8Engine
Here is my java source code:
/*
RM API Example- Connecting to an RM file plan object store
*/

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import com.filenet.wcm.api.*;
import filenet.vw.api.*;
import com.filenet.api.exception.*;
import com.filenet.rm.api.*;
import com.filenet.rm.api.util.*;
import com.filenet.rm.api.impl.*;
import java.util.Date;

public class ConnectToFPOS_Example
{
// Constant values:
private static final String appId = "ConnectToFPOS_Example";

// Connection parameters:
static String configPropertiesPath = null;
static String objectStoreName = null;
static String userId = null;
static String password = null;

// Session and object store:
static Session p8Session = null;
static ObjectStore objectStore = null;
static RMObjectStore filePlanObjectStore = null;
public static void main(String args[])
{
// Get object store name, user ID and password from command line:
if (args.length < 4)
{
System.err.println("Usage: ConnectToFPOS_Example " +
"<config_prop_file_path> <object_store_name> " +
"<user_id> <password>");
return;
}
configPropertiesPath = args[0];
objectStoreName = args[1];
userId = args[2];
password = args[3];

// Create session object:
p8Session = ObjectFactory.getSession(appId, null, userId, password);
try
{
p8Session.setConfiguration(new
FileInputStream(configPropertiesPath));
}
catch (FileNotFoundException e)
{
System.err.println("WCM API config properties file not found:");
System.err.println(configPropertiesPath);
}

// Connect to object store:
objectStore = ObjectFactory.getObjectStore(objectStoreName, p8Session);
System.out.println("Connected to object store:");
System.out.println(objectStore);

// Use object store connection to initialize RM object store:
filePlanObjectStore = new RMUtil()._getRMObjectStore(objectStore);
System.out.println("Initialized file plan object store:");
System.out.println(filePlanObjectStore);
}
}
I am using the JAR files from the RM API (located in \Program Files\FileNet\RM\RecordsManager\WEB-INF\lib). The program compiles OK and I do not get any class-not-found errors.

Does anyone know why I should be getting this exception when my object store really IS a file plan object store?

Thanks