cancel
Showing results for 
Search instead for 
Did you mean: 

error - MDM Java API

Former Member
0 Kudos

Dear xperts,

I am unable to execute any MDM code form a plain java application.

The code is a simpleconnection to my server

SimpleConnection connection = null;

try {

connection = SimpleConnectionFactory.getInstance("localhost");

} catch (ConnectionException e) {

e.printStackTrace();

}

I am getting the following error. Pls help me solve this.

java.lang.NoClassDefFoundError: java/util/logging/Logger

at com.sap.mdm.net.SimpleConnectionFactory.<clinit>(SimpleConnectionFactory.java:36)

at mdm.xsd.gen.MDMTest.main(MDMTest.java:25)

Exception in thread "main"

Regards,

Vijay

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi vijay,

your code is correct, i used the same code and excuted at my system in a plain java program.it executed successfully without any exceptions, i think there is problem with classpath.

set the class path to correct jar's.

Thanks,

Vijay.

former_member206107
Active Participant
0 Kudos

Hi Sarathy,

Try this...

the object should be of type "ConnectionAccessor" not "SimpleConnection"

===================================

ConnectionAccessor connection = null;

try {

connection = SimpleConnectionFactory.getInstance("localhost");

}

catch (ConnectionException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

==================================

Cheers,

Arun prabhu S

Former Member
0 Kudos

I am stilll getting the same error

Regards,

Vijayasarathy

Former Member
0 Kudos

Here is code for creating a UserSessionContext, which can be used for all the MDM commands.

<i>

private UserSessionContext createUserSessionContext() throws NamingException

{

final String SERVER = "My Server";

final String REPOSITORY_NAME = "My Repository Name";

final String USER = "MDM User Name";

final String PWD = "MDM Password";

final String REGION_NAME ="English [US]"; // MDM region name

UserSessionContext result = null;

result = new UserSessionContext(SERVER, REPOSITORY_NAME, USER);

result.setConnectionType(ConnectionTypes.LOCAL_SIMPLE_CONNECTION);

SessionManager.getInstance().createSession(result, SessionTypes.REPOSITORY_SESSION_TYPE, PWD);

_schema = MetadataManager.getInstance().getRepositorySchema(result);

result.setRegionName(REGION_NAME);

SessionManager.getInstance().createSession(result, SessionTypes.USER_SESSION_TYPE, PWD);

return result;

}

</i>

Former Member
0 Kudos

Walter,

What's the proper way to dispose of this connection?

When I call releaseSessions( ) and destroySessions( ) I see an error message coming back but monitoring the MDM console shows that the connections have been released.

The message is from com.sap.mdm.logging.MdmLogger

SEVERE: Can not find session for release. Session context: '<...>'

SEVERE: Can not find session for destroy. Session context: '<...>'

Best Regards,

Mark

Former Member
0 Kudos

Hi,

If you are building a "plain" Java application, then you cannot use SimpleConnection. This is only for applications hosted on an Application Server. For desktop applications, create your own connection directly. Which version of the API are you using - MDM4J or MDM Java API?

Walter

Former Member
0 Kudos

I am using MDM Java API 2.

I have also treid the connaction pool and connection pool factory. but face the same class not found exeception.

Regards,

Vijay

Former Member
0 Kudos

ConnectionPool is only relevant when you are running from an application server. It is not applicable for desktop applications.

Walter

Former Member
0 Kudos

pl post the code for connecting to server from a plain java application, if you have