'Oracle Analytics Server Web service for get user info
i have installed the Oracle Analytics Server 5.9(New version of Oracle BI) in my linux server and we migrate the configurations and the meta data and repository from old version to this one.
also we had a .NET app that work with the web service of Oracle BI to get and set the user and groups of security realm in the domain of BI.
but now in Oracle Analytics Server, the web service does not work properly.
in the local domain it does work properly but when we deploy on the server of Analytics Server, it does not work properly.
my source code is :
@WebService
public class UserGroupMemberCls {
private static JMXConnector jmxConnector = null;
private static MBeanServerConnection mBeanServerConnection = null;
private static String webLogicHostname = "192.168.24.63";
private static String webLogicPort = "9500";
private static String webLogicUsername = "weblogic";
private static String webLogicPassword = "123456";
.
.
.
.
@WebMethod(exclude = true)
public static List getListOfGroups() throws Exception {
ObjectName securityMBeanName1 = new ObjectName("Security:Name=myrealmDefaultAuthenticator");
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST2");
try {
initConnection(webLogicHostname, webLogicPort);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST13");
List<String> allUsers = new ArrayList();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST14");
String cursor =
(String) mBeanServerConnection.invoke(securityMBeanName1, "listGroups",
new Object[] { "*", Integer.valueOf(100) },
new String[] { "java.lang.String", "java.lang.Integer" });
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST15");
boolean haveCurrent =
((Boolean) mBeanServerConnection.invoke(securityMBeanName1, "haveCurrent", new Object[] { cursor },
new String[] { "java.lang.String" })).booleanValue();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST16");
while (haveCurrent) {
String currentName =
(String) mBeanServerConnection.invoke(securityMBeanName1, "getCurrentName", new Object[] { cursor },
new String[] { "java.lang.String" });
allUsers.add(currentName);
mBeanServerConnection.invoke(securityMBeanName1, "advance", new Object[] { cursor },
new String[] { "java.lang.String" });
haveCurrent =
((Boolean) mBeanServerConnection.invoke(securityMBeanName1, "haveCurrent", new Object[] { cursor },
new String[] { "java.lang.String" })).booleanValue();
}
mBeanServerConnection.invoke(securityMBeanName1, "close", new Object[] { cursor },
new String[] { String.class.getName() });
jmxConnector.close();
jmxConnector = null;
return allUsers;
} catch (Exception ex) {
ex.printStackTrace();
jmxConnector.close();
throw new RuntimeException(ex);
}
}
.
.
.
.
@WebMethod(exclude = true)
public static void initConnection(String hostname, String portString) throws IOException, MalformedURLException {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST3");
Integer portInteger = Integer.valueOf(portString);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST4");
int port = portInteger.intValue();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST5");
String mserver = "/weblogic.management.mbeanservers.runtime";
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TES6");
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "hostname : " + hostname);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "port : " + port);
JMXServiceURL serviceURL =
new JMXServiceURL("service:jmx:iiop:///jndi/iiop://" + hostname + ":" + port + mserver);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "serviceURL : " + serviceURL);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST7");
Hashtable<Object, Object> h = new Hashtable<Object, Object>();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "h1 : " + h);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST8");
String[] credentials = { webLogicUsername, webLogicPassword };
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST9");
h.put("jmx.remote.credentials", credentials);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "h2 : " + h);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST10");
try {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "(Map) h : " + (Map) h);
jmxConnector = JMXConnectorFactory.connect(serviceURL, (Map) h);
} catch (IOException ioe) {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
.log(Level.SEVERE,
"MESSAGE : " + ioe.getMessage() + " >>>> " + "STACKTRACE : " + ioe.getStackTrace() +
" >>>> " + " CAUSE : " + ioe.getCause());
// TODO: Add catch code
ioe.printStackTrace();
}
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "jmxConnector : " + jmxConnector);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST11");
mBeanServerConnection = jmxConnector.getMBeanServerConnection();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST12");
}
and the output is :



Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
