I have a application that conect to a web service with SSL. In the static of the class that make the conecction to the web server I have this:
static {
URL url = null;
try {
URL baseUrl;
baseUrl = ar.com.cfa.xmlns.wsevaluartdm.WSEvaluarTDM.class.getResource(".");
url = new URL(baseUrl, "https://www.site.com/WS.asmx?WSDL");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'https://www.site.com/WS.asmx?WSDL', retrying as a local file");
logger.warning(e.getMessage());
}
WSEVALUARTDM_WSDL_LOCATION = url;
}
The URL("https://www.site.com/WS.asmx?WSDL") change every 15 days, so I need to put that url in a configuration file.But I can't because if I try to put a variable in static{} the error "non-static variable name cannot be referenced from a static context" shows up. What can I do?
seems like your static initializer is accessing an instance variable (possibly logger
, WSEVALUARTDM_WSDL_LOCATION
).
精彩评论