cancel
Showing results for 
Search instead for 
Did you mean: 

MDM Java API: Problem obtaining Repository Schema

Former Member
0 Kudos

Hi,

I´m trying to obtain a Repository Schema and I´m getting the following exception:

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

at com.sap.mdm.schema.commands.GetRelationshipListCommand.execute(Unknown Source)

at com.sap.mdm.schema.commands.GetRepositorySchemaCommand.execute(Unknown Source)

at test.com.mycompany.TestJavaAPI.main(TestJavaAPI.java:80)

Caused by: com.sap.mdm.internal.protocol.manual.ServerException: Relationship not found.

at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.execute(AbstractProtocolCommand.java:110)

... 3 more

I´m on MDM 5.5 SP4 P3 (5.5.35.16) on both server and client side.

I took pieces of code from

<a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4ee2fc9a-0e01-0010-50ad-cfd44598b843">SAP NetWeaver MDM 5.5 SP3 and SP4 JAVA Admin API - Webinar Powerpoint</a>.

My code is the following:



String host = "<hostname>";
try {
	// Get Connection
	ConnectionAccessor conn = getConnection(host);
	
	// Get Repository ID (DBMSName took from MDM Console)
	RepositoryIdentifier repID = getRepositoryIdentifier(
		conn, "<Repository Name>", "<DBMSName>", DBMSType.ORACLE);

	// Repository Session
	CreateRepositorySessionCommand repSession =
		new CreateRepositorySessionCommand(conn);
	repSession.setRepositoryIdentifier(repID);
	repSession.execute();
	
	// Repository ID
	String repSessionString = repSession.getRepositorySession();
	
	// Repository Authentication
	AuthenticateRepositorySessionCommand authRep =
		new AuthenticateRepositorySessionCommand(conn);
	authRep.setSession(repSessionString);
	authRep.setUserName("<username>"); // Ignored in SP4
	authRep.setUserPassword("<password>"); // Server password
	authRep.execute();
	
	// Get Scheme
	GetRepositorySchemaCommand repSchema = new GetRepositorySchemaCommand(conn);
	repSchema.setSession(repSessionString);

	//  !!!  This line throws the exception  !!!
	repSchema.execute();

	RepositorySchema schema = repSchema.getRepositorySchema();
	TableProperties tableProps = schema.getTable("Products");
	TableId tableId = tableProps.getId();
	System.out.println(tableId.getString());
	
} catch (CommandException e) {
	e.printStackTrace();
	return;
} catch (ConnectionException e) {
	e.printStackTrace();
	return;
}

¿ Can anybody figure out what I'm doing wrong ?

Any help will be appreciated.

Regards,

Daniel Sacco

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daniel

We encountered the same problem. It was attributed to a bug in the API. The simple solution is to create a "Relationships" table (using the MDM Console) in your repository that you're connecting to with the API.

Mark

Former Member
0 Kudos

Hi Mark,

I've tried your solution but I cannot create the table. MDM Console says that "Relationships" is a reserved table name.

Could you create it without problems ? Which version of MDM are you running ?

Regards,

Daniel Sacco

Former Member
0 Kudos

Sorry Mark, I misunderstood what you told me. I was trying to create a "Flat" table called "Relationships".

Now I created a Relationships type table and it the bug has gone.

Thanks for your help.

Daniel Sacco

Answers (1)

Answers (1)

Former Member
0 Kudos

Make sure that the MDM API jars and the MDM Server match.

All the components have to be compatible.

Message was edited by:

Adhappan Thiagarajan

Former Member
0 Kudos

Hi Adhappan,

Thanks for your quick response.

I tried your code replacing host, user, password and repository data and it throws the same exception. After that I compared line by line your code with mine and both are the same but with a different structure. Maybe my code works well in your environment.

¿ Can you tell the version of your MDM ? Maybe the version I´m using has a bug.

Regards,

Daniel

Former Member
0 Kudos

MDM 5.5 SP 4 Patch 3

You can download the software for this version in service market place.

Former Member
0 Kudos

Thanks Adhappan,

This is the same version that I'm using. I'll continue investigating.

Regards,

Daniel