Showing posts with label ssl. Show all posts
Showing posts with label ssl. Show all posts

Thursday, June 4, 2009

WebSphere 6.1 - JMX SOAP Connection Example

import java.util.Properties;
import com.ibm.websphere.management.AdminClient;
import com.ibm.websphere.management.AdminClientFactory;

public class JMXTest {

public static void main(String[] args) {
JMXTest jmxtest = new JMXTest();
jmxtest.execute();
}

public void execute() {
try {
Properties connectProps = new Properties(); 
connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP); 
connectProps.setProperty(AdminClient.CONNECTOR_HOST, "{hostname}"); 
connectProps.setProperty(AdminClient.CONNECTOR_PORT, "{8879 or your-soap-port"); 
connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
connectProps.setProperty(AdminClient.USERNAME, "{username}");
connectProps.setProperty(AdminClient.PASSWORD, "{password}");
connectProps.setProperty("javax.net.ssl.trustStore", "/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/etc/DummyClientTrustFile.jks");
connectProps.setProperty("javax.net.ssl.keyStore", "/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/etc/DummyClientKeyFile.jks");

AdminClient adminClient = null; 
try 
{ 
adminClient = AdminClientFactory.createAdminClient(connectProps); 
System.out.println("Connected Successfully");
} 
catch (Exception e) 
{ 
System.out.println("Exception creating admin client: " + e); 
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}

Wednesday, May 20, 2009

WebSphere SOAP Connection Errors

Problem:
WASX7023E: Error creating "SOAP" connection to host "{hostname}"; exception information: com.ibm.websphere.management.exception.ConnectorNotAvailableException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted; targetException=java.lang.IllegalArgumentException: Error opening socket: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted]

Solution:
Attempt to recreate the problem using wsadmin
./wsadmin.sh -conntype SOAP -host {hostname} -port {8879 or relevant port}  -user {username} -password {password}

Copy the deployment manager Dummy*.jks files from /etc location to app server /etc location.
Try running the above wsadmin command