List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:hu.tbognar76.apking.ApKing.java
@SuppressWarnings("unchecked") private void readInCache() { try {/*from w w w . ja va2 s. c o m*/ FileInputStream fileIn = new FileInputStream(this.init.serialCache); ObjectInputStream in = new ObjectInputStream(fileIn); this.serialInHash = (HashMap<String, ApkInfo>) in.readObject(); in.close(); fileIn.close(); // System.out.println("Cache loaded: " + this.serialCache + // " cache size: " + this.serialInHash.size()); } catch (IOException i) { System.out.println("No Cache!!"); return; } catch (ClassNotFoundException c) { c.printStackTrace(); return; } }
From source file:hu.tbognar76.apking.ApKing.java
private void readPhoneCache() { try {/*from ww w . j av a 2 s . com*/ FileInputStream fileIn = new FileInputStream(this.init.phoneCache); ObjectInputStream in = new ObjectInputStream(fileIn); @SuppressWarnings("unchecked") ArrayList<DeviceApp> readObject = (ArrayList<DeviceApp>) in.readObject(); this.dmanager.apps = readObject; in.close(); fileIn.close(); // System.out.println("Cache loaded: " + this.serialCache + // " cache size: " + this.serialInHash.size()); } catch (IOException i) { System.out.println("No Cache!!"); return; } catch (ClassNotFoundException c) { c.printStackTrace(); return; } }
From source file:llc.rockford.webcast.EC2Driver.java
private void initLookAndFeel() { String lookAndFeel = null;//from ww w. j av a 2 s . c om if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:dk.netarkivet.externalsoftware.HeritrixTests.java
/** * Check, if class exists, and can be loaded. TODO try to instantiate the class as well. * * @param className a name for a class/*from ww w. j av a 2 s. c om*/ * @return true, if class exists, and can be loaded.XS */ private boolean validClass(String className) { URLClassLoader loader = URLClassLoader.newInstance(classPathAsURLS()); try { loader.loadClass(className); } catch (ClassNotFoundException e) { e.printStackTrace(); return false; } return true; }
From source file:se.vgregion.delegation.server.Server.java
public void startServer(ClassPathXmlApplicationContext ctx, String hostname, String port) { Server.setEndpoints(new ArrayList<Endpoint>()); try {/*from w w w.j av a 2 s.c om*/ Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e) { LOGGER.error("ClassNotFoundException for: org.postgresql.Driver " + e.getMessage()); } DelegationService delegationService = (DelegationService) ctx.getBean("delegationService"); propertiesBean = (PropertiesBean) ctx.getBean("propertiesBean"); // Make CXF use log4j (instead of JDK-logging), currently can't use slf4j. // System.setProperty("org.apache.cxf.Logger", "org.apache.cxf.common.logging.Log4jLogger"); https = (propertiesBean.getCertPass() != null && !propertiesBean.getCertPass().equals("")); String http = "http"; // Setups SSL and Certificates. if (https) { try { http = "https"; setupServerEngineFactory(Integer.parseInt(port)); } catch (IOException e) { e.printStackTrace(); } catch (GeneralSecurityException e) { e.printStackTrace(); } } String address2 = http + "://" + hostname + ":" + port + "/getactivedelegations"; String address3 = http + "://" + hostname + ":" + port + "/getdelegation"; String address4 = http + "://" + hostname + ":" + port + "/getinactivedelegations"; String address5 = http + "://" + hostname + ":" + port + "/getdelegationsbyunitandrole"; String address6 = http + "://" + hostname + ":" + port + "/getdelegations"; String address7 = http + "://" + hostname + ":" + port + "/hasdelegation"; String address8 = http + "://" + hostname + ":" + port + "/savedelegations"; String address9 = http + "://" + hostname + ":" + port + "/removedelegation"; String address10 = http + "://" + hostname + ":" + port + "/finddelegations"; String address11 = http + "://" + hostname + ":" + port + "/pingforconfiguration"; LOGGER.info( "RIV TA Basic Profile v2.1 - Delegation Service , Apache CXF Producer running on Java version {}", System.getProperty("java.version")); LOGGER.info("Starting server..."); startService(new GetActiveDelegationsResponderInterfaceImpl(delegationService), address2); startService(new GetDelegationResponderInterfaceImpl(delegationService), address3); startService(new GetInactiveDelegationsResponderInterfaceImpl(delegationService), address4); startService(new GetDelegationsbyUnitAndRoleResponderInterfaceImpl(delegationService), address5); startService(new GetDelegationsResponderInterfaceImpl(delegationService), address6); startService(new HasDelegationResponderInterfaceImpl(delegationService), address7); startService(new SaveDelegationsResponderInterfaceImpl(delegationService), address8); startService(new RemoveDelegationResponderInterfaceImpl(delegationService), address9); startService(new FindDelegationsResponderInterfaceImpl(delegationService), address10); startService(new PingForConfigurationResponderInterfaceImpl(delegationService), address11); LOGGER.info("Server ready!"); }
From source file:mercury.Controller.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("processRequest start: " + this.getMemoryInfo()); String submitButton = null;/*from w w w. j av a 2 s . c o m*/ String jspURL = null; HashMap<String, String> requestParametersHash = null; String thisPage = null; String lastVisitedPage = null; request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); try { //--- gets all request parameters, either multipart or not this.putAllRequestParametersInAttributes(request); requestParametersHash = (HashMap<String, String>) request.getAttribute("REQUEST_PARAMETERS"); //--- sets the last visited page to errorJsp if it is the first time the controller runs lastVisitedPage = (String) request.getSession().getAttribute("LAST_VISITED_PAGE"); if (StringUtils.isBlank(lastVisitedPage)) { lastVisitedPage = errorJsp; jspURL = lastVisitedPage; request.getSession().setAttribute("LAST_VISITED_PAGE", jspURL); } submitButton = requestParametersHash.get("submitButton"); thisPage = requestParametersHash.get("thisPage"); AuthorizationPoints atps = (AuthorizationPoints) request.getSession().getAttribute("LOGGED_USER_ATPS"); if (atps == null) { atps = new AuthorizationPoints(null); request.getSession().setAttribute("LOGGED_USER_ATPS", atps); } AuthorizationBO authBO = new AuthorizationBO(); String handlerName = Controller.targetHandlers.getProperty(thisPage); if (submitButton.equals("i18n")) { request.getSession().setAttribute("I18N", requestParametersHash.get("i18n")); jspURL = lastVisitedPage; } else if (authBO.authorize(atps, handlerName, submitButton)) { BaseHandler handler = (BaseHandler) Class.forName(handlerName).newInstance(); jspURL = handler.process(request, response); } else { Dialog.showWarning(request, "ERROR_NO_PERMISSION"); jspURL = lastVisitedPage; } } catch (ClassNotFoundException e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 1: " + e); Dialog.showError(request, "DIALOG_VOID"); jspURL = lastVisitedPage; } catch (ExceptionUser e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 2: " + e.getKeyText()); Dialog.showError(request, e.getKeyText()); jspURL = lastVisitedPage; } catch (DAOException e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 3: " + e); Dialog.showError(request, "ERROR_DATABASE"); jspURL = lastVisitedPage; } catch (Exception e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 4: " + e); e.printStackTrace(); Dialog.showError(request, "DIALOG_VOID"); jspURL = lastVisitedPage; } finally { if (jspURL == null || jspURL.equals("")) { jspURL = errorJsp; request.getSession().setAttribute("LAST_VISITED_PAGE", jspURL); return; } else if (jspURL.equals("x-download")) { return; } else if (jspURL.equals("x-json")) { return; } else { request.getSession().setAttribute("LAST_VISITED_PAGE", jspURL); request.getRequestDispatcher(jspURL).forward(request, response); return; } } }
From source file:at.flack.MainActivity.java
public String loadCookie() throws StreamCorruptedException, FileNotFoundException, IOException { ObjectInputStream inputStream = null; String erg = null;/* www . j av a 2s. co m*/ try { inputStream = new ObjectInputStream(new FileInputStream(new File(this.getFilesDir(), "cookie.dat"))); erg = (String) inputStream.readObject(); } catch (ClassNotFoundException e) { } finally { try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return erg; }
From source file:org.apache.horn.core.RecurrentLayeredNeuralNetwork.java
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); this.finalLayerIdx = input.readInt(); this.dropRate = input.readFloat(); // read neuron classes int neuronClasses = input.readInt(); this.neuronClassList = Lists.newArrayList(); for (int i = 0; i < neuronClasses; ++i) { try {/* w w w.j av a 2 s .c o m*/ Class<? extends Neuron> clazz = (Class<? extends Neuron>) Class.forName(input.readUTF()); neuronClassList.add(clazz); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // read squash functions int squashingFunctionSize = input.readInt(); this.squashingFunctionList = Lists.newArrayList(); for (int i = 0; i < squashingFunctionSize; ++i) { this.squashingFunctionList.add(FunctionFactory.createFloatFunction(WritableUtils.readString(input))); } this.recurrentStepSize = input.readInt(); this.numOutCells = input.readInt(); int recurrentLayerListSize = input.readInt(); this.recurrentLayerList = Lists.newArrayList(); for (int i = 0; i < recurrentLayerListSize; i++) { this.recurrentLayerList.add(input.readBoolean()); } // read weights and construct matrices of previous updates int numOfMatrices = input.readInt(); this.weightMatrixLists = Lists.newArrayListWithExpectedSize(this.recurrentStepSize); this.prevWeightUpdatesLists = Lists.newArrayList(); for (int step = 0; step < this.recurrentStepSize; step++) { this.weightMatrixList = Lists.newArrayList(); this.prevWeightUpdatesList = Lists.newArrayList(); for (int j = 0; j < this.layerSizeList.size() - 2; j++) { FloatMatrix matrix = FloatMatrixWritable.read(input); this.weightMatrixList.add(matrix); this.prevWeightUpdatesList.add(new DenseFloatMatrix(matrix.getRowCount(), matrix.getColumnCount())); } // if the cell has output layer, read from input if (step >= this.recurrentStepSize - this.numOutCells) { FloatMatrix matrix = FloatMatrixWritable.read(input); this.weightMatrixList.add(matrix); this.prevWeightUpdatesList.add(new DenseFloatMatrix(matrix.getRowCount(), matrix.getColumnCount())); } this.weightMatrixLists.add(this.weightMatrixList); this.prevWeightUpdatesLists.add(this.prevWeightUpdatesList); } }
From source file:com.flexive.core.storage.MySQL.MySQLStorageFactory.java
/** * {@inheritDoc}//from ww w . j a v a2s.c o m */ @Override public Connection getConnection(String database, String schema, String jdbcURL, String jdbcURLParameters, String user, String password, boolean createDB, boolean createSchema, boolean dropIfExist) throws Exception { Connection con = null; Statement stmt = null; try { String db = schema; if (StringUtils.isBlank(db)) db = database; if (StringUtils.isBlank(db)) throw new IllegalArgumentException("No database or schema name specified!"); System.out.println("Using schema [" + db + "] for " + VENDOR); String url = jdbcURL; if (StringUtils.isBlank(url)) throw new IllegalArgumentException("No JDBC URL provided!"); url = url.trim(); if (!StringUtils.isBlank(jdbcURLParameters)) { String p = jdbcURLParameters.trim(); if (!(url.endsWith("?") || p.startsWith("?"))) p = "?" + (p.charAt(0) == '&' ? p.substring(1) : p); url = url + p; } try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (ClassNotFoundException e) { System.err.println("MySQL JDBC Driver not found in classpath!"); return null; } System.out.println("Connecting using JDBC URL " + url); con = DriverManager.getConnection(url, user, password); stmt = con.createStatement(); int cnt = 0; if (dropIfExist) cnt += stmt.executeUpdate("DROP DATABASE IF EXISTS " + db); if (createDB) cnt += stmt.executeUpdate("CREATE DATABASE IF NOT EXISTS " + db); if (cnt > 0) System.out.println("Executed " + cnt + " statements"); } catch (SQLException e) { e.printStackTrace(); return null; } finally { if (stmt != null) stmt.close(); } return con; }