Skip to content

Commit

Permalink
Inital fix for issue 109 via using -D on JVM
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianfei Xu committed Oct 16, 2014
1 parent 6665212 commit 00ec088
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

import javax.management.*;
import javax.management.remote.*;
import javax.management.remote.rmi.RMIConnectorServer;
import javax.naming.Context;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;

import org.jolokia.backend.executor.MBeanServerExecutor;
import org.jolokia.backend.RequestDispatcher;
Expand Down Expand Up @@ -124,6 +127,13 @@ protected Map<String,Object> prepareEnv(Map<String, String> pTargetConfig) {
ret.put(Context.SECURITY_CREDENTIALS, password);
ret.put("jmx.remote.credentials",new String[] { user, password });
}

if (!System.getProperty("javax.net.ssl.trustStore", "NULL").equals("NULL")) {
SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory();
ret.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
ret.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf);
}
return ret;
}

Expand Down

0 comments on commit 00ec088

Please sign in to comment.