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:hu.sztaki.lpds.pgportal.services.asm.ASMService.java

/**
 * /*from w  ww . j  a  v  a  2  s .co  m*/
 * Sets the command line argument of a specified job
 * 
 * @param userId
 *            - id of the user
 * @param selected_concrete
 *            - name of the workflow
 * @param selected_job
 *            - name of the job
 * @param commandline
 *            - string to be set as command line argument
 */
public synchronized void setCommandLineArg(String userId, String selected_concrete, String selected_job,
        String commandline) {
    // System.out.println("setting command line arg : concrete " + selected_concrete + "... job... : " +
    // selected_job + " ... command line : " + commandline);
    try {
        Vector<JobPropertyBean> jobs = getConfigData(userId, selected_concrete);
        Vector<JobPropertyBean> new_jobs = new Vector<JobPropertyBean>();
        for (int i = 0; i < jobs.size(); ++i) {
            JobPropertyBean actjob = jobs.get(i);

            // System.out.println("job : " + actjob.getName() + " txt is : " + actjob.getTxt() + " param is : " +
            // actjob.getExe().get("params"));
            if (actjob.getName().equals(new String(selected_job))) {
                actjob.getExe().put("params", commandline);
                // System.out.println("Saving job command line arguments: " + actjob.getExe().get("params"));
            }
            new_jobs.add(actjob);
        }
        // MoSGrid autosave
        if (autoSave) {
            saveConfigData(userId, selected_concrete, new_jobs);
        }
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    }
    // System.out.println("command line saved");

}

From source file:hu.sztaki.lpds.pgportal.services.asm.ASMService.java

/**
 * Set nodenumber property of a given MPI job. If the type of the job is not MPI, "NotMPIException" will be thrown
 * //  ww w .  jav a  2 s.  c o  m
 * @param userId
 *            - user ID
 * @param workflowID
 *            - workflow ID
 * @param jobID
 *            - job ID
 * @param nodenumber
 *            - nodenumber to be set to the job
 * @throws hu.sztaki.lpds.pgportal.services.asm.exceptions.general.NotMPIJobException
 */
public synchronized void setNodeNumber(String userId, String workflowID, String jobID, int nodenumber)
        throws NotMPIJobException {
    // System.out.println("setting command line arg : concrete " + selected_concrete + "... job... : " +
    // selected_job + " ... command line : " + commandline);
    try {
        Vector<JobPropertyBean> jobs = getConfigData(userId, workflowID);
        Vector<JobPropertyBean> new_jobs = new Vector<JobPropertyBean>();
        for (int i = 0; i < jobs.size(); ++i) {
            JobPropertyBean actjob = jobs.get(i);

            // System.out.println("job : " + actjob.getName() + " txt is : " + actjob.getTxt() + " param is : " +
            // actjob.getExe().get("params"));
            if (actjob.getName().equals(new String(jobID))) {
                if ("MPI".equals(actjob.getExe().get("type"))) {
                    actjob.getExe().put("nodenumber", Integer.toString(nodenumber));
                } else {
                    throw new NotMPIJobException(userId, workflowID, jobID);
                }
                // System.out.println("Saving job command line arguments: " + actjob.getExe().get("params"));
            }
            new_jobs.add(actjob);
        }
        // MoSGrid autosave
        if (autoSave) {
            saveConfigData(userId, workflowID, new_jobs);
        }
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);
    }
    // System.out.println("command line saved");

}

From source file:de.prozesskraft.pradar.parts.PradarPartUi3.java

/**
 * asks for entities from the first pradar-server that responds
 * @return void//  w w  w . ja  v  a2 s.c  o m
 */
void loadData() {
    for (String portAtMachineAsString : this.pradar_server_port_at_hostname) {
        String[] port_and_machine = portAtMachineAsString.split("@");

        int portNumber = Integer.parseInt(port_and_machine[0]);
        String machineName = port_and_machine[1];
        log("info", "want to load data from pradar-server");
        log("info", "trying pradar-server " + portNumber + "@" + machineName);
        try {

            // socket einrichten und Out/Input-Streams setzen
            //            log("debug", "machineName="+machineName+" | portNumber="+portNumber);

            //            log("debug", "server objekt erstellen");
            Socket connectToServerSocket = new Socket(machineName, portNumber);
            connectToServerSocket.setSoTimeout(20000);

            //            log("debug", "outputStream erstellen");
            OutputStream streamToServer = connectToServerSocket.getOutputStream();

            //            log("debug", "outputStream  flushen");
            streamToServer.flush();

            //            log("debug", "objectOutputStream  erstellen");
            ObjectOutputStream objectToServer = new ObjectOutputStream(streamToServer);

            //            log("debug", "objectOutputStream  flushen");
            objectToServer.flush();

            // Objekte zum server uebertragen
            //            log("debug", "write: getallfromuser");
            objectToServer.writeObject("getallfromuser");
            objectToServer.writeObject(System.getProperty("user.name"));

            //            log("debug", "outputStream  flushen");
            streamToServer.flush();

            //            log("debug", "objectOutputStream  flushen");
            objectToServer.flush();

            // sende-object zerstoeren - wird nicht mehr gebraucht
            //            log("debug", "objectOutputStream schliessen");
            //            objectToServer.close();

            //            log("debug", "inputStream erstellen");
            InputStream streamFromServer = connectToServerSocket.getInputStream();

            //            log("debug", "objectInputStream  erstellen");
            ObjectInputStream objectFromServer = new ObjectInputStream(streamFromServer);

            // Antwort vom Server lesen - ein array aller Entities
            try {
                //               log("debug", "reading");
                Object serverAnswer = objectFromServer.readObject();
                //               log("debug", "reading done");

                // lese-object zerstoeren - wird nicht mehr gebraucht
                objectFromServer.close();
                //               log("debug", "objectFromServer closed");

                ArrayList<Object> serverAnswer2 = null;
                if (serverAnswer instanceof ArrayList) {
                    //                  log("debug", "serverAnswer is an ArrayList");
                    serverAnswer2 = (ArrayList<Object>) serverAnswer;
                }

                // alle existierenden entities loeschen
                this.entities_all.clear();

                // die neuen entities casten und in einem map unterbringen id->Entities erstellen um die children bei ihren parents einsortieren zu koennen
                Map<String, Entity> entities_all = new HashMap<String, Entity>();
                for (Object actObject : serverAnswer2) {
                    // 
                    if (actObject instanceof Entity) {
                        //                     log("debug", "item of ArrayList<Object> is an Entity  --->  adding to ArrayList<Entity>");
                        Entity newEntity = (Entity) actObject;
                        this.entities_all.add(newEntity);
                    }
                }

                //               log("debug", "reading done! closing ");
                objectFromServer.close();

                //               log("debug", "read finished");
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            // daten holen aus db
            log("info", "refreshing data...");
            connectToServerSocket.close();

        } catch (UnknownHostException e) {
            log("warn", "unknown host " + machineName);
            this.pradar_server_port_at_hostname = null;
        } catch (IOException e) {
            log("warn", "input / output problems at " + portNumber + "@" + machineName);
            e.printStackTrace();
        }

        this.refresh_last = Calendar.getInstance();
        this.refresh_next = Calendar.getInstance();
        this.refresh_next.add(13, this.refresh_interval);
    }
}

From source file:hu.sztaki.lpds.pgportal.services.asm.ASMService.java

public void test(String userID, String workflowID) {
    try {// w ww .j  av a2s. c o m
        Vector<JobPropertyBean> properties = getWorkflowConfig(userID, workflowID);
        for (JobPropertyBean propertyBean : properties) {
            System.out.println("Desc");
            propertyBean.getDesc().put("TESTKEY", "DESC");
            dumpMap(propertyBean.getDesc());
            System.out.println("Desc0");
            propertyBean.getDesc0().put("TESTKEY", "DESC0");
            dumpMap(propertyBean.getDesc0());
            System.out.println("Exe");
            propertyBean.getExe().put("TESTKEY", "EXE");
            dumpMap(propertyBean.getExe());
            System.out.println("ExeDisabled");
            propertyBean.getExeDisabled().put("TESTKEY", "ExeDis");
            dumpMap(propertyBean.getExeDisabled());
            System.out.println("Inherited");
            propertyBean.getInherited().put("TESTKEY", "Inherited");
            dumpMap(propertyBean.getInherited());
            System.out.println("Label");
            propertyBean.getLabel().put("TESTKEY", "LABEL");
            dumpMap(propertyBean.getLabel());

            System.out.println("Inputs");
            Vector inputs = propertyBean.getInputs();
            for (Object obj : inputs) {

                PortDataBean portBean = (PortDataBean) obj;
                System.out.println("Port " + portBean.getName());
                System.out.println("\tData:");
                dumpMap(portBean.getData());
                System.out.println("\tDataDis:");
                dumpMap(portBean.getDataDisabled());
                System.out.println("\tDesc:");
                dumpMap(portBean.getDesc());
                System.out.println("\tInher:");
                dumpMap(portBean.getInherited());
                System.out.println("\tLabel:");
                dumpMap(portBean.getLabel());
                System.out.println("seq: " + portBean.getSeq());
                System.out.println("txt: " + portBean.getTxt());
                System.out.println("x: " + portBean.getX());
                System.out.println("y: " + portBean.getY());
                System.out.println("id: " + portBean.getId());
                System.out.println("prejob: " + portBean.getPrejob());
                System.out.println("preoutput: " + portBean.getPreoutput());

            }
        }

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

From source file:hu.sztaki.lpds.pgportal.services.asm.ASMService.java

private InputStream getFileStreamFromStorage(String userID, String workflowID, int downloadtype) {
    InputStream is = null;//from w  w w .  jav a  2s  .c  o m
    try {
        Hashtable hsh = new Hashtable();
        try {
            hsh.put("url", STORAGE);
        } catch (Exception e) {
        }
        Hashtable<String, String> params = new Hashtable<String, String>();
        params.put("portalID", PORTAL);
        params.put("wfsID", WFS);
        params.put("userID", userID);
        params.put("workflowID", workflowID);
        // params.put("jobID", jobID);

        // TODO : modify pidID to handle parametric output ports!!!

        // params.put("pidID", pID);
        String runtimeID = getRuntimeID(userID, workflowID);

        if (runtimeID != null) {
            switch (downloadtype) {

            case DownloadTypeConstants.All:
                params.put("downloadType", "all");
                params.put("instanceType", "all");
                params.put("outputLogType", "all");
                break;
            case DownloadTypeConstants.AllInputs:
                params.put("downloadType", "inputs");
                break;
            case DownloadTypeConstants.AllOutputs:
                params.put("downloadType", "outputs_all");
                break;
            case DownloadTypeConstants.AllButLogs:
                params.put("downloadType", "all");
                params.put("instanceType", "all");
                params.put("outputLogType", "none");
                break;
            case DownloadTypeConstants.InstanceAll:
                params.put("downloadType", "inputs_" + runtimeID);
                params.put("instanceType", "one_" + runtimeID);

                break;
            case DownloadTypeConstants.InstanceOutputs:
                params.put("downloadType", "outputs_" + runtimeID);

                break;

            }

            ServiceType st = InformationBase.getI().getService("storage", "portal", hsh, new Vector());
            PortalStorageClient ps = (PortalStorageClient) Class.forName(st.getClientObject()).newInstance();
            ps.setServiceURL(st.getServiceUrl());
            ps.setServiceID("/download");
            is = ps.getStream(params);

            return is;
        }
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);

    } catch (InstantiationException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);

    } catch (IOException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);

    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, ex);

    }

    return null;
}

From source file:hu.sztaki.lpds.pgportal.services.asm.ASMService.java

/**
 * Sets the number of expected input files of an input port (parameter sweep)
 *//* w w  w.j a v  a 2s . c  o  m*/
public void setNumberOfInputFiles(String userID, String workflowID, String jobID, String portID,
        Integer value) {
    try {
        Vector<JobPropertyBean> jobs = getConfigData(userID, workflowID);
        for (JobPropertyBean propertyBean : jobs) {
            if (propertyBean.getName().equals(jobID)) {
                Vector inputs = propertyBean.getInputs();
                for (Object obj : inputs) {
                    PortDataBean portBean = (PortDataBean) obj;

                    if (portBean.getSeq() == Long.parseLong(portID)) {
                        portBean.getData().put("max", value.toString());
                        break;
                    }
                }
                break;
            }
        } // MoSGrid autosave
        if (autoSave) {
            saveConfigData(userID, workflowID, jobs);
        }
    } catch (ClassNotFoundException e) {
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, e);
        e.printStackTrace();
    } catch (InstantiationException e) {
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, e);
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        Logger.getLogger(ASMService.class.getName()).log(Level.SEVERE, null, e);
        e.printStackTrace();
    }
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Returns a ViewDef Obj with the form UI built.
 * @param view the view definition/* w  ww .j  av  a  2  s.co  m*/
 * @param altView which AltViewIFace to build
 * @param parentView the MultiViw that this view/form will be parented to
 * @param options the options needed for creating the form
 * @param cellName the name of the cell when it is a subview
 * @param dataClass the class of the data that is put into the form
 * @return a Viewable Obj with the form UI built
 */
public Viewable buildViewable(final ViewIFace view, final AltViewIFace altView, final MultiView parentView,
        final int options, final String cellName, final Color bgColor) {
    if (viewFieldColor == null) {
        viewFieldColor = AppPrefsCache.getColorWrapper("ui", "formatting", "viewfieldcolor");
    }

    ViewDefIFace viewDef = altView.getViewDef();
    if (viewDef == null) {
        // This error is bad enough to have it's own dialog
        String msg = String.format("The ViewDef is null for View '%s' AltView '%s'", view.getName(),
                altView.getName());
        FormDevHelper.appendFormDevError(msg);
        UIRegistry.showError(msg);
        return null;
    }

    Class<?> dataClass = null;
    DBTableInfo tableInfo = DBTableIdMgr.getInstance().getByClassName(view.getClassName());
    MultiView parentsMV = parentView != null ? parentView.getMultiViewParent() : null;
    if (tableInfo == null && parentsMV != null && cellName != null) {
        tableInfo = DBTableIdMgr.getInstance().getByClassName(parentsMV.getView().getClassName());
        if (tableInfo != null) {
            DBTableChildIFace childInfo = tableInfo.getItemByName(cellName);
            if (childInfo != null) {
                dataClass = childInfo.getDataClass();
            }
        }
    } else {
        try {
            dataClass = Class.forName(view.getClassName());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (viewDef.getType() == ViewDefIFace.ViewType.form) {
        Viewable viewable = buildFormViewable(view, altView, parentView, options, cellName, dataClass, bgColor);
        return viewable;

    } else if (viewDef.getType() == ViewDefIFace.ViewType.table
            || viewDef.getType() == ViewDefIFace.ViewType.formtable) {
        Viewable viewable = buildTableViewable(view, altView, parentView, options, cellName, dataClass,
                bgColor);
        return viewable;

    } else if (viewDef.getType() == ViewDefIFace.ViewType.field) {
        return null;

    } else if (viewDef.getType() == ViewDefIFace.ViewType.iconview) {
        return new IconViewObj(view, altView, parentView, options, cellName, dataClass);
    } else if (viewDef.getType() == ViewDefIFace.ViewType.rstable) {
        return buildRecordSetTableViewable(view, altView, parentView, options, cellName, dataClass, bgColor);

    } else {
        FormDevHelper.appendFormDevError("Form Type not covered by builder [" + viewDef.getType() + "]");
    }
    return null;
}

From source file:JNLPAppletLauncher.java

/**
 * The true start of the sub applet (invoked in the EDT)
 *//*from   w w w. jav  a 2  s .com*/
private void startSubApplet() {
    try {
        subApplet = (Applet) Class
                .forName(subAppletClassName, true, Thread.currentThread().getContextClassLoader())
                .newInstance();
        subApplet.setStub(new AppletStubProxy());
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
        displayError("Class not found: " + subAppletClassName);
        return;
    } catch (Exception ex) {
        ex.printStackTrace();
        displayError("Unable to start " + subAppletDisplayName);
        return;
    }

    add(subApplet, BorderLayout.CENTER);

    try {
        subApplet.init();
        remove(loaderPanel);
        validate();
        checkNoDDrawAndUpdateDeploymentProperties();
        subApplet.start();
        appletStarted = true;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:edu.lternet.pasta.datapackagemanager.DataPackageManager.java

/**
 * Returns the access control list (ACL) for the given resource identifier if
 * it exists; otherwise, throw a ResourceNotFoundException.
 * //from   w  w  w .j av  a 2s .c o  m
 * @param resourceId      The resource identifier
 * @return  an XML string representing the access control list. The string includes
 *          an entry for the owner/submitter although that entry does not appear
 *          in the access_matrix table (the owner/submitter is stored only in the 
 *          resource_registry table).
 * @throws ClassNotFoundException
 * @throws SQLException
 * @throws UnauthorizedException
 * @throws ResourceNotFoundException
 * @throws Exception
 */
public String readResourceAcl(String resourceId) throws ClassNotFoundException, SQLException,
        UnauthorizedException, ResourceNotFoundException, Exception {

    String acl = null;

    try {
        DataPackageRegistry dataPackageRegistry = new DataPackageRegistry(dbDriver, dbURL, dbUser, dbPassword);

        boolean hasResource = dataPackageRegistry.hasResource(resourceId);
        if (!hasResource) {
            String gripe = "Resource not found: " + resourceId;
            throw new ResourceNotFoundException(gripe);
        }

        acl = dataPackageRegistry.getResourceAcl(resourceId);
        if (acl == null) {
            String gripe = "An access control list (ACL) does not exist for this resource: " + resourceId;
            throw new ResourceNotFoundException(gripe);
        }

    } catch (ClassNotFoundException e) {
        logger.error(e.getMessage());
        e.printStackTrace();
        throw (e);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        e.printStackTrace();
    }

    return acl;

}

From source file:edu.lternet.pasta.datapackagemanager.DataPackageManager.java

/**
 * Returns the SHA-1 checksum for the given resource identifier if
 * it exists; otherwise, throw a ResourceNotFoundException.
 * /*w w  w .ja v a  2s .c  o m*/
 * @param resourceId   the resource identifier
 * @param authToken    the authorization token
 * @return the SHA-1 checksum string
 * @throws ClassNotFoundException
 * @throws SQLException
 * @throws UnauthorizedException
 * @throws ResourceNotFoundException
 * @throws Exception
 */
public String readResourceChecksum(String resourceId, AuthToken authToken) throws ClassNotFoundException,
        SQLException, UnauthorizedException, ResourceNotFoundException, Exception {

    String checksum = null;
    String user = authToken.getUserId();

    try {
        DataPackageRegistry dataPackageRegistry = new DataPackageRegistry(dbDriver, dbURL, dbUser, dbPassword);

        /*
         * Check whether user is authorized to read the data package report
         */
        Authorizer authorizer = new Authorizer(dataPackageRegistry);
        boolean isAuthorized = authorizer.isAuthorized(authToken, resourceId, Rule.Permission.read);
        if (!isAuthorized) {
            String gripe = "User " + user + " does not have permission to read the checksum for this resource: "
                    + resourceId;
            throw new UnauthorizedException(gripe);
        }

        checksum = dataPackageRegistry.getResourceShaChecksum(resourceId);

        if (checksum == null) {
            String gripe = "A checksum does not exist for this resource: " + resourceId;
            throw new ResourceNotFoundException(gripe);
        }

    } catch (ClassNotFoundException e) {
        logger.error(e.getMessage());
        e.printStackTrace();
        throw (e);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        e.printStackTrace();
    }

    return checksum;

}