Topic
3 replies Latest Post - ‏2013-10-16T14:31:04Z by CharlieCat
CharlieCat
CharlieCat
2 Posts
ACCEPTED ANSWER

Pinned topic FNRCA0024E: API_PROPERTY_NOT_IN_CACHE

‏2013-10-15T01:14:18Z |

I'm trying to run this sample code below, but I"m getting this error:

FNRCA0024E: API_PROPERTY_NOT_IN_CACHE: The Name property was not found in the properties collection

 

importjavax.security.auth.Subject;

importcom.filenet.api.core.Factory;

importcom.filenet.api.core.Connection;

importcom.filenet.api.core.Domain;

importcom.filenet.api.core.ObjectStore;

importcom.filenet.api.util.UserContext;

 

public classFNConnTest

{

       public static voidmain(String[] args)

       {

              String uri = "https://nr1twvecm001.rb.win.frb.org:9443/wsi/FNCEWS40MTOM/";

              String username = Toggles.strGetLoginName;

              String password = Toggles.strGetPassword;

              String osName = "Support";

 

              Connection conn = Factory.Connection.getConnection(uri);

              Subject subject = UserContext.createSubject(conn, username,  password,  null);   

              UserContext uc = UserContext.get();

              uc.pushSubject(subject);

 

              Domain domain = Factory.Domain.getInstance(conn, null);             

              System.out.println("Domain Name is:  "+ domain.get_Name());                                   

              ObjectStore store = Factory.ObjectStore.fetchInstance(domain, osName, null);

              System.out.println("ObjectStore is:  "+ store.get_Name());

       }

}

 

Any suggestions?

 

  • mattiasgreen
    mattiasgreen
    1 Post
    ACCEPTED ANSWER

    Re: FNRCA0024E: API_PROPERTY_NOT_IN_CACHE

    ‏2013-10-15T05:06:39Z  in response to CharlieCat

    Hi,

    If you check the documentation for the Factory.Domain.getInstance, it reads (emphasis mine):

    "This method does not verify the existence of the requested object on the server; it simply returns a local reference without making a round-trip to the server. The local reference is not affiliated with an object of this class type until you perform a function on the object (for example, fetch a property value) that causes a round-trip to the Content Engine server."

    http://pic.dhe.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.ce.dev.java.doc/com/filenet/api/core/Factory.Domain.html

    Using getInstance is fine for other use cases, but you need to be careful with your choice of get vs. fetch and read up on the differences. Reading up on property filters (http://pic.dhe.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.ce.dev.java.doc/com/filenet/api/property/PropertyFilter.html) is also wise.

    Try changing as follows. Note, however, that you could have chosen to get the domain and then instead fetch the name property, as an alternative.

    Domain domain = Factory.Domain.getInstance(conn, null);
    Domain domain = Factory.Domain.fetchInstance(conn, null);

    Good luck,

    Mattias

     
    Updated on 2013-10-15T05:09:09Z at 2013-10-15T05:09:09Z by mattiasgreen
    • nicolas.leralle
      nicolas.leralle
      16 Posts
      ACCEPTED ANSWER

      Re: FNRCA0024E: API_PROPERTY_NOT_IN_CACHE

      ‏2013-10-15T11:44:58Z  in response to mattiasgreen

      Hi,

      When I migrate my subscriptions from 5.1 to 5.2, I had the same issue when getting my ObjectStore with eventObject.getObjectStore(); function.

       

      To solve this error, I did the following:

       

      ObjectStore objectStore = eventObject.getObjectStore();
      PropertyFilter pf = new PropertyFilter();
      pf.addIncludeProperty(new FilterElement(0, null, Boolean.TRUE, PropertyNames.ID, null));
      pf.addIncludeProperty(new FilterElement(0, null, Boolean.TRUE, PropertyNames.NAME, null));
       
      objectStore.fetchProperties(pf);

      And it works.

       

      Best regards,

       

      Nicolas

      Updated on 2013-10-15T11:47:03Z at 2013-10-15T11:47:03Z by nicolas.leralle
      • CharlieCat
        CharlieCat
        2 Posts
        ACCEPTED ANSWER

        Re: FNRCA0024E: API_PROPERTY_NOT_IN_CACHE

        ‏2013-10-16T14:31:04Z  in response to nicolas.leralle

        Thanks.   It  turned out to be an access/security issue.