I need to connect to websphere jmx with groovy: host is input argument
def urlRuntime = '/jndi/JMXConnector'
def urlBase = 'service:jmx:iiop://' + host
def serviceURL = new JMXServiceURL(urlBase + urlRuntime)
def h = new Hashtable()
h.put(Context.SECURITY_PRINCIPAL, username)
h.put(Context.SECURITY_CREDENTIALS, password)
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "com.ibm.websphere.management.remote")
def server = JMXConnectorFactory.connect(serviceURL,h).MBeanServerConnection
println server
when I run this example I got this example:
JSAS1480I: Security is not enabled because the ConfigURL property file is not set.
Caught: java.io.IOException: Connector not available: Error during resolve
java.io.IOException: Connector not available: Error during resolve
at com.ibm.websphere.management.remote.WsProvider.newJMXConnector(WsProvider.java:155)
at KonfiguraceSluzebConfig.main(rob-app-task.groovy:59)
what is wrong with my code ? Iam using websphere version 8.5.5.0
UPDATE
I try to add config file:
h.put("com.ibm.CORBA.ConfigURL","ssl.client.props");
but exception is still same. I dont know how to add there this file
UPDATE2
so after little research I found that I need to add this argument witch groovy:
-Dcom.ibm.CORBA.ConfigURL=sas.client.props
-Dcom.ibm.SSL.ConfigURL=ssl.client.props
now exception JSAS1480I is solved but there is another exception:
Caused by: java.lang.ClassCastException: com.ibm.rmi.javax.rmi.PortableRemoteObject incompatible with javax.rmi.CORBA.PortableRemoteObjectDelegate
when I remove this properties:
h.put(Context.SECURITY_PRINCIPAL, username)
h.put(Context.SECURITY_CREDENTIALS, password)
then pop up window with username and pasword is showed. When I enter valid username and password then we have the same exception:
java.io.IOException: Connector not available: Error during resolve
at com.ibm.websphere.management.remote.WsProvider.newJMXConnector(WsProvider.java:155)
which really doesn't tell me where is the problem ... nice IBM
can anyone helps me with this problem ?
PS: In java this example works