cancel
Showing results for 
Search instead for 
Did you mean: 

MDM API Connection issue

Former Member
0 Kudos

Hi,

I am trying to establish connection to MDM server by the following statement ( Java stadalone app)

ConnectionPoolFactory.getInstance("Host:6000");

But I am getting exception "com.sap.mdm.net.ConnectionException: Could not open minimum connections."

Am I missing some config on MDM side??

Thanks, Anil

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I am also facing this issue

com.sap.mdm.net.ConnectionException: Unable to create new connection.

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:50)

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:37)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:77)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:50)

at com.apl.GetServerVersion.main(GetServerVersion.java:18)

Caused by: java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:529)

at java.net.Socket.connect(Socket.java:478)

at java.net.Socket.<init>(Socket.java:375)

at java.net.Socket.<init>(Socket.java:189)

at com.sap.mdm.internal.net.DataSocket.<init>(DataSocket.java:35)

at com.sap.mdm.internal.net.ConnectionImpl.connect(ConnectionImpl.java:187)

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:44)

... 4 more

Former Member
0 Kudos

com.sap.mdm.net.ConnectionException: Unable to create new connection.

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:48)

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:37)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:77)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:50)

at com.apl.GetServerVersion.main(GetServerVersion.java:18)

Former Member
0 Kudos

Hello Dear Anikumar.

i faced with the same error!

there is my exception:

com.sap.mdm.net.ConnectionException: Could not open minimum connections.
        at com.sap.mdm.internal.net.ConnectionPoolBase.initialize(ConnectionPoolBase.java:136)
        at com.sap.mdm.net.ConnectionPoolFactory.createInstance(ConnectionPoolFactory.java:214)
        at com.sap.mdm.net.ConnectionPoolFactory.getInstance(ConnectionPoolFactory.java:109)
        at ru.kolpix.mdm.common.MDMGate.getPool(MDMGate.java:153)
        at main.Main.main(Main.java:49)
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at java.io.DataInputStream.read(DataInputStream.java:132)

Even more it's interesting that if i run my java application on the MDM server - everything allright.

Also after rebooting MDM server (rebooting of Operation System) everything allright.

and i also tried to connect via telnet to MDM server from my machine - it was connect successfully.

that's all what i investigate...

Do u have any idea or did u solve that problem?

Former Member
0 Kudos

Hello Anil,

have you tried the servers name instead of "Host:6000" or leaving out the port?

Best regards

Dominik

Former Member
0 Kudos

Yes.I tried both but no success

Anil

Former Member
0 Kudos

Hi,

Error stack is

com.sap.mdm.net.ConnectionException: Unable to create new connection.

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:50)

at com.sap.mdm.internal.net.SimpleConnectionImpl.<init>(SimpleConnectionImpl.java:37)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:77)

at com.sap.mdm.net.SimpleConnectionFactory.getInstance(SimpleConnectionFactory.java:50)

at com.amat.edm.mdm.server.ServerImpl.getConnection(ServerImpl.java:80)

at com.amat.edm.mdm.server.ServerImpl.loadRepositories(ServerImpl.java:44)

at com.amat.edm.mdm.server.ServerImpl.<init>(ServerImpl.java:35)

at com.amat.edm.mdm.server.Server.getInstance(Server.java:31)

Regards, Anil

Former Member
0 Kudos

One more question

Do we need to set anything on the MDM side ?? Configure or enabling Ports or something ?

Thanks, Anil

Former Member
0 Kudos

Is the MDM system correctly installed, meaning, can you use all MDM clients without errors?

If yes, I can only hardly guess, what the problem could be (else to the name of the server), because if everything is set up correctly it should work.

Have you tried other servers, or connecting from a different machine?

Is the server available in the network of other comupters, and if yes, with what name?

Best regards

Dominik

Former Member
0 Kudos

Hi,

I can able to connect using MDM console.

I tried with both IP and host name also.

I am wondering if there are any port configurations on the MDM side ?

Thanks, Anil

Former Member
0 Kudos

Hello Anil,

please have a look at the first part of the Blog listed below.

The described way uses a simple connection but is similar to the ConnectionPool Factory.

The standard port of client to MDM Server communication is 20005. Please make sure this port is connectable.

If your standard port isn't 20005 you can change it in mds.ini. I hope this answer will help you.

If you haven't change the standard port just use a hostname for connection.

Best regards,

Regina

Former Member
0 Kudos

Hi,

Repository is running on port 6000.

So I tried by giving the port number in the API but that doesn't help.

Thanks, Anil

Former Member
0 Kudos

Dear Anil,

first of all you need to connect to the MDM server.

This is done without any repository consideration just by the hostname of the MDM-Server.

The standard port used to make this connection from your (Java) client is 20005.

You can change this port where MDM-Server is listening in mds.ini by providing another one.

CODE:


public ConnectionAccessor getConnection() {

  String sHostName = MyServerName;
  ConnectionAccessor connection = null;

  // We need a try / catch statement or a throws for the method

  try {
    /* retrieve connection from Factory
     * The hostname can be the name of the server if it is listening on the standard port 20005
     * or a combination of Servername:Portnumber eg. MDMSERVER:40000
     */
    connection = SimpleConnectionFactory.getInstance(sHostName);
  } catch (ConnectionException e){
    // Do some exception handling
    e.printStackTrace();
  }
  // return the connection or if an exception occurred a NULL value
  return connection;
}

Then you can think about the Session you want to make to the repository.

This is taken from my Blog:

In general there are three different kinds of connections and depending on the thing you want to do, you will need a different kind. But let me point out the three different kinds available:

1. Server session:

A server session is used for management operations of a running MDM Server. This could be mounting- or unarchive a repository. You could even stop the server with this kind of session if needed. In fact u could say that the operations done with MDM Console partly need a server session.

The associated command would be: CreateServerSessionCommand

2. Repository Session:

A repository session is bound to a specific repository and is used for management operations. Operations could be CRUD (Create, Read, Update, Delete) on Repository elements (user roles, model data such as fields, tables...) not the data in the repository itself. Same as with the server session we could say that a repository session is partly needed by the MDM Console.

The associated command would be: CreateRepositorySessionCommand

3. User session

A user session is used for any operation that might be performed by the MDM Datamanager. Basically any kind of data manipulation is done using a user session (CRUD of Data). So having this session we will be able to perform searches, creating, updating and deleting data records.

The associated command would be: CreateUserSessionCommand

Most of the time you will need a User Session to read/write data from MDM.

So to get a User-Session you will need to use the CreateUserSessionCommand.


   RepositoryIdentifier repId = new RepositoryIdentifier(RepositoryNameAsString, DBServerNameAsString, DBMSTypeAsString);

   // Create the command to get the Session 
   CreateUserSessionCommand createUserSessionCommand = new CreateUserSessionCommand(connection);

   // Set the identifier
   createUserSessionCommand.setRepositoryIdentifier(repId);

   // Set the region to use for Session - (Language)
   createUserSessionCommand.setDataRegion(dataRegionAsString);

   // Execute the command
   createUserSessionCommand.execute();
   // Get the session identifier
   String session = createUserSessionCommand.getUserSession();

Please node that if the RepositoryIdentifier is set the wrong way you will not be able to create a connection as well. So please double check this parameters.

After all you need to authenticate the session but for further details please have a look at the blog Regina provided the link to.

Hope this helped to find the problem!

Best regards,

Tobi

Former Member
0 Kudos

Hi Tobi,

Thanks for your detailed reply.

But I am struck in the first stage itself, meaning the following code is failing

/* retrieve connection from Factory

  • The hostname can be the name of the server if it is listening on the standard port 20005

  • or a combination of Servername:Portnumber eg. MDMSERVER:40000

*/

connection = SimpleConnectionFactory.getInstance(sHostName);

} catch (ConnectionException e){

// Do some exception handling

e.printStackTrace();

}

Here I am getting "com.spa.mdm.net.ConnectionException : Unable to create new connection" .

Thanks, Anil

Former Member
0 Kudos

Hey Anil,

try to make a telnet [hostname] 200005 from the client the java programm is executed on.

Is this possible or is any firewall blocking?

If you can connect to the port via telnet it shows that the connection should be possible.

If you get any message besides a black screen the problem might be a firewall or anything else blocking the traffic.

Best regards,

Tobi

Former Member
0 Kudos

Hi Tobi,

When I execute

Telnet <HostName> 200005

I am getting the error " Could not connect to the host, on port 200005 : Connection failed "

This means there is an issue with firewalls ?

Btw...Always do we need to connect to 200005 ? Is it a standard port ?

Thanks, Anil

Former Member
0 Kudos

Hi Anil,

sorry I made a small mistake in my last post!

Corrected it's: Telnet <HostName> 20005.

The 20005 port is the default port.

Taken from the MDM installation guide: (http://service.sap.com/installmdm)

"The MDM Server host needs to have incoming TCP traffic enabled on port 20005. If there is a firewall on the MDM server, the firewall needs to be configured to permit traffic on this port."

So please try again and let me know if you get the black screen, indicating that you can reach the server.

Best regards,

Tobi