on 04-15-2014 3:46 PM
I am trying to fetch all the roles from a particular repository. But getting below error:
runningRepository...........PG_PRODUCT
Exception in thread "main" java.lang.NullPointerException
at com.sap.mdm.internal.SessionConvertHelper.convertToLong(SessionConvertHelper.java:11)
at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.setSession(AbstractProtocolCommand.java:236)
at com.sap.mdm.schema.commands.GetRemoteSystemListCommand.executeImpl(GetRemoteSystemListCommand.java:68)
at com.sap.mdm.commands.AbstractCommandBase.execute(AbstractCommandBase.java:129)
at com.sap.mdm.security.commands.GetRoleListCommand.executeImpl(GetRoleListCommand.java:76)
at com.sap.mdm.commands.AbstractCommandBase.execute(AbstractCommandBase.java:129)
at com.jnj.mdm.connection.MDMConnection.<init>(MDMConnection.java:63)
at com.jnj.mdm.audit.MainMethod.main(MainMethod.java:23)
Could anybody help in this? Just let me know how to use the GetRoleListCommand class?
Can anybody suggest here what could be the answer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try {
/** Create connection**/
conAccessor = SimpleConnectionFactory.getInstance(servername);
/***Get Running Repository Details ***/
GetRunningRepositoryListCommand runningRepository = new GetRunningRepositoryListCommand(conAccessor);
runningRepository.execute();
RepositoryIdentifier[] repositoriesIdentifier = runningRepository.getRepositories();
for (int i = 0; i < repositoriesIdentifier.length; i++) {
/***Create Repository Session Command ***/
System.out.println("runningRepository..........."+repositoriesIdentifier[i].toString());
CreateRepositorySessionCommand createRepositorySessionCommand = new CreateRepositorySessionCommand(conAccessor);
// Create a user session
sessionManager.createSession(userSessionContext, SessionTypes.USER_SESSION_TYPE,
pwd);
createRepositorySessionCommand.setRepositoryIdentifier(repositoriesIdentifier[i]);
createRepositorySessionCommand.execute();
if(repositoriesIdentifier[i].toString().equals("_SLAVE")){
}
if(repositoriesIdentifier[i].toString().equals("PG_PRODUCT")){
GetRoleListCommand roleListCommand = new GetRoleListCommand(conAccessor);
roleListCommand.execute();
RoleProperties[] roleProperties = roleListCommand.getRoles();
for(int ak=0;ak<roleProperties.length;ak++){
System.out.println("roles...."+roleProperties[ak].getName());
}
}
}
At roleListCommand.execute(); I am getting this error...
Its seems like, at line
conAccessor = SimpleConnectionFactory.getInstance(servername);
nothing is assigned to "conAccessor" Variable i.e you can check the server name again.
Because when you create object of GetRoleListCommand class i.e (roleListCommand) seems to be null, hence you are getting error at execute().
Regards,
To create object of GetRoleListCommand class, i think object need to be passed of type ConnectionAccessor or RepositorySessionContext. Where as "conAccessor" is of type SimpleConnection.
Can u check on this...
Creates a new instance of this command. |
GetRoleListCommand(RepositorySessionContext ctx) Creates a new instance of this command by context. |
Regards,
Hi, I moved your question to SAP MDM space where you should have more chance of getting it answered.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.