Skip to Content
author's profile photo
Former Member

Image Retrieval in Cat-2

Hi guys,

I am facing issues retrieving Images from MDM using Java APIs.

The MDM version is 5.5.41.70 (Catalog-2).

I have tried storing images (embedded) in MDM itself and even tried pointing to images stored on file-system. Either way it's failing with a "Null Pointer".

I have used the API javadoc documentation which states that for RetrieveBlobCommand the only two required fields are recordId and tableId:

void setRecordId(RecordId recordId)

void setTableId(TableId tableId)

But setting these required fields as below:

getImageBlob(2);

....

public static void getImageBlob(int intRecordId) {

RecordId blobRecordId = new RecordId(intRecordId);

RetrieveBlobCommand retrieveBlobCommand = new RetrieveBlobCommand(MdmConnection.getInstance().getConnectionAccessor());

RepositorySchema repositorySchema = MdmConnection.getInstance().getRepositorySchema();

retrieveBlobCommand.setTableId(repositorySchema.getTableId("Images"));

System.out.println(repositorySchema.getTableId("Images"));

retrieveBlobCommand.setRecordId(blobRecordId);

try {

retrieveBlobCommand.execute();

System.out.println("Blob :" + retrieveBlobCommand.getBlob());

}

catch (CommandException ce) {

ce.printStackTrace();

}

}

Is resulting in the following exception:

java.lang.NullPointerException

at com.sap.mdm.internal.SessionConvertHelper.convertToLong(SessionConvertHelper.java:11)

at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.setSession(AbstractProtocolCommand.java:190)

at com.sap.mdm.blobs.commands.RetrieveBlobCommand.execute(Unknown Source)

at com.pwc.us.mdm.MdmUtils.getImageBlob(MdmUtils.java:151)

The nullpointer exception is inside an internal class which leads to the conclusion that either API documentation is missing some information or the API itself has some bugs.

I have tried some other ways using "RetrieveRecordsByIdCommand" and "RetrieveLimitedRecordsCommand". These commands are also giving internal errors like:

java.lang.IllegalArgumentException: Unsupported field type '105'.

at com.sap.mdm.internal.valuetypes.ValueConverter.createValueForField(Unknown Source)

at com.sap.mdm.internal.data.RecordLoader.getFieldData(Unknown Source)

at com.sap.mdm.internal.data.RecordImpl.loadData(Unknown Source)

at com.sap.mdm.internal.data.RecordImpl.<init>(Unknown Source)

at com.sap.mdm.internal.blobs.BlobRecordImpl.<init>(Unknown Source)

at com.sap.mdm.internal.blobs.BinaryBlobRecordImpl.<init>(Unknown Source)

at com.sap.mdm.internal.blobs.ImageBlobRecordImpl.<init>(Unknown Source)

at com.sap.mdm.internal.data.RecordsLoader.createRecord(Unknown Source)

at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)

at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)

at com.sap.mdm.internal.data.RecordResultSetHelper.convertFrom(Unknown Source)

at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(Unknown Source)

at com.sap.mdm.data.commands.RetrieveRecordsByIdCommand.execute(Unknown Source)

and

com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: Field not found.

at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(Unknown Source)

at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(Unknown Source)

Appreciate all the help.

Thanks

Anshuman

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Sep 29, 2007 at 09:50 AM

    Hello Anshuman,

    You are missing the Session!

    So please set 3 things:

    void setRecordId (RecordId recordId)

    void setTableId (TableId tableId)

    void setSession (String RepositorySession)

    and then it will work!

    Greetings

    Tobi

    Add comment
    10|10000 characters needed characters exceeded