Beispiel #1
0
 /** {@inheritDoc} */
 public Object addingService(ServiceReference reference) {
   HttpService service = (HttpService) context.getService(reference);
   try {
     service.registerServlet(
         getServletAlias(),
         new JolokiaServlet(context, restrictor),
         getConfiguration(),
         getHttpContext());
   } catch (ServletException e) {
     logError("Servlet Exception: " + e, e);
   } catch (NamespaceException e) {
     logError("Namespace Exception: " + e, e);
   }
   return service;
 }
Beispiel #2
0
 @SuppressWarnings("PMD.SystemPrintln")
 private void logError(String message, Throwable throwable) {
   ServiceReference lRef = bundleContext.getServiceReference(LogService.class.getName());
   if (lRef != null) {
     try {
       LogService logService = (LogService) bundleContext.getService(lRef);
       if (logService != null) {
         logService.log(LogService.LOG_ERROR, message, throwable);
         return;
       }
     } finally {
       bundleContext.ungetService(lRef);
     }
   }
   System.err.println("Jolokia-Error: " + message + " : " + throwable.getMessage());
 }