Package org.olat.core.logging

Examples of org.olat.core.logging.StartupException


        courseNodeConfigurations.put(cnConfig.getAlias(), cnConfig);
        log.info("Added building block '" + cnConfig.getAlias() + "', class '" + cnConfig.getClass().getName() + "'.");
        if (cnConfig instanceof OLATExtension) try {
          extMgr.deployExtension((OLATExtension) cnConfig);
        } catch (IOException ioe) {
          throw new StartupException("Error deploying bean '" + cnConfig + "'.",ioe);
        }
      } catch (ClassCastException cce) {
        // log message because static initializers will throw
        // ErrorInInitializeError, consuming the StartupException
        throw new StartupException("Bean is not of type CourseNodeConfiguration.", cce);
      }
    }
  }
View Full Code Here


    XMLConfiguration instConfigSection = null;
    try {
      instConfigSection = new XMLConfiguration(configurationFile);
    } catch (ConfigurationException ce) {
      throw new StartupException("Error loading institution portlet configuration file!", ce);
    }
    if (instConfigSection == null) { throw new StartupException("Error loading institution portlet configuration file!"); }

    institutions = new FastHashMap();
    for (Iterator iter = instConfigSection.getChildren("institution").iterator(); iter.hasNext();) {
      Configuration instConfigEntry = (Configuration) iter.next(); // the institutions config entry
      String shortName = instConfigEntry.getAttribute("shortname"); // short name of inst

      if (shortName == null) { throw new StartupException("Institution portlet startup: No shortname given for one entry!"); }
      try {
        List<InstitutionPortletSupervisorEntry> supervisors = new ArrayList<InstitutionPortletSupervisorEntry>(1); // there may be more than one supervisor
        for (Iterator it = instConfigEntry.getChildren(SUPERVISOR).iterator(); it.hasNext();) {
          Configuration supervisorElement = (Configuration) it.next(); // one supervisor element
          InstitutionPortletSupervisorEntry ipse = new InstitutionPortletSupervisorEntry(getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_PERSON)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_PHONE)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_EMAIL)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_URL)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_BLOG)));
          supervisors.add(ipse); // save it
        }

        //get polymorph links
        List<Configuration> polymorphConfs = instConfigEntry.getChildren(POLYMORPHLINK);
        List<PolymorphLink> polyList = new ArrayList<PolymorphLink>();
        if (polymorphConfs != null && polymorphConfs.size() > 0) {
          for(Configuration polymorphConf: polymorphConfs) {
            List<PolymorphLinkElement> elemList = new ArrayList<PolymorphLinkElement>();
            for (Iterator<Configuration> it = polymorphConf.getChildren(POLYMORPHLINK_ELEMENT).iterator(); it.hasNext();) {
              Configuration tmp = it.next();
              elemList.add(new PolymorphLinkElement(tmp.getAttribute(POLYMORPHLINK_ELEMENT_ATTRIBUT), tmp
                  .getAttribute(POLYMORPHLINK_ELEMENT_VALUE), tmp.getAttribute(POLYMORPHLINK_ELEMENT_ID), tmp
                  .getAttribute(POLYMORPHLINK_ELEMENT_CONDITION)));
             
            }
            PolymorphLink polyLink = new PolymorphLink(polymorphConf.getAttribute(POLYMORPHLINK_TARGETID), polymorphConf.getAttribute(POLYMORPHLINK_TYPE),
                polymorphConf.getAttribute(POLYMORPHLINK_TEXT), elemList);
            polyList.add(polyLink);
          }
        }
       
        InstitutionPortletEntry ipe = new InstitutionPortletEntry(instConfigEntry.getChild(INSTITUTION_NAME).getAttribute(VALUE),
            instConfigEntry.getChild(INSTITUTION_URL).getAttribute(VALUE), instConfigEntry.getChild(INSTITUTION_LOGO).getAttribute(VALUE),
            supervisors, polyList);
        institutions.put(shortName.toLowerCase(), ipe); // save inst entry
      } catch (Exception e) {
        e.printStackTrace();
        throw new StartupException(e.getMessage(), e);
      }
    }

    // from now on optimize for non-synchronized read access
    institutions.setFast(true);
View Full Code Here

    }
   
    // check SSL certifications, throws Startup Exception if certificate is not found
    if(isSslEnabled()){
      if (!LDAPHelper.checkServerCertValidity(0))
        throw new StartupException("LDAP enabled but no valid server certificate found. Please fix!");
      if (!LDAPHelper.checkServerCertValidity(30))
        log.warn("Server Certificate will expire in less than 30 days.");
    }
   
    // Check ldap connection
View Full Code Here

    log.info("JMX support enabled.");
    Configuration jmxServer = moduleConfig.getChild("jmxserver");
    try {
      port = Integer.parseInt(jmxServer.getAttribute("port"));
    } catch (NumberFormatException nfe) {
      throw new StartupException("Invalid JMX server port. Please fix!");
    }
    user = jmxServer.getAttribute("user");
    pass = jmxServer.getAttribute("pass");
    if (user != null && user.length() == 0) user = null;
    if (pass != null && pass.length() == 0) pass = null;

    // expose MBeans
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    List beans = moduleConfig.getChildren("bean");
    for (Iterator iter = beans.iterator(); iter.hasNext();) {
      Configuration bean = (Configuration) iter.next();
      String clazz = bean.getAttribute("class");
      Class beanClass;
      try {
        beanClass = cl.loadClass(clazz);
        ObjectName name = new ObjectName(JMXHelper.buildRegisteredObjectName(beanClass, WebappHelper.getServletContextPath()));
        if (!mbs.isRegistered(name))
          mbs.registerMBean(beanClass.newInstance(), name);
      } catch (Exception e) {
        throw new StartupException("Error instantiating JMX bean: ", e);
      }
    }
  }
View Full Code Here

              + " from plugin factory::"
              + pluginConfigFile.getFile().getAbsolutePath(),
              ExtensionManager.class);
      }
    } catch (BeansException e) {
      throw new StartupException("Error deploying extensions! ["+beanFactories[i]+"] Make sure your application server has write access to your olat installation: ", e);
    }
  }
View Full Code Here

    for (Iterator iter = extensions.iterator(); iter.hasNext();) {
      try {
        ext = (OLATExtension)iter.next();
        ext.setup();
      } catch (Exception e) {
        throw new StartupException("Extension '" + ext.getName() + "' threw exception during setup()",e);
      }
    }
  }
View Full Code Here

        if (!fExtSubpath.mkdirs()) throw new IOException("Unable to create targetpath for extension '" + extension.getName() + "' at " + fExtSubpath.getCanonicalPath());
      is = extRes.getContent();
      os = new FileOutputStream(new File(fExtSubpath, extRes.getTargetName()));
      FileUtils.copy(is, os);
    } catch (IOException e) {
      throw new StartupException("Failed to deploy extension '" + extension.getName() + "'.",e);
    } finally {
      FileUtils.closeSafely(is);
      FileUtils.closeSafely(os);
    }
  }
View Full Code Here

        con.close();
      }

    } catch (ClassNotFoundException e) {
      log.warn("Could not load jdbc driver for database configured in olat_config.xml. Driver: "+ driverClass, e);
      throw new StartupException("Could not load jdbc driver for database configured in olat_config.xml. Driver: "+ driverClass, e);
    } catch (SQLException e) {
      log.warn("Could not execute system upgrade sql query. Query:"+ query, e);
      throw new StartupException("Could not execute system upgrade sql query. Query:"+ query, e);
    }
  }
View Full Code Here

      String username = dbProperties.get("db.user");
      String password = dbProperties.get("db.pass");
     
      con = DriverManager.getConnection(dbUrl, username, password);
      if (con == null) {
        throw new StartupException("Could not connect to database. Make sure you have the right driver and your database is running. Try 'ant checkdb'", null);
      }
      //TODO:gs  check if I can alter a db statement and report an exception if not (not all users are allowed to do this)
      statement = con.createStatement();
      Iterator<OLATUpgrade> iter = upgrades.iterator();
      OLATUpgrade upgrade = null;
      while (iter.hasNext()) {
        upgrade = iter.next();
        String alterDbStatementsFilename = upgrade.getAlterDbStatements();
        if (alterDbStatementsFilename != null) {
          UpgradeHistoryData uhd = getUpgradesHistory(upgrade.getVersion());
          if (uhd == null) {
            // has never been called, initialize
            uhd = new UpgradeHistoryData();
          }
           
          if (!uhd.getBooleanDataValue(upgrade.TASK_DP_UPGRADE)) {
            loadAndExecuteSqlStatements(statement, alterDbStatementsFilename, dialect);
            uhd.setBooleanDataValue(upgrade.TASK_DP_UPGRADE, true);
            setUpgradesHistory(uhd, upgrade.getVersion());
            log.audit("Successfully executed alter DB statements for Version::" + upgrade.getVersion());
          }
         
        }
      }
     
    } catch (ClassNotFoundException e) {
      log.warn("Could not load jdbc driver for database configured in olat_config.xml. Driver: "+ dbProperties.get("db.jdbc.driver"), e);
      throw new StartupException("Could not load jdbc driver for database configured in olat_config.xml. Driver: "+ dbProperties.get("db.jdbc.driver"), e);
     
    catch (SQLException e) {
      log.error("Could not upgrade your database!");
      throw new StartupException("Could not execute alter db statements.", e);
     
    } catch (Throwable e) {
      log.warn("Error executing alter DB statements::", e);
      abort(e);
     
    } finally {
      try {
        if (statement != null) {
          statement.close();
        }
      } catch (SQLException e2){
        log.warn("Could not close sql statement", e2);
        throw new StartupException("Could not close sql statements.", e2);
      } finally {
        try {
          if (con != null) {
            con.close();
          }
        } catch (SQLException e3){
          log.warn("Could not close db connection.", e3);
          throw new StartupException("Could not close db connection.", e3);
        }
      }
    }
   
  }
View Full Code Here

            //stop upgrading database if already done
            if (e.getMessage()!= null && (msg.contains("already exists") || msg.contains("Duplicate") || msg.contains("Can't create table") || msg.contains("column/key exists"))) {
              log.error("Error while trying to upgrade the database with:("+sql+"). We will continue with upgrading but check the errors manually! Error says:", e);
            } else {
              log.error("Could not upgrade you database!");
              throw new StartupException("Could not add alter db statements to batch.", e);
            }
          }
        }
       
      in.close();
View Full Code Here

TOP

Related Classes of org.olat.core.logging.StartupException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.