Examples of StartupException


Examples of org.apache.roller.planet.business.startup.StartupException

            } catch (ClassNotFoundException ex) {
                String errorMsg =
                     "ERROR: cannot load JDBC driver class [" + getJdbcDriverClass()+ "]. "
                    +"Likely problem: JDBC driver jar missing from server classpath.";
                errorMessage(errorMsg);
                throw new StartupException(errorMsg, ex, startupLog);
            }
            successMessage("SUCCESS: loaded JDBC driver class [" +getJdbcDriverClass()+ "]");
           
            if (getJdbcUsername() != null || getJdbcPassword() != null) {
                props = new Properties();
                if (getJdbcUsername() != null) props.put("user", getJdbcUsername());
                if (getJdbcPassword() != null) props.put("password", getJdbcPassword());
            }
           
        // Else attempt to locate JNDI datasource
        } else {
            String name = "java:comp/env/" + getJndiName();
            successMessage("-- Using JNDI datasource name: " + name);
            try {
                InitialContext ic = new InitialContext();
                dataSource = (DataSource)ic.lookup(name);
            } catch (NamingException ex) {
                String errorMsg =
                    "ERROR: cannot locate JNDI DataSource [" +name+ "]. "
                   +"Likely problem: no DataSource or datasource is misconfigured.";
                errorMessage(errorMsg);
                throw new StartupException(errorMsg, ex, startupLog);
            }           
            successMessage("SUCCESS: located JNDI DataSource [" +name+ "]");
        }
       
        // So far so good. Now, can we get a connection?
        try {
            Connection testcon = getConnection();
            testcon.close();
        } catch (Throwable t) {
            String errorMsg =
                "ERROR: unable to obtain database connection. "
               +"Likely problem: bad connection parameters or database unavailable.";
            errorMessage(errorMsg);
            throw new StartupException(errorMsg, t, startupLog);
        }
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.startup.StartupException

            } catch (ClassNotFoundException ex) {
                String errorMsg =
                     "ERROR: cannot load JDBC driver class [" + getJdbcDriverClass()+ "]. "
                    +"Likely problem: JDBC driver jar missing from server classpath.";
                errorMessage(errorMsg);
                throw new StartupException(errorMsg, ex, startupLog);
            }
            successMessage("SUCCESS: loaded JDBC driver class [" +getJdbcDriverClass()+ "]");
           
            if (getJdbcUsername() != null || getJdbcPassword() != null) {
                props = new Properties();
                if (getJdbcUsername() != null) props.put("user", getJdbcUsername());
                if (getJdbcPassword() != null) props.put("password", getJdbcPassword());
            }
           
        // Else attempt to locate JNDI datasource
        } else {
            String name = "java:comp/env/" + getJndiName();
            successMessage("-- Using JNDI datasource name: " + name);
            try {
                InitialContext ic = new InitialContext();
                dataSource = (DataSource)ic.lookup(name);
            } catch (NamingException ex) {
                String errorMsg =
                    "ERROR: cannot locate JNDI DataSource [" +name+ "]. "
                   +"Likely problem: no DataSource or datasource is misconfigured.";
                errorMessage(errorMsg);
                throw new StartupException(errorMsg, ex, startupLog);
            }           
            successMessage("SUCCESS: located JNDI DataSource [" +name+ "]");
        }
       
        // So far so good. Now, can we get a connection?
        try {
            Connection testcon = getConnection();
            testcon.close();
        } catch (Throwable t) {
            String errorMsg =
                "ERROR: unable to obtain database connection. "
               +"Likely problem: bad connection parameters or database unavailable.";
            errorMessage(errorMsg);
            throw new StartupException(errorMsg, t, startupLog);
        }
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

         different directories, we can't guess the location )
         Also, it means something is wrong - and it's better to
         warn the user, so he can correct it
      */
      System.out.println("No config file found " + configFile );
      throw new StartupException("No config file found " + configFile );
     
      //       System.out.println("No config file found " + configFile );
      //       InputStream is =
      //           this.getClass().getResourceAsStream(configFile);
     
      //       loadConfig(is, validate);
  } else {
      try {
          configURL = URLUtil.resolve(configFile);
      } catch (MalformedURLException mue) {
          String msg = sm.getString("startup.loadconfig.mue",
        configFile);

    throw new StartupException(msg);
      }

      loadConfig(configURL, validate);
  }
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

  XMLParser parser = new XMLParser();

  try {
      this.config = parser.process(configURL, validate);
  } catch (Exception e) {
      throw new StartupException(e.getMessage());
  }

        processArgs(this.config);
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

        XMLParser parser = new XMLParser();

  try {
      this.config = parser.process(is, validate);
  } catch (Exception e) {
      throw new StartupException(e.getMessage());
  }

  processArgs(this.config);
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

      out.close();
  } catch (IOException e) {
      String msg = sm.getString("startup.loadconfig.ioe",
          configFile);

      throw new StartupException(msg);
  }
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

         different directories, we can't guess the location )
         Also, it means something is wrong - and it's better to
         warn the user, so he can correct it
      */
      System.out.println("No config file found " + configFile );
      throw new StartupException("No config file found " + configFile );
     
      //       System.out.println("No config file found " + configFile );
      //       InputStream is =
      //           this.getClass().getResourceAsStream(configFile);
     
      //       loadConfig(is, validate);
  } else {
      try {
          configURL = URLUtil.resolve(configFile);
      } catch (MalformedURLException mue) {
          String msg = sm.getString("startup.loadconfig.mue",
        configFile);

    throw new StartupException(msg);
      }

      loadConfig(configURL, validate);
  }
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

  XMLParser parser = new XMLParser();

  try {
      this.config = parser.process(configURL, validate);
  } catch (Exception e) {
      throw new StartupException(e.getMessage());
  }

        processArgs(this.config);
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

        XMLParser parser = new XMLParser();

  try {
      this.config = parser.process(is, validate);
  } catch (Exception e) {
      throw new StartupException(e.getMessage());
  }

  processArgs(this.config);
    }
View Full Code Here

Examples of org.apache.tomcat.shell.StartupException

      out.close();
  } catch (IOException e) {
      String msg = sm.getString("startup.loadconfig.ioe",
          configFile);

      throw new StartupException(msg);
  }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.