Example usage for java.lang ClassNotFoundException getMessage

List of usage examples for java.lang ClassNotFoundException getMessage

Introduction

In this page you can find the example usage for java.lang ClassNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.anyframe.oden.admin.listener.JasperContextLoaderListener.java

@Override
public void contextInitialized(ServletContextEvent event) {
    Log logger = LogFactory.getLog(JasperContextLoaderListener.class);
    try {// w w  w .  jav a 2s  .  c o m
        Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
    } catch (ClassNotFoundException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage());
        }
    }
}

From source file:com.openteach.diamond.container.Container.java

@SuppressWarnings("unchecked")
private static void initLifecycleListeners() {
    try {//from ww w  .ja v  a  2  s .  c o m
        Enumeration<URL> cUrls = Container.class.getClassLoader().getResources(DIAMOND_LIFECYCLE_FILE);
        while (cUrls.hasMoreElements()) {
            URL url = cUrls.nextElement();
            BufferedReader br = null;
            try {
                br = new BufferedReader(new InputStreamReader(url.openStream()));
                String line = null;
                while ((line = br.readLine()) != null) {
                    try {
                        Class clazz = Container.class.getClassLoader().loadClass(line.trim());
                        if (LifecycleListener.class.isAssignableFrom(clazz)) {
                            lifecycleListeners.add((LifecycleListener) clazz.newInstance());
                        }
                    } catch (ClassNotFoundException e) {
                        System.err.println("?" + line);
                        e.printStackTrace();
                    }
                    //?
                    break;
                }
            } catch (IOException e) {
                logger.error(e);
            } finally {
                if (null != br) {
                    br.close();
                }
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    } catch (Exception e) {
        System.err.println("?diamond!  " + e.getMessage());
        e.printStackTrace();
    }
}

From source file:com.hc.wx.server.common.bytecode.ReflectUtils.java

public static Class<?> forName(String name) {
    try {//from  www .jav a  2  s .c o m
        return name2class(name);
    } catch (ClassNotFoundException e) {
        throw new IllegalStateException("Not found class " + name + ", cause: " + e.getMessage(), e);
    }
}

From source file:ar.com.fdvs.dj.core.layout.ListLayoutManager.java

protected void transformDetailBandTextField(AbstractColumn column, JRDesignTextField textField) {
    log.debug("transforming detail band text field...");
    textField.setPrintRepeatedValues(true);
    try {/* w ww. j  a  v a  2 s .  c  o m*/
        //if we have a java.lang.Number then the pattern must be ignored in order to let Excel recognize the number correctly.
        if (Number.class.isAssignableFrom(Class.forName(textField.getExpression().getValueClassName())))
            textField.setPattern(null);
    } catch (ClassNotFoundException e) {
        throw new LayoutException(e.getMessage(), e);
    }
}

From source file:org.apache.hadoop.security.UserGroupInformation.java

@SuppressWarnings("unchecked")
private static Class<? extends Principal> getOsPrincipalClass() {
    ClassLoader cl = ClassLoader.getSystemClassLoader();
    try {/* w ww  .  j a v  a 2s .  c o  m*/
        if (System.getProperty("java.vendor").contains("IBM")) {
            if (windows) {
                return (Class<? extends Principal>) cl.loadClass("com.ibm.security.auth.UsernamePrincipal");
            } else {
                return (Class<? extends Principal>) (System.getProperty("os.arch").contains("64")
                        ? cl.loadClass("com.ibm.security.auth.UsernamePrincipal")
                        : cl.loadClass("com.ibm.security.auth.LinuxPrincipal"));
            }
        } else {
            return (Class<? extends Principal>) (windows ? cl.loadClass("com.sun.security.auth.NTUserPrincipal")
                    : cl.loadClass("com.sun.security.auth.UnixPrincipal"));
        }
    } catch (ClassNotFoundException e) {
        LOG.error("Unable to find JAAS classes:" + e.getMessage());
    }
    return null;
}

From source file:org.jfree.chart.demo.JDBCXYChartDemo.java

private XYDataset readData() {
    JDBCXYDataset jdbcxydataset = null;/*w w w . ja  va 2 s .c  om*/
    String s = "jdbc:postgresql://nomad/jfreechartdb";
    try {
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException classnotfoundexception) {
        System.err.print("ClassNotFoundException: ");
        System.err.println(classnotfoundexception.getMessage());
    }
    try {
        Connection connection = DriverManager.getConnection(s, "jfreechart", "password");
        jdbcxydataset = new JDBCXYDataset(connection);
        String s1 = "SELECT * FROM XYDATA1;";
        jdbcxydataset.executeQuery(s1);
        connection.close();
    } catch (SQLException sqlexception) {
        System.err.print("SQLException: ");
        System.err.println(sqlexception.getMessage());
    } catch (Exception exception) {
        System.err.print("Exception: ");
        System.err.println(exception.getMessage());
    }
    return jdbcxydataset;
}

From source file:org.apache.kylin.query.adhoc.JdbcConnectionFactory.java

public JdbcConnectionFactory(String jdbcUrl, String driverClass, String username, String password) {
    this.jdbcUrl = jdbcUrl;
    this.driverClass = driverClass;
    this.username = username;
    this.password = password;

    try {//w  ww.  j a v a2  s . c o m
        Class.forName(driverClass);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:org.jfree.chart.demo.JDBCPieChartDemo.java

private PieDataset readData() {
    JDBCPieDataset jdbcpiedataset = null;
    String s = "jdbc:postgresql://nomad/jfreechartdb";
    try {//from   w  w w .j a va2  s  .co  m
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException classnotfoundexception) {
        System.err.print("ClassNotFoundException: ");
        System.err.println(classnotfoundexception.getMessage());
    }
    try {
        Connection connection = DriverManager.getConnection(s, "jfreechart", "password");
        jdbcpiedataset = new JDBCPieDataset(connection);
        String s1 = "SELECT * FROM PIEDATA1;";
        jdbcpiedataset.executeQuery(s1);
        connection.close();
    } catch (SQLException sqlexception) {
        System.err.print("SQLException: ");
        System.err.println(sqlexception.getMessage());
    } catch (Exception exception) {
        System.err.print("Exception: ");
        System.err.println(exception.getMessage());
    }
    return jdbcpiedataset;
}

From source file:org.jasig.irclog.SpelEventFormatter.java

@SuppressWarnings("unchecked")
public void setFormatExpressions(Properties expressions) {
    this.formatExpressions.clear();

    for (final Map.Entry<Object, Object> expressionItr : expressions.entrySet()) {
        final String key = (String) expressionItr.getKey();

        final Class<IrcEvent> eventClass;
        try {/*from w w  w .j  a  v  a 2s  . c  o  m*/
            eventClass = (Class<IrcEvent>) Class.forName(key);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e.getMessage(), e);
        }

        final String expressionText = (String) expressionItr.getValue();
        final Expression expression = this.expressionParser.parseExpression(expressionText);

        this.logger.debug("Compiled expression '" + expression.getExpressionString() + " for " + eventClass);

        this.formatExpressions.put(eventClass, expression);
    }
}

From source file:com.base2.kagura.core.report.connectors.JDBCDataReportConnector.java

/**
 * Constructor. Does a shallow copy of needed values, also prepares parameters and tests the connection. Does the
 * ClassPath search too./*w ww. j a  v a  2 s.co m*/
 * @param reportConfig
 */
public JDBCDataReportConnector(JDBCReportConfig reportConfig) {
    super(reportConfig);
    try {
        if (StringUtils.isNotBlank(reportConfig.getClassLoaderPath()))
            try {
                Class.forName(reportConfig.getClassLoaderPath());
            } catch (ClassNotFoundException e) {
                errors.add(e.getMessage());
                e.printStackTrace();
            }
        connectionProps = new Properties();
        if (StringUtils.isNotBlank(reportConfig.getUsername()))
            connectionProps.put("user", reportConfig.getUsername());
        if (StringUtils.isNotBlank(reportConfig.getPassword()))
            connectionProps.put("password", reportConfig.getPassword());
        setJdbc(reportConfig.getJdbc());
        getStartConnection();
        connection.close();
        connection = null;
    } catch (SQLException e) {
        errors.add(e.getMessage());
        e.printStackTrace();
    } catch (NamingException e) {
        errors.add(e.getMessage());
        e.printStackTrace();
    }
}