when config the grails config location as below
grails.config.locations = [
"https://ip:8443/config/Config.groovy"
]
will get the below warning message in log
2018-11-28 19:04:22,682 WARN ConfigurationHelper - Unable to load specified config location https://ip:8443/config/Config.groovy : File does not exist.
but I can access https://ip:8443/config/Config.groovy directly from the browser.
In org.codehaus.groovy.grails.commons.cfg.ConfigurationHelper.mergeInLocations()
private static void mergeInLocations(ConfigObject config, List locations, PathMatchingResourcePatternResolver resolver, ClassLoader classLoader) {
...
def resource = resolver.getResource(location.toString())
if(resource.exists()) {
...
} else {
LOG.warn "Unable to load specified config location $location : File does not exist."
}
}
the resolver is the org.springframework.core.io.support.PathMatchingResourcePatternResolver in spring. and resolver.getResource(location.toString()) result will be a org.springframework.core.io.UrlResource
and UrlResource.exists() code is like
public boolean exists() {
...
try {
URLConnection con = url.openConnection();
HttpURLConnection httpCon =
(con instanceof HttpURLConnection ? (HttpURLConnection) con : null);
if (httpCon != null) {
int code = httpCon.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
return true;
}
else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
return false;
}
}
}catch(IOException ex){
return false;
}
}
and since its https , it will throw java.security.cert.CertificateException: No subject alternative names present when httpCon.getResponseCode().
so UrlResource is not for https resource? what should I do if I want to load the https resource? thanks.
Note the error message you describe, which I can also duplicate: "No subject alternative names present" means that your hostname "ip" is not in the certificate. Try switching to the fully qualified domain name, like "ip.mydomain.com" or whatever is encoded in the certificate. (You can view your certificate details in your browser on the "page info" dialog)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.