I tried to connect to JBoss MBeanServer through http-invoker.sar
I followed the steps given in
http://docs.jboss.org/jbossas/admindevel326/html/ch3.chapter.html#d0e7813
Below code gets JNDI reference
String host = "yogendrav";
int port = 8443;
Properties jndiprops = new Properties();
String servletUrl="/invoker/JNDIFactory";
String providerurl="https://"+host+":"+port+servletUrl;
jndiprops.put("java.naming.provider.url",providerurl);
jndiprops.put("java.naming.factory.initial","org.jboss.naming.HttpNamingContextFactory");
InitialContext ic = new InitialContext(jndiprops);
Object o =ic.lookup("jmx/rmi/RMIAdaptor");
But the code works only if add the keystore file in the system property
If I dont add the below line I get certification handshake exception.
System.setProperty("javax.net.ssl.trustStore",
"E:\\jboss\\jboss-3.2.6\\jboss-3.2.6\\server\\default\\conf\\chap8.keystore");
I want to avoid adding the keystore file in the code.
I tried below code snippet to override default TrustManager with mine which
dont bother about trusting the server certificates.
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[]
getAcceptedIssuers() {
return null;
}
public boolean isClientTrusted(
java.security.cert.X509Certificate[]
certs) {
return true;
}
public boolean isServerTrusted(
java.security.cert.X509Certificate[]
certs) {
return true;
}
}
};
try {
SSLContext sc = SSLContext.getInstance("SSLv3");
sc.init(null, trustAllCerts, null);//new
java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
e.printStackTrace();
}
Unfortunately this workaround doesnot work!!!!!!!!
My question is how to override default trust manager so that I dont have to
bother about adding keystore file in the program.
Additional info:
1, Iam new to SSL
2, I dont mind accepting any certificates in my java client.
Thanks a lot in advance for helping me.
Regards
--Yoge
anonymous wrote : anonymous wrote :
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869005#3869005
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869005
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user