@Override public String getApplicationToken(String persistenceUnit, String externalProperties) { String applicationToken; try { log.debug("\n\nGetting Application Token..."); WebResource.Builder atBuilder = webResource.path(Constants.KUNDERA_API_PATH + "/application/" + persistenceUnit).accept(mediaType) .type(mediaType); StringBuffer sb = new StringBuffer().append(externalProperties); ClientResponse insertResponse = (ClientResponse) atBuilder.post(ClientResponse.class, sb.toString()); InputStream is = insertResponse.getEntityInputStream(); applicationToken = StreamUtils.toString(is); log.debug("Application Token:" + applicationToken); } catch (UniformInterfaceException e) { log.error("Error during getApplicationToken, Caused by:" + e.getMessage() + ", returning null"); return null; } catch (ClientHandlerException e) { log.error("Error during getApplicationToken, Caused by:" + e.getMessage() + ", returning null"); return null; } return applicationToken; }
/** * Exception indicates a technical problem while processing the call on client side and should therefore be logged * with error. A typical cause could be that no connection to the server could be established. * * @param ex the exception of the failed request */ private static void handleException(final ClientHandlerException ex) { LOGGER.error("Request failed: message={}", ex.getMessage()); throw MissingServerConnectionException.createForRequestProcessingFailed(ex.getMessage()); }
@Override public void run() { if (methodName != null) { Class<?> c = this.getClass(); Method method; try { method = c.getDeclaredMethod(methodName, parameterTypes); method.invoke(this, parameters); } catch (IllegalAccessException | NoSuchMethodException e) { LOG.error("Could not find method {} in class", methodName); return; } catch (InvocationTargetException e) { LOG.error("Invocation target exception: {}", e.getMessage()); return; } catch (UniformInterfaceException e) { LOG.error("REST Server error. Message: {}", e.getMessage()); return; } catch (ClientHandlerException e) { LOG.error("Could not communicate with REST Server: {} ", e.getMessage()); return; } } } }
private void processClientHandlerException(ClientHandlerException e) { if (e.getCause() instanceof java.net.SocketTimeoutException || e.getCause() instanceof java.net.ConnectException) { LOG.error("Connection to {} failed: {}", client.getHost(), e.getMessage()); this.isInitialized = false; throw e; } else { throw e; } }
System.err.println("ClientHandlerException connecting to Server: "+che.getMessage()); return null;
} else { LOG.error("ClientHandlerException on {}: {}", Thread.currentThread().getStackTrace()[1], e.getMessage()); } else { LOG.error("ClientHandlerException on {}: {}", Thread.currentThread().getStackTrace()[1], e.getMessage()); } else { LOG.error("ClientHandlerException on {}: {}", Thread.currentThread().getStackTrace()[1], e.getMessage());
ERR_STREAM .print("Unable to connect to Ivory server, please check if the URL is correct and Ivory server is up and running\n"); ERR_STREAM.println(ex.getMessage()); return -1; } catch (Exception ex) {
throw new OpenStackConnectException(e.getMessage(), e); } catch (UniformInterfaceException e) { throw new OpenStackResponseException(e.getResponse().getClientResponseStatus().getReasonPhrase(), e