Topic
  • 10 replies
  • Latest Post - ‏2012-11-22T14:26:40Z by SystemAdmin
SystemAdmin
SystemAdmin
76 Posts

Pinned topic ObjectNotFoundException when getting object by id after query

‏2012-11-08T12:41:39Z |
Hi
I'm having a problem when getting an object by id after query execution.

I'm using IBM CMIS for IBM Content Manager Version 1.0 on IBM Content Manager Enterprise Edition V8.4.3.
I'm testing a client application using Apache Open CMIS 0.9.0-SNAPSHOT

My application performs a query and retrieves the cmis:objectId field, then I try to get the document from the same object id as follows:


query = 
"SELECT * FROM TEST_AL where cmis:objectId = 'A1001001A12J17B41757D70523'"; ItemIterable<QueryResult> q = session.query(query, 

false); 

for (QueryResult qr : q) 
{ String objectId = qr.getPropertyValueByQueryName(objectIdQueryName); Document document = (Document) session.getObject(session.createObjectId(objectId)); 
}


code fails when hitting session.getObject() (and objectId equals "$d!1144_A1001001A12J17B41757D70523v3") with exception:

DALCM8Excepti E com.ibm.content.cm.logging.Logger error handleException CIL1298: The service cannot be completed because the following object cannot be found: $d!1144_A1001001A12J17B41757D70523v3
Explanation: No additional explanation is required..
Action: Verify that the path or ID of the object is correct or specify a different object..
com.ibm.ecm.cmis.exceptions.ObjectNotFoundException: CIL1298: The service cannot be completed because the following object cannot be found: $d!1144_A1001001A12J17B41757D70523v3
Explanation: No additional explanation is required..
Action: Verify that the path or ID of the object is correct or specify a different object..
at com.ibm.ecm.cmis.dal.cm8.DALCM8Repository.getObjectById(DALCM8Repository.java:641)
at com.ibm.ecm.cmis.app.datasource.ContentSource.getBaseObject(ContentSource.java:98)
at com.ibm.ecm.cmis.app.datasource.ContentSource.getData(ContentSource.java:168)
at com.ibm.ecm.cmis.app.beans.BaseCollection.doGet(BaseCollection.java:941)
at com.ibm.ecm.cmis.app.beans.BaseCollection.get(BaseCollection.java:727)

In the CM_CMIS log file I find:

CQL007: Unexpected internal error. You can ask an administrator to view additional information in the logs for IBM CMIS for Content Manager (if error-level logging enabled in configuration file ".../cmgmt/connectors/cmblogconfig.properties"). Turn on debug or trace level logging and restart the IBM Content Manager Services to gather additional information.
NEW EXCEPTION STACK:
com.ibm.content.cm.model.helper.DatastoreHelper.getItemTypeView(DatastoreHelper.java:887)
com.ibm.content.cm.model.helper.DatastoreHelper.getItemTypeFromItemTypeView(DatastoreHelper.java:857)
com.ibm.content.cm.model.helper.DatastoreHelper.getItemTypeIdFromItemTypeView(DatastoreHelper.java:814)
com.ibm.content.cm.service.NativeService.createQueryForIdField(NativeService.java:6100)
com.ibm.content.cm.service.NativeService.getItemByIdField(NativeService.java:6677)
com.ibm.content.cm.service.NativeService.getItemByIdField(NativeService.java:6606)
com.ibm.content.cm.model.helper.NativeServiceHelper.getItemByIdGenTypePath(NativeServiceHelper.java:562)
com.ibm.content.cm.model.helper.NativeServiceHelper.getItem(NativeServiceHelper.java:331)
com.ibm.content.cm.model.helper.NativeServiceHelper.getItemVersion(NativeServiceHelper.java:147)
com.ibm.content.cm.model.impl.CMDocumentServiceImpl.getDocument(CMDocumentServiceImpl.java:380)
com.ibm.content.cm.model.impl.CMDocumentServiceImpl.getDocumentVersion(CMDocumentServiceImpl.java:397)
com.ibm.ecm.cmis.dal.cm8.model.ModelExtensions.getDocumentVersionFromID(ModelExtensions.java:114)
com.ibm.ecm.cmis.dal.cm8.DALCM8Repository.getDocument(DALCM8Repository.java:316)
com.ibm.ecm.cmis.dal.cm8.DALCM8Repository.getObjectById(DALCM8Repository.java:574)
com.ibm.ecm.cmis.app.datasource.ContentSource.getBaseObject(ContentSource.java:98)
com.ibm.ecm.cmis.app.datasource.ContentSource.getData(ContentSource.java:168)
com.ibm.ecm.cmis.app.beans.BaseCollection.doGet(BaseCollection.java:941)
com.ibm.ecm.cmis.app.beans.BaseCollection.get(BaseCollection.java:727)
com.ibm.ecm.cmis.app.servlet.CMISServlet.doGet(CMISServlet.java:146)
javax.servlet.http.HttpServlet.service(HttpServlet.java:718)

I've also raised trace level on IBM CM and checked ICMSERVER.log but no additional information is available.

The same problem occurs when calling request as

http://lx000000700080:9082/cmcmis/resources/$x!CMLS_CF/Content/$d!1144_A1001001A12J17B41757D70523v3?

and also when performing query and object retrieve from Open CMIS Workbench.

Any advice would be really appreciated.
Best regards,

Luisa
Updated on 2012-11-22T14:26:40Z at 2012-11-22T14:26:40Z by SystemAdmin
  • Dave Sanders
    Dave Sanders
    19 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-08T17:50:59Z  
    Although your code looks correct, it's worth trying the other version of session.getObject.
    Change
    String objectId = qr.getPropertyValueByQueryName(objectIdQueryName);
    Document document = (Document) session.getObject(session.createObjectId(objectId));
    to
    String objectId = qr.getPropertyValueByQueryName(objectIdQueryName);
    Document document = (Document) session.getObject(objectId);
    Also, does the error occur on all documents or certain one?
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-08T18:09:29Z  
    Hi,

    Looks like couple of issues here,
    1. Query has wrong hard coded value for the id. It should be some think like $d!1144_A1001001A12J17B41757D70523.So please change the query .
    2. Why it failed with the correct id?
    For this issue please try after restarting CMIS server. Looks like the document type is created after initial start. So the document type
    information is not available in the cache.
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-09T12:59:44Z  
    Although your code looks correct, it's worth trying the other version of session.getObject.
    Change
    String objectId = qr.getPropertyValueByQueryName(objectIdQueryName);
    Document document = (Document) session.getObject(session.createObjectId(objectId));
    to
    String objectId = qr.getPropertyValueByQueryName(objectIdQueryName);
    Document document = (Document) session.getObject(objectId);
    Also, does the error occur on all documents or certain one?
    Same error occurs even when using session.getObject(objectId).

    It occurs with any item type with base type "cmis:document", it does not occur if base type is "cmis:folder" (obviously changing the query).
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-09T13:00:33Z  
    Hi,

    Looks like couple of issues here,
    1. Query has wrong hard coded value for the id. It should be some think like $d!1144_A1001001A12J17B41757D70523.So please change the query .
    2. Why it failed with the correct id?
    For this issue please try after restarting CMIS server. Looks like the document type is created after initial start. So the document type
    information is not available in the cache.
    1. Query is just an example, I'm hardcoding the id only to limit the result set for this testing. Just for completeness, if querying with id = $d!1144_A... no results are found.

    2. I'll ask to restart CMIS, but I'm not confident since I think that CMIS extension was installed after item type definitions. Anyway I'll check this option too and revert back
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-09T16:56:08Z  
    1. Query is just an example, I'm hardcoding the id only to limit the result set for this testing. Just for completeness, if querying with id = $d!1144_A... no results are found.

    2. I'll ask to restart CMIS, but I'm not confident since I think that CMIS extension was installed after item type definitions. Anyway I'll check this option too and revert back
    Hi,

    If it is not fixed by restarting ,it could be something related to permission on item type, Please check access control (ACL) if it grants permission to the user.
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-12T13:56:29Z  
    Hi,

    If it is not fixed by restarting ,it could be something related to permission on item type, Please check access control (ACL) if it grants permission to the user.
    CMIS restart did not help: same issue.

    As for ACL, document can be accessed by anyone and in addition I have tried the same scenario with CM native API with the same user for the connection and no problems were found.

    Thanks anyway for your support!

    At the moment I don't have any other idea :(
  • TigerTrix
    TigerTrix
    38 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-12T18:02:26Z  
    CMIS restart did not help: same issue.

    As for ACL, document can be accessed by anyone and in addition I have tried the same scenario with CM native API with the same user for the connection and no problems were found.

    Thanks anyway for your support!

    At the moment I don't have any other idea :(
    Just to be clear, CMIS does support cmis:id, a required property. It is the basis of most operations and URLs.

    If the ID syntax is not valid, such as if a native ID is used in place of a CMIS ID (which is a different syntax than native ID), a different API usage error would be reported. Your error indicates that it properly looked it up, but either did not exist or is not accessible to this user.

    There are multiple layers of security. Only when all of them line up (like cylinders in a lock), then you get the object back, otherwise not found. And remember, something that is not accessible is the same as not exist from that user's perspective.

    (1) Users general privileges in the system as a user. Such as can query, can retrieve, etc. If you can get to other objects by this same user, then you are probably okay with this.

    (2) User access to item type (or an item type subset of the item type). Before worrying about whether a user can see specific individual items, you need to make sure the user has any access to the item type (or an item type subset of the item type). For example, if a document grants access to a user, but the document type does not grant access, they will not see the document. If you are using item type subset views, this gets further complicated. But let's assume you are using item types via their automatic base view (such as would be the case if you don't know what an item type subset view is). You can easily test this by listing all the document types when logged in via this user to CMIS, and make sure this type comes up in the list. You can directly test this via browser URL by opening the type or type-flat feed directly (found in the index page), and specifying last segment as "/cmis:document" to list all document types. If you don't see it here, then the user doesn't have access to the type (or a subset view).

    (3) Item-specific access via the item's ACL. Assuming you have item-level ACL enabled in the item type, each new item is created with an assigned ACL. That ACL either comes from the item type's ACL, or the user definition's default ACL, depending on the item type definition default ACL choice. In the existing release of CMIS, it does not currently support defaulting from the parent folder (compared to similar documentation for Quickr Services).

    Lastly, there are command-line tools provided to help you inspect items and their ACLs. Try running the "Browser" command-line tool, which will help you browse to the specific item, see the ACL assigned to the item type, item type subset view, and specific item, print what the ACL means, or even change the item-ACL. Item type ACLs are changed through the CM sys admin client.

    There is more documentation on access too.

    Btw, your post said something about item type view not found I believe. That might point to item type not accessible. And in general, the logging should be pretty thorough, but can only see through the current user's eyes.
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-22T08:30:36Z  
    • TigerTrix
    • ‏2012-11-12T18:02:26Z
    Just to be clear, CMIS does support cmis:id, a required property. It is the basis of most operations and URLs.

    If the ID syntax is not valid, such as if a native ID is used in place of a CMIS ID (which is a different syntax than native ID), a different API usage error would be reported. Your error indicates that it properly looked it up, but either did not exist or is not accessible to this user.

    There are multiple layers of security. Only when all of them line up (like cylinders in a lock), then you get the object back, otherwise not found. And remember, something that is not accessible is the same as not exist from that user's perspective.

    (1) Users general privileges in the system as a user. Such as can query, can retrieve, etc. If you can get to other objects by this same user, then you are probably okay with this.

    (2) User access to item type (or an item type subset of the item type). Before worrying about whether a user can see specific individual items, you need to make sure the user has any access to the item type (or an item type subset of the item type). For example, if a document grants access to a user, but the document type does not grant access, they will not see the document. If you are using item type subset views, this gets further complicated. But let's assume you are using item types via their automatic base view (such as would be the case if you don't know what an item type subset view is). You can easily test this by listing all the document types when logged in via this user to CMIS, and make sure this type comes up in the list. You can directly test this via browser URL by opening the type or type-flat feed directly (found in the index page), and specifying last segment as "/cmis:document" to list all document types. If you don't see it here, then the user doesn't have access to the type (or a subset view).

    (3) Item-specific access via the item's ACL. Assuming you have item-level ACL enabled in the item type, each new item is created with an assigned ACL. That ACL either comes from the item type's ACL, or the user definition's default ACL, depending on the item type definition default ACL choice. In the existing release of CMIS, it does not currently support defaulting from the parent folder (compared to similar documentation for Quickr Services).

    Lastly, there are command-line tools provided to help you inspect items and their ACLs. Try running the "Browser" command-line tool, which will help you browse to the specific item, see the ACL assigned to the item type, item type subset view, and specific item, print what the ACL means, or even change the item-ACL. Item type ACLs are changed through the CM sys admin client.

    There is more documentation on access too.

    Btw, your post said something about item type view not found I believe. That might point to item type not accessible. And in general, the logging should be pretty thorough, but can only see through the current user's eyes.
    Thanks for the clarification on security. I've revised my CM configuration for users, privileges and ACLs and I don't think this is the problem since I'm logging in with privilege "ItemSuperAccess" which, as per my understanding, should grant access regardless of ACL on document/item type. (This "super access" privilege is set since I'm just testing/prototyping)
  • cwoliveira
    cwoliveira
    5 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-22T14:17:21Z  
    Thanks for the clarification on security. I've revised my CM configuration for users, privileges and ACLs and I don't think this is the problem since I'm logging in with privilege "ItemSuperAccess" which, as per my understanding, should grant access regardless of ACL on document/item type. (This "super access" privilege is set since I'm just testing/prototyping)
    Hi,

    Can you reproduce the same behavior running the same query on Apache CMIS Workbench ?

    Regards,

    Carlos
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: ObjectNotFoundException when getting object by id after query

    ‏2012-11-22T14:26:40Z  
    Hi,

    Can you reproduce the same behavior running the same query on Apache CMIS Workbench ?

    Regards,

    Carlos
    Yes, I have the same exception when selecting one item of the result set of the query on Apache Open CMIS Workbench.
    And also when launching http request as

    http://lx000000700080:9082/cmcmis/resources/$x!CMLS_CF/Content/$d!1144_A1001001A12J17B41757D70523v3?