代码:
String wasInstallLocation = "/opt/IBM/WebSphere/AppServer";
String trustStore = "/profiles/dwe/etc/DummyClientTrustFile.jks";
String keyStore = "/profiles/dwe/etc/DummyClientKeyFile.jks";
String trustStorePW = "WebAS";
String keyStorePW = "WebAS";
Properties connectProps = new Properties();
connectProps.setProperty( AdminClient.USERNAME, this.user );
connectProps.setProperty( AdminClient.PASSWORD, this.password );
connectProps.setProperty( AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP );
connectProps.setProperty( AdminClient.CONNECTOR_HOST, "localhost" );
connectProps.setProperty( AdminClient.CONNECTOR_PORT, "" + "8880" );
connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
connectProps.setProperty( "javax.net.ssl.trustStore", wasInstallLocation
+ trustStore );
connectProps.setProperty( "javax.net.ssl.keyStore", wasInstallLocation
+ keyStore );
connectProps.setProperty( "javax.net.ssl.trustStorePassword", trustStorePW );
connectProps.setProperty( "javax.net.ssl.keyStorePassword", keyStorePW );
// create a new connection
try {
adminClient = AdminClientFactory.createAdminClient( connectProps );
} catch (ConnectorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
错误:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/ws/bootstrap/RASWsLoggerFactory
at com.ibm.websphere.management.AdminClientFactory.<clinit>(AdminClientFactory.java:119)
at WebSphereJmxTest.createConncetion(WebSphereJmxTest.java:53)
at WebSphereJmxTest.main(WebSphereJmxTest.java:102)
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.bootstrap.RASWsLoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)