Accepting certificates for OpenJMS HTTPS tunnel

OpenJMS HTTPS tunnel can be a bit tough to setup because Java by default validates SSL certificates and of course the errors you get from OpenJMS are really not that helpful. E.g., “ HTTPS hostname wrong: should be.”

During development often self signed certificates are used, which Java will fail to validate. This can be bypassed with a few lines of code, it will force Java not to check the validity of a certificate: hv=new {
public boolean verify(String urlHostname, String certHostname) {
logger.warn("Hostname: "+urlHostname
+" does not match certificate: "+certHostname);
return true;

Useful Links:

Error I was getting: HTTPS hostname wrong: should be

How to import a certificate from file in Java using keytool

Error I was getting: HTTPS hostname wrong

How to create certificates:

Another SSL HOWTO: