on 12-24-2007 9:05 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.