CWPAP0127E: The Java API object reference is inaccessible due to deletion or similar operation
Why am I getting the CWPAP0127E: The Java API object
reference is inaccessible due to deletion or similar operation
exception
and how do I fix it?
Symptoms
Certain methods are not designed to be used with newly created items, for example, getModifiedAttributesWithNewData. It can not be used with a new items because it compares the new and old versions of the attribute value and in the absence of old data.Resolving the problem
You may encounter the above mentioned error while adding an item in the single edit screen, collaboration area, import job or custom tool. To troubleshoot it, check the correspondingexception.log
file
for the error stack, which should be similar to the following:com.ibm.pim.common.exceptions.PIMInternalException: CWPAP0127E:The Java API object reference is inaccessible due to deletion or similar operation.
at com.ibm.ccd.api.attribute.AttributeChangesImpl.checkOwners(Unknown Source)
at com.ibm.ccd.api.attribute.AttributeChangesImpl.getEntryChangedData(Unknown Source)
at com.ibm.ccd.api.attribute.AttributeChangesImpl.Problematic_Function(Unknown Source)
*** location of the custom code where the problematic function was encounter ***
... so on
Identify the exact location of the problematic function using the sample error stack above and modify the logic accordingly. For example, if you get the following exception:
com.ibm.pim.common.exceptions.PIMInternalException: CWPAP0127E:The Java API object reference is inaccessible due to deletion or similar operation.
at com.ibm.ccd.api.attribute.AttributeChangesImpl.checkOwners(Unknown Source)
at com.ibm.ccd.api.attribute.AttributeChangesImpl.getEntryChangedData(Unknown Source)
at com.ibm.ccd.api.attribute.AttributeChangesImpl.getModifiedAttributesWithNewData(Unknown Source)
at com.company_name.pim.validations.validateItem(ValidateAttribute.java)
at com.company_name.pim.validations.ValidateAttribute.java.applyRule(ValidateAttribute.java)
... so on
ValidateAttribute.java
to check whether the item
is new and not to use getModifiedAttributesWithNewData for
new items. This behavior will change from version 10.0.0 FP5 onwards
where the function will work for newly created items returning a list
of all attribute changes for that item.