on 09-25-2008 1:46 PM
Hi Experts,
I am new to MDM.Recently I was shifted from java to MDM.I got the below problem when i run my application for getting connection.I got coneection but display some error message.Please see my code and problem.
problem
-
Exception in thread "main" java.lang.NullPointerException com.sap.mdm.server.commands.GetServerVersionCommand.getVersion
code
-
import com.sap.mdm.commands.*;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.SimpleConnection;
import com.sap.mdm.net.SimpleConnectionFactory;
import com.sap.mdm.server.commands.GetServerVersionCommand;
public class Application2 {
public static void main(String[] args){
System.out.println("-Connection not yet created--");
String connectionTag = "MDMServer";
SimpleConnection connection = null;
try {
connection = SimpleConnectionFactory.getInstance(connectionTag);
System.out.println("-Connection created--");
System.out.println("---Host Name -
" + connection.getHostname());
System.out.println("---Port No -
" + connection.getPort());
System.out.println("---Identity -
" + connection.getIdentity());
System.out.println( "---ConnectionSource -
" + connection.getConnectionSource());
System.out.println( "-Connection is ready--" + connection.isReady());
} catch (ConnectionException e) {
e.printStackTrace();
System.out.println("Version problem:"+e);
return;
}
GetServerVersionCommand cmd = new GetServerVersionCommand(connection);
System.out.println("MDM server Class: " + cmd.getClass());
System.out.println("MDM server Class: " + cmd.getSession());
System.out.println("MDM server Class: " + cmd.getVersion());
}
}
can anybody helm me out in these issues
Regards
Satish
Hi,
You need to set the Server session. Please check the below code
CreateServerSessionCommand createSerSesCmd = new CreateServerSessionCommand(simpleConnection);
createSerSesCmd.execute();
session = createSerSesCmd.getSession();
assign this session to cmd object i.e. cmd.setSession(session)
Now try to run the code.
Note: Session is nothing but a String variable
Regards,
Jitesh Talreja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.