/*
  * (non-Javadoc)
  *
  * @see javax.servlet.GenericServlet#init()
  */
 @Override
 public void init() throws ServletException {
   super.init();
   try {
     LoadTest.start();
     LOGGER.info("Server started successfully.");
     LoadTest.getLoadTestServer().logState();
   } catch (ServerStartupException e) {
     LoadTest.getLoadTestServer().setServerStartupError(e);
     List<String> messages = new ArrayList<String>();
     messages.add("!!!! SiteWhere Load Test Node Failed to Start !!!!");
     messages.add("");
     messages.add("Component: " + e.getDescription());
     messages.add("Error: " + e.getComponent().getLifecycleError().getMessage());
     String message = StringMessageUtils.getBoilerPlate(messages, '*', 60);
     LOGGER.info("\n" + message + "\n");
   } catch (SiteWhereException e) {
     List<String> messages = new ArrayList<String>();
     messages.add("!!!! SiteWhere Load Test Node Failed to Start !!!!");
     messages.add("");
     messages.add("Error: " + e.getMessage());
     String message = StringMessageUtils.getBoilerPlate(messages, '*', 60);
     LOGGER.info("\n" + message + "\n");
   } catch (Throwable e) {
     List<String> messages = new ArrayList<String>();
     messages.add("!!!! Unhandled Exception !!!!");
     messages.add("");
     messages.add("Error: " + e.getMessage());
     String message = StringMessageUtils.getBoilerPlate(messages, '*', 60);
     LOGGER.info("\n" + message + "\n");
   }
 }
Esempio n. 2
0
 /**
  * Display the "login" page.
  *
  * @return
  */
 @RequestMapping("/")
 public ModelAndView login() {
   Tracer.start(TracerCategory.AdminUserInterface, "login", LOGGER);
   try {
     Map<String, Object> data = new HashMap<String, Object>();
     data.put(DATA_VERSION, VersionHelper.getVersion());
     if (SiteWhere.getServer().getLifecycleStatus() == LifecycleStatus.Started) {
       return new ModelAndView("login", data);
     } else {
       ServerStartupException failure = SiteWhere.getServer().getServerStartupError();
       data.put("subsystem", failure.getDescription());
       data.put("component", failure.getComponent().getLifecycleError().getMessage());
       return new ModelAndView("noserver", data);
     }
   } finally {
     Tracer.stop(LOGGER);
   }
 }