So, if i execute that class I'm getting following exceptions:
com.ibm.websphere.management.exception.ConnectorException: ADMC0016E: The system cannot create a SOAP connector to connect to host localhost at port 8879.
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
... 1 more
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error parsing HTTP status line " java.util.NoSuchElementException; targetException=java.lang.IllegalArgumentException: Error parsing HTTP status line "java.util.NoSuchElementException]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
at org.apache.soap.rpc.Call.invoke(Unknown Source)
... 7 more
What I would like to do is to be able to access PMI data throug JMX.
Any ideas on what's happening here would be appriciated. Thank you in advance.
Now conclusion is: Sequrity considered to be enabled if you have checkbox "Enable administrative security" marked in the console.
port number to use: could be viewed in the application server ports list. as SOAP_CONNECTOR_ADDRESS.
first of all, thank you, Askar, for these useful information, as I was struggling to understand what was going on. Admins told me there was no SSL when I started coding and hence testing. >_<
Anyway I don't know anything about WebSphere and I haven't been able to sort this out as mention in the sample.
I don't know if I misspelled the file path or if the password is not common or if this Dummy key has been removed from the WAS or else...
As I'm in a hurry, I will not investigate further. Now it works fine on my side as well : )
BTW, I'd like to add that the first error is due to this line not being specified (default)
No security then = Cannot parse.... but I had some dodgy characters (in my eclipse console) after the quote (6 small squares)
Then I changed this line to: props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
and the error was:
[SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: unable to find valid certification path to requested target; targetException=java.lang.IllegalArgumentException:
Then I went to IBM website, via google, and find out how to set the .jks files on my client side and so on...
For the Server certificate, if it is not present on your local machine (client) then use the certificate your browser is using when accessing the WAS console
for instance I ended with these lines:
props.setProperty("javax.net.ssl.trustStore", "C:/Program Files/IBM/SDP70/runtimes/base_v61/bin/ClientTrust.jks");
props.setProperty("javax.net.ssl.keyStore", "C:/Program Files/IBM/SDP70/runtimes/base_v61/bin/ClientKey.jks");
Once again, thank you Askar, for this useful post.