use of org.apache.servicecomb.foundation.common.exceptions.ServiceCombException in project incubator-servicecomb-java-chassis by apache.
the class MicroserviceConfigLoader method loadAndSort.
public void loadAndSort() {
try {
String configFileFromClasspath = System.getProperty("cse.configurationSource.defaultFileName") == null ? DEFAULT_CONFIG_FILE_NAME : System.getProperty("cse.configurationSource.defaultFileName");
super.load(configFileFromClasspath);
loadAdditionalConfig();
if (configModels.isEmpty()) {
LOGGER.warn("No URLs will be polled as dynamic configuration sources.");
LOGGER.warn("To enable URLs as dynamic configuration sources, define System property {} or make {} available on classpath.", ADDITIONAL_CONFIG_URL, configFileFromClasspath);
}
sort();
} catch (IOException e) {
throw new ServiceCombException("Failed to load microservice config", e);
}
}
use of org.apache.servicecomb.foundation.common.exceptions.ServiceCombException in project incubator-servicecomb-java-chassis by apache.
the class AbstractTransport method genAddressWithoutSchemaForOldSC.
private String genAddressWithoutSchemaForOldSC(String addressWithoutSchema, String encodedQuery) {
// traced by JAV-307
try {
LOGGER.warn("Service center do not support encoded query, so we use unencoded query, " + "this caused not support chinese/space (and maybe other char) in query value.");
String decodedQuery = URLDecoder.decode(encodedQuery, StandardCharsets.UTF_8.name());
addressWithoutSchema += decodedQuery;
} catch (UnsupportedEncodingException e) {
// never happened
throw new ServiceCombException("Failed to decode query.", e);
}
try {
// make sure consumer can handle this endpoint
new URI(Const.RESTFUL + "://" + addressWithoutSchema);
} catch (URISyntaxException e) {
throw new ServiceCombException("current service center not support encoded endpoint, please do not use chinese or space or anything need to be encoded.", e);
}
return addressWithoutSchema;
}
use of org.apache.servicecomb.foundation.common.exceptions.ServiceCombException in project incubator-servicecomb-java-chassis by apache.
the class MetricsHttpPublisher method init.
private void init(String address) {
try {
InetSocketAddress socketAddress = getSocketAddress(address);
MetricsCollector metricsCollector = new MetricsCollector();
metricsCollector.register();
this.httpServer = new HTTPServer(socketAddress, CollectorRegistry.defaultRegistry, true);
LOGGER.info("Prometheus httpServer listened : {}.", address);
} catch (Exception e) {
throw new ServiceCombException("create http publish server failed,may bad address : " + address, e);
}
}
use of org.apache.servicecomb.foundation.common.exceptions.ServiceCombException in project java-chassis by ServiceComb.
the class PrometheusPublisher method init.
@Override
public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) {
this.globalRegistry = globalRegistry;
// prometheus default port allocation is here : https://github.com/prometheus/prometheus/wiki/Default-port-allocations
String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS_PROMETHEUS_ADDRESS, "0.0.0.0:9696").get();
try {
InetSocketAddress socketAddress = getSocketAddress(address);
register();
this.httpServer = new HTTPServer(socketAddress, CollectorRegistry.defaultRegistry, true);
LOGGER.info("Prometheus httpServer listened : {}.", address);
} catch (Exception e) {
throw new ServiceCombException("create http publish server failed,may bad address : " + address, e);
}
}
use of org.apache.servicecomb.foundation.common.exceptions.ServiceCombException in project java-chassis by ServiceComb.
the class MicroserviceConfigLoader method loadAndSort.
public void loadAndSort() {
String configFileFromClasspath = null;
try {
configFileFromClasspath = System.getProperty(DEFAULT_FILE_NAME) == null ? DEFAULT_CONFIG_FILE_NAME : System.getProperty(DEFAULT_FILE_NAME);
super.load(configFileFromClasspath);
loadAdditionalConfig();
if (configModels.isEmpty()) {
LOGGER.warn("No URLs will be polled as dynamic configuration sources.");
LOGGER.warn("To enable URLs as dynamic configuration sources, define System property {} or make {} available on classpath.", ADDITIONAL_CONFIG_URL, configFileFromClasspath);
}
sort();
} catch (Exception e) {
throw new ServiceCombException("Failed to load microservice configFile " + configFileFromClasspath, e);
}
}
Aggregations