cancel
Showing results for 
Search instead for 
Did you mean: 

Java-API error while loading repository

Former Member
0 Kudos

Hi All,

I am getting following error when I am trying to Load repository using Java API:

com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

at com.sap.mdm.commands.CreateRepositorySessionCommand.executeImpl(CreateRepositorySessionCommand.java:79)

at com.sap.mdm.commands.AbstractCommandBase.execute(AbstractCommandBase.java:77)

at LoadRepository.main(LoadRepository.java:76)

Caused by: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

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

at com.sap.mdm.commands.CreateRepositorySessionCommand.executeImpl(CreateRepositorySessionCommand.java:74)

... 2 more

I have

RepositoryIdentifier reposId = new RepositoryIdentifier("REPOSITORYNAME", "SERVER", DBMSType.MS_SQL);

CreateRepositorySessionCommand sessionCommand = new CreateRepositorySessionCommand(connections);

sessionCommand.setRepositoryIdentifier(reposId);

System.out.println("ServerName"+reposId.getDBMS());

try {

sessionCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

return;

}

I placed System.out.println just before try method.. Its working.. I am able to see repository,server names as required.. dont know where the issue is.....It seems sessionCommand.execute () is unable to execute..

Any suggestions?

Thanks

Rajeev

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member206388
Contributor
0 Kudos

Hi Rajeev.

How did you instantiate the "connections" object. It looks like the MDM repository name and the MDM Server name is not mentioned

correctly while creating connection. Can you check that?

Regards

Bala

Former Member
0 Kudos

Hi,

I have the following code for connection : Repository name is correct.. I see the name on the server.. and the same I can see its passing using println statement.

public class LoadRepository {

private LoadRepository() {

}

public static void main(String[] args) {

// create connection pool

String connectionTag = "localhost";

ConnectionPool connections = null;

try {

connections = ConnectionPoolFactory.getInstance(connectionTag);

} catch (ConnectionException e) {

e.printStackTrace();

return;

}

I just used the example provided under Java zip file..... Dont know where the issue is...

Regads,

Rajeev

former_member206388
Contributor
0 Kudos

Hi Rajeev.

Hope your repository is mounted right?

Lets check this.

Can you execute the following code and check if it is returing back the list of repositories that is mounted on your server.

GetMountedRepositoryListCommand gmrlc = new GetMountedRepositoryListCommand(connection)

gmrlc.execute();

MountedRepository[] mreps = gmrlc.getRepositories() ;

Loop into mreps and check if it has your repository name which you are trying.

Regards

Bala

Former Member
0 Kudos

HI Bala,

I tried but it saying

GetMountedRepositoryListCommand cannot be resolved or not a type... do I need to import any thing to run this command?

I used the exmaple provided by SAP to list the running repositores... and it displaying the repositires which are started.

Thanks

Rajeev

former_member206388
Contributor
0 Kudos

Hi Rajeev.

Try the following options:

1. Instead of "localhost" try giving the SystemName/IP Address of the Server.

2. Check the MDM(API+Server) Version you are using?

3. Check if you have attached all the mdm api jar files?(you should be having mdm-admin.jar,mdm-common.jar,mdm-core.jar,mdm-data.jar,mdm-protocol.jar)

Follow the steps mentioned in the below URL(Navigate to MDM Java and .NET API Guide -> Getting started with Java API)

http://help.sap.com/saphelp_nwmdm71/helpdata/en/index.htm

Regards

Bala

Former Member
0 Kudos

Hi ,

I imported all jar files ... I also tried with using PC Name instead of localhost but still I am unable to get rid of this issue.. I am unable to use GetMountedRepositoryListCommand in the code....

I am using MDM 5.5 SP06 and the jar files also the same..

Wondering if there are some issue then i should not able to run the List of running repositories progrma.. but its working and I can see the repositories names ...

Any advise or suggestion..

Thanks

Rajeev

former_member206388
Contributor
0 Kudos

Hi Rajeev.

The Problem of not able to use "GetMountedRepositoryListCommand" is because the MDM API which you are using may be outdated or the command is not available in MDM5.5. But it is available in MDM7.1.

Regards

Bala

Former Member
0 Kudos

Hi,

I am uisng MDM 7.1 APIs .... Can any one let me know what the issue with the following code:

-


import com.sap.mdm.commands.AuthenticateRepositorySessionCommand;

import com.sap.mdm.commands.CommandException;

import com.sap.mdm.commands.CreateRepositorySessionCommand;

import com.sap.mdm.commands.DestroySessionCommand;

import com.sap.mdm.net.ConnectionException;

import com.sap.mdm.net.ConnectionPool;

import com.sap.mdm.net.ConnectionPoolFactory;

import com.sap.mdm.repository.commands.LoadRepositoryCommand;

import com.sap.mdm.server.DBMSType;

import com.sap.mdm.server.RepositoryIdentifier;

public class LoadRepository {

private LoadRepository() {

}

public static void main(String[] args) {

// create connection pool

String connectionTag = "localhost";

ConnectionPool connections = null;

try {

connections = ConnectionPoolFactory.getInstance(connectionTag);

} catch (ConnectionException e) {

e.printStackTrace();

return;

}

// alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand

RepositoryIdentifier reposId = new RepositoryIdentifier("REPOSITORY", "localhost", DBMSType.MS_SQL);

// create repository session

CreateRepositorySessionCommand sessionCommand = new CreateRepositorySessionCommand(connections);

sessionCommand.setRepositoryIdentifier(reposId);

System.out.println("Hello World!"+reposId.getDBMS());

try {

sessionCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

return;

}

String sessionId = sessionCommand.getRepositorySession();

// authenticate the repository session

String userName = "Admin";

String userPassword = "";

AuthenticateRepositorySessionCommand authCommand = new AuthenticateRepositorySessionCommand(connections);

authCommand.setSession(sessionId);

authCommand.setUserName(userName);

authCommand.setUserPassword(userPassword);

try {

authCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

return;

}

// load the repository

LoadRepositoryCommand loadReposCommand = new LoadRepositoryCommand(connections);

loadReposCommand.setSession(sessionId);

try {

loadReposCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

return;

}

// finally destroy the repository session

DestroySessionCommand destroySessionCommand = new DestroySessionCommand(connections);

destroySessionCommand.setSession(sessionId);

try {

destroySessionCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

return;

}

}

}

-


I am getting following error:

-


Hello World!localhost

com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

at com.sap.mdm.commands.CreateRepositorySessionCommand.executeImpl(CreateRepositorySessionCommand.java:79)

at com.sap.mdm.commands.AbstractCommandBase.execute(AbstractCommandBase.java:77)

at LoadRepository.main(LoadRepository.java:77)

Caused by: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

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

at com.sap.mdm.commands.CreateRepositorySessionCommand.executeImpl(CreateRepositorySessionCommand.java:74)

... 2 more

-


Can any one let me know what the issue is.. I just used the example file provided along with software.. I used PC Name instead of Localhost but still it doesnt work.

I am trying to execute the examples I got along with JAVA APIs ... I want to run RetrieveLimitedRecords.... I gave the right server,database names but I am getting following error.. I run GetRunningRepositories example and it is showing the running repositories with out issues.. BUt having issue with RetrieveLimitedRecords and the error is as below:

-


com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

at com.sap.mdm.commands.GetRepositoryRegionListCommand.execute(GetRepositoryRegionListCommand.java:96)

at com.sap.mdm.examples.RetrieveLimitedRecords.main(RetrieveLimitedRecords.java:87)

Caused by: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

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

at com.sap.mdm.commands.GetRepositoryRegionListCommand.execute(GetRepositoryRegionListCommand.java:84)

... 1 more

-


ANY ADVISE.

Thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

i gone through the thread details, Based upon error detail repository or host name incorrect but as you said you have given correct information so i think you forgot to set java Class path for any one of the MDM Jar.file

Hope this will resolve your problem

Thanks,

Jignesh Patel

Former Member
0 Kudos

Hi,

Can you please let me know what you mean by class path? I imported the JAVA APIs in to NWDS.. I used the example to get server version.. Its working.. I also run running repositories.. Its worked.. BUt unable to get retrievlimited record example.. Do I need to add class path in environment variables window for each jar files? Please suggest.

Thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

Do I need to add class path in environment variables window for each jar files? Please suggest.

Yes, You need to set each MDM jar file in environment variable classpath

Thanks,

Jignesh Patel

Former Member
0 Kudos

HI,

I pointed all jar files in the classpath and restarted the system but still I am getting the same error..Dont know where Is the issues is...

Thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

is MDM server are install in local system or different system, if different system where are you running the program on local system or server level and in Java program code which local host define

could you provide me the details

Thanks,

Jignesh Patel

Former Member
0 Kudos

Hi,

Now I am trying with the MDM server and Database both installed on my laptop.. I am using MDM 5.5 SP06 (reposioty is REPO, Admin with blank password) with SQL server(SQLEXPRESS)... still the same issue..

com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

at com.sap.mdm.commands.GetRepositoryRegionListCommand.executeImpl(GetRepositoryRegionListCommand.java:96)

at com.sap.mdm.commands.AbstractCommandBase.execute(AbstractCommandBase.java:77)

at com.sap.mdm.example.GetRepositoryRegions.main(GetRepositoryRegions.java:71)

Caused by: com.sap.mdm.internal.protocol.manual.ServerException: The specified MDM repository was not found on the server

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

at com.sap.mdm.commands.GetRepositoryRegionListCommand.executeImpl(GetRepositoryRegionListCommand.java:84)

... 2 more

When I try to open the file AbstractCommandBase under the package com.sap.mdm.commands I see

source not found.... and I see there is a button Change Attached Source.. using this I pointted to

the variable I created in class path... still the same... I am getting the same for all the files/classes under all packages

Does this would be the cause for issue above I am getting? How can i get rid of this? How can i point to the right files?

Any Inputs please...

Thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

As per your error details you unable to recognize MDM Jar file Java Package

i would suggest put all MDM jar file in Java bin folder and specify Java Class path in environment variables and run java prg through Java bin folder

also in java coding mention Host name as you computer name by right clicking on my computer->Properties->Computer Name

Hope above mention point will resolve your issue

Thanks,

Jignesh Patel