Example usage for java.lang ClassNotFoundException printStackTrace

List of usage examples for java.lang ClassNotFoundException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:atd.home.BlogPost.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    try {/*from  w ww  .  ja  va 2  s  . c  o  m*/
        Class.forName("org.apache.commons.lang3.StringEscapeUtils");
    } catch (ClassNotFoundException e) {
        Logger.getLogger("atd.log").warning("Kan niet lib importeren");
        e.printStackTrace();
    }
    String bericht = req.getParameter("bericht");
    java.util.Date dt = new java.util.Date();
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String currentTime = sdf.format(dt);

    User user = (User) req.getSession().getAttribute("username");
    // Deze moet later verwerkt worden in KlantenBinding
    //BerichtenService.setBericht(StringEscapeUtils.escapeHtml4(bericht), currentTime, user);
    RequestDispatcher rd = null;

    Logger.getLogger("atd.log").info("Bericht: " + bericht + " door " + user.getNaam() + " is geplaatst");

    rd = req.getRequestDispatcher("/index.jsp");
    rd.forward(req, resp);
}

From source file:com.rolmex.android.nemalltone.fragment.PageFragment2.java

public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    List<ItemBean> list = null;
    list = itemDao.getItemList();/*  w  ww . j av  a2s. c o m*/
    gridView.AddData(list);
    gridView.setOnViewGroupItemClickListener(new OnViewGroupItemClickListener() {

        @Override
        public void ItemClickListener(ItemBean bean) {
            // TODO Auto-generated method stub
            itemDao.insertIfNot(bean);

            Class class1 = null;
            try {
                class1 = Class.forName("com.rolmex.android.nemalltone." + bean.item_class);
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Intent intent = new Intent(getActivity(), class1);
            startActivity(intent);
        }

    });
}

From source file:org.fusesource.restygwt.rebind.GwtJacksonEncoderDecoderClassCreator.java

@Override
public void generate() throws UnableToCompleteException {
    //Forcing class to be loaded
    try {//from ww w  .j  a  v a 2  s  .c  om
        Class.forName(ObjectMapper.class.getName());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    final JClassType sourceClazz = source.isClass() == null ? source.isInterface() : source.isClass();
    if (sourceClazz == null) {
        getLogger().log(ERROR, "Type is not a class");
        throw new UnableToCompleteException();
    }
    generateMapper();
    generateSingleton(shortName);
    generateEncodeMethod(source);
    generateDecodeMethod(source);
}

From source file:com.ttec.advn.prj.support.AbstractSupportDAO.java

@SuppressWarnings("unchecked")
public AbstractSupportDAO(final String entityName) {
    try {/*from  www. j av  a2s  .  com*/
        this.entityClass = (Class<T>) Class.forName(entityName);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:net.sourceforge.pmd.util.fxdesigner.util.beans.XmlInterfaceVersion1.java

private void parseSingleProperty(Element propertyElement, SimpleBeanModelNode owner) {
    String typeName = propertyElement.getAttribute(SCHEMA_PROPERTY_TYPE);
    String name = propertyElement.getAttribute(SCHEMA_PROPERTY_NAME);
    Class<?> type;// w  w  w .j  a va  2 s .  c  o  m
    try {
        type = ClassUtils.getClass(typeName);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        return;
    }

    ConvertUtils.convert(new Object());
    Object value = ConvertUtils.convert(propertyElement.getTextContent(), type);

    owner.addProperty(name, value, type);
}

From source file:com.qubit.solution.fenixedu.bennu.webservices.servlet.BennuWebservicesInitializer.java

@Atomic(mode = TxMode.READ)
private void synchorizeServices() {
    for (Class clazz : BennuWebService.getAvailableWebServices()) {
        checkServerConfigurationAndCreateIfNeeded(clazz.getName());
    }//from ww  w  .j  a v  a 2 s . co m

    // Since clients are initialised by the WsServlet we need to look them up via classpath scanning
    // using spring componentprovider since we do not have OMNIS lookup available
    // 21 April 2015 - Paulo Abrantes

    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
            false);
    provider.addIncludeFilter(new AssignableTypeFilter(BennuWebServiceClient.class));

    Set<BeanDefinition> components = provider
            .findCandidateComponents(BennuWebServiceClient.class.getPackage().getName().replace('.', '/'));
    for (BeanDefinition component : components) {
        try {
            Class cls = Class.forName(component.getBeanClassName());
            checkClientConfigurationAndCreateIfNeeded(cls.getName());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        // use class cls found
    }

    deleteConfigurations(Bennu.getInstance().getWebserviceConfigurationsSet().stream()
            .filter(configuration -> !configuration.isImplementationClassAvailable())
            .collect(Collectors.toList()));

}

From source file:org.openmrs.module.CDAGenerator.api.impl.CDAGeneratorServiceImpl.java

@Override
public List<BaseCdaSectionHandler> getAllCdaSectionHandlers() {
    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
            true);//from   w  ww.j a v  a  2s  .  c  om

    provider.addIncludeFilter(new AssignableTypeFilter(BaseCdaSectionHandler.class));

    List<BaseCdaSectionHandler> sectionHandlers = new ArrayList<BaseCdaSectionHandler>();

    // scan in org.openmrs.module.CDAGenerator.Sectionhandlers package
    Set<BeanDefinition> components = provider
            .findCandidateComponents("org.openmrs.module.CDAGenerator.SectionHandlers");

    for (BeanDefinition component : components) {
        try {

            Class cls = Class.forName(component.getBeanClassName());

            BaseCdaSectionHandler p = (BaseCdaSectionHandler) cls.newInstance();
            if (p.templateid != null) {
                sectionHandlers.add(p);
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    return sectionHandlers;
}

From source file:org.openmrs.module.CDAGenerator.api.impl.CDAGeneratorServiceImpl.java

@Override
public List<BaseCdaTypeHandler> getAllCdaTypeChildHandlers() {

    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
            true);// www .  j av  a  2  s.co  m

    provider.addIncludeFilter(new AssignableTypeFilter(BaseCdaTypeHandler.class));

    List<BaseCdaTypeHandler> handlers = new ArrayList<BaseCdaTypeHandler>();

    // scan in org.openmrs.module.CDAGenerator.CDAHandlers package
    Set<BeanDefinition> components = provider
            .findCandidateComponents("org.openmrs.module.CDAGenerator.CDAHandlers");

    for (BeanDefinition component : components) {
        try {

            Class cls = Class.forName(component.getBeanClassName());

            BaseCdaTypeHandler p = (BaseCdaTypeHandler) cls.newInstance();
            if (p.templateid != null) {
                handlers.add(p);
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    return handlers;
}

From source file:org.web4thejob.module.JobletInstallerImpl.java

@Override
public boolean canConnect() {
    try {//from www .ja  va 2s .co m
        Class.forName(connInfo.getProperty(DatasourceProperties.DRIVER));
    } catch (java.lang.ClassNotFoundException e) {
        e.printStackTrace();
        return false;
    }

    try {
        Connection conn;
        conn = DriverManager.getConnection(connInfo.getProperty(DatasourceProperties.URL),
                connInfo.getProperty(DatasourceProperties.USER),
                connInfo.getProperty(DatasourceProperties.PASSWORD));
        conn.close();
        return true;
    } catch (SQLException e) {
        e.printStackTrace();
        return false;
    }
}

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./*ww  w  .j  a va2s. c o 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();
    }
}