Java – CertificateException: No name matching xxx found

At paysafecard we have a lot to deal with certificates. For our test systems we use one SSL certificate for different sub-domains, e.g. one certificate for “” used for “” and “”.

But when you do this, you get a No name matching xxx found when trying to connect e.g. with new;

The work around for this problem is, to include the following in your Java class (found here):

public class ClassBla {
  static { {
      public boolean verify(String hostname, sslSession) {
        return true;

There is a way to import a certificate issued to a different domain for another certain (sub-)domain with the java keytool as well.