Example usage for java.rmi RemoteException printStackTrace

List of usage examples for java.rmi RemoteException printStackTrace

Introduction

In this page you can find the example usage for java.rmi RemoteException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:gridool.tools.MonetDBParallelLoader.java

public static void main(String[] args) {
    final DBPartitioningJobConf jobConf = new GetOptDBPartitioningJobConf(args);
    PartitioningJobType jobType = jobConf.getJobType();
    LogFactory.getLog(MonetDBParallelLoader.class).info("jobType: " + jobType);

    final GridClient grid = new GridClient();
    try {/*from   w  ww  .jav a 2  s. co m*/
        grid.execute(DBPartitioningJob.class, jobConf);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:caarray.client.examples.download_file.grid.GridFileDownload.java

public static void main(String[] args) {
    GridFileDownload gridClient = new GridFileDownload();
    try {//from   ww w  .  ja va  2 s. c  o  m
        CaArraySvcClient client = new CaArraySvcClient(BaseProperties.getGridServiceUrl());
        System.out.println("Grid-Downloading file contents from " + FILE_NAME + "...");
        gridClient.downloadContents(client, FILE_NAME);
    } catch (RemoteException e) {
        System.out.println("Remote server threw an exception.");
        e.printStackTrace();
    } catch (Throwable t) {
        // Catches things like out-of-memory errors and logs them.
        System.out.println("Generic error.");
        t.printStackTrace();
    }
}

From source file:ParallelizedMatrixProduct.java

public static void main(String args[]) throws Exception {

    System.setSecurityManager(new YesSecurityManager());

    double[][] matrix1 = new double[MATRIX_SIZE][MATRIX_SIZE];
    double[][] matrix2 = new double[MATRIX_SIZE][MATRIX_SIZE];

    for (int i = 0; i < MATRIX_SIZE; ++i)
        for (int j = 0; j < MATRIX_SIZE; ++j) {
            matrix1[i][j] = Math.round(Math.random() * MATRIX_ELEMENT_MAX_VALUE);
            matrix2[i][j] = Math.round(Math.random() * MATRIX_ELEMENT_MAX_VALUE);
        }//  w  w  w.j  a v a 2 s . com

    ExecutorService exec = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
    Future<Double>[][] futures = new Future[MATRIX_SIZE][MATRIX_SIZE];
    for (int i = 0; i < MATRIX_SIZE; ++i) {
        for (int j = 0; j < MATRIX_SIZE; ++j) {
            final double[] v1 = getRow(matrix1, i);
            final double[] v2 = getColumn(matrix2, j);

            if (i % 2 == 0) {
                futures[i][j] = exec.submit(new Callable<Double>() {
                    public Double call() {

                        RPFSessionInfo.get().put("USER", "USER FOR " + Thread.currentThread().getName());
                        RServices rp = null;
                        int replayCounter = NBR_REPLAY_ON_FAILURE;

                        while (replayCounter >= 0) {

                            try {

                                rp = (RServices) org.kchine.rpf.ServantProviderFactory.getFactory()
                                        .getServantProvider().borrowServantProxy();

                                rp.putAndAssign(new RNumeric(v1), "rv1");
                                rp.putAndAssign(new RNumeric(v2), "rv2");
                                RMatrix res = ((RMatrix) rp.getObject("rv1%*%rv2"));

                                return ((RNumeric) res.getValue()).getValue()[0];

                            } catch (TimeoutException e) {
                                e.printStackTrace();
                                return null;
                            } catch (RemoteException re) {
                                re.printStackTrace();
                                --replayCounter;

                            } finally {

                                try {
                                    if (rp != null) {
                                        ServantProviderFactory.getFactory().getServantProvider()
                                                .returnServantProxy(rp);
                                        log.info("<" + Thread.currentThread().getName()
                                                + "> returned resource : " + rp.getServantName());
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }

                            }

                        }

                        return null;

                    }
                });
            } else {
                futures[i][j] = exec.submit(new Callable<Double>() {
                    public Double call() {

                        try {
                            return vecprod(v1, v2);
                        } finally {
                            log.info("<" + Thread.currentThread().getName() + "> Java task ended successfully");
                        }
                    }
                });
            }
        }

    }

    while (true) {
        if (countDone(futures) == (MATRIX_SIZE * MATRIX_SIZE))
            break;
        try {
            Thread.sleep(20);
        } catch (Exception e) {
        }
    }

    log.info(" done --  product matrix -->");

    Double[][] matrix1_x_matrix2 = new Double[MATRIX_SIZE][MATRIX_SIZE];
    for (int i = 0; i < MATRIX_SIZE; ++i)
        for (int j = 0; j < MATRIX_SIZE; ++j)
            matrix1_x_matrix2[i][j] = futures[i][j].get();

    System.out.println(showMatrix(matrix1, "M1"));
    System.out.println(showMatrix(matrix2, "M2"));
    System.out.println(showMatrix(matrix1_x_matrix2, "M1 x M2"));

    System.exit(0);
}

From source file:com.qzgf.datacollection.timer.Yd12580TimerTask.java

public static void main(String[] args) {
    PostalServiceSoapProxy proxy = new PostalServiceSoapProxy();

    ///*  w  w w. ja  v a 2 s.com*/
    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
    Date currentTime = new Date();//?   
    String nowtime = formatter.format(currentTime); //?  
    //?()
    try {
        String username = "12580postal";
        String passwd = "12580postal";
        String parameter = "";//116,-1,178

        System.out.println("say no");

        //
        username = username + nowtime;
        passwd = passwd + nowtime;

        MD5 md5 = new MD5();
        username = md5.StrToMd5(username);
        passwd = md5.StrToMd5(passwd);

        //         try {
        //            MessageDigest md;
        //            md = MessageDigest.getInstance("MD5");
        //            BASE64Encoder base64en = new BASE64Encoder();
        ////            username=new String(md.digest(username.getBytes("UTF-8")),"UTF-8");
        ////            passwd=new String(md.digest(passwd.getBytes("UTF-8")),"UTF-8");
        //            username=new String(base64en.encode(md.digest(username.getBytes())));
        //            passwd=new String(base64en.encode(md.digest(passwd.getBytes())));
        //         } catch (NoSuchAlgorithmException e) {
        //            // TODO Auto-generated catch block
        //            e.printStackTrace();
        ////         }catch (UnsupportedEncodingException e) {
        ////            // TODO Auto-generated catch block
        ////            e.printStackTrace();
        //         }

        System.out.println("hello");
        //661B4842E1F2F64FABFE96DE5B1CDBEF
        //         username="7D5F89392DDD0DD9A2F76C61C4AD61E2";
        //         passwd="7D5F89392DDD0DD9A2F76C61C4AD61E2";
        Postal[] ps = proxy.getList(username, passwd, parameter);//parameter

        if (ps != null) {
            for (int i = 0; i < ps.length; i++) {
                System.out.println("ps[i].getAddress()" + ps[i].getAddress());
                System.out.println("ps[i].getContactor()" + ps[i].getContactor());
                System.out.println("ps[i].getIsFee()" + ps[i].getIsFee());
                System.out.println("ps[i].getOrderID()" + ps[i].getOrderID());
                System.out.println("ps[i].getPhone()" + ps[i].getPhone());
                System.out.println("ps[i].getPrice()" + ps[i].getPrice());
                System.out.println("ps[i].getSpec()" + ps[i].getSpec());
                System.out.println("ps[i].getCity()" + ps[i].getCity());
                System.out.println("ps[i].getPostCode()" + ps[i].getPostCode());
                System.out.println("ps[i].getCounty()" + ps[i].getCounty());
                System.out.println("ps[i].getProvince()" + ps[i].getProvince());

                System.out.println("ps[i].getRecAddress()" + ps[i].getRecAddress());
                System.out.println("ps[i].getRecCity()" + ps[i].getRecCity());
                System.out.println("ps[i].getRecTel()" + ps[i].getRecTel());
                System.out.println("ps[i].getRecProvince()" + ps[i].getRecProvince());
                System.out.println("ps[i].getRecCounty()" + ps[i].getRecCounty());
                System.out.println("ps[i].getRecName()" + ps[i].getRecName());
                System.out.println("\r\n\r\n");
            }
        }
        ///         System.out.println("???"+proxy.postalGetDataBack("1000068,1000081,1000087,1000088,1000089,1000090"));
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:LNISmokeTest.java

/**
 * Execute command line. See Usage string for options and arguments.
 * //from  www .  j a  v a 2  s  . c  o m
 * @param argv the argv
 * 
 * @throws Exception the exception
 */
public static void main(String[] argv) throws Exception {
    Options options = new Options();

    OptionGroup func = new OptionGroup();
    func.addOption(new Option("c", "copy", true, "copy <Item> to -C <Collection>"));
    func.addOption(new Option("s", "submit", true, "submit <collection> -P <packager> -i <file>"));
    func.addOption(new Option("d", "disseminate", true, "disseminate <item> -P <packager> -o <file>"));
    func.addOption(new Option("f", "propfind", true, "propfind of all properties or -N <propname>"));
    func.addOption(new Option("r", "rpropfind", true, "recursive propfind, only collections"));
    func.addOption(new Option("n", "names", true, "list all property names on resource"));
    func.addOption(new Option("p", "proppatch", true, "set property: <handle> -N <property> -V <newvalue>"));
    func.setRequired(true);
    options.addOptionGroup(func);

    options.addOption("h", "help", false, "show help message");
    options.addOption("e", "endpoint", true, "SOAP endpoint URL (REQUIRED)");
    options.addOption("P", "packager", true, "Packager to use to import/export a package.");
    options.addOption("C", "collection", true, "Target collection of -c copy");
    options.addOption("o", "output", true, "file to create for new package");
    options.addOption("i", "input", true, "file containing package to submit");
    options.addOption("N", "name", true, "name of property to query/set");
    options.addOption("V", "value", true, "new value for property being set");

    try {
        CommandLine line = (new PosixParser()).parse(options, argv);
        if (line.hasOption("h")) {
            usage(options, 0, null);
        }

        // get SOAP client connection, using the endpoint URL
        String endpoint = line.getOptionValue("e");
        if (endpoint == null) {
            usage(options, 2, "Missing the required -e endpoint argument");
        }
        LNISoapServletServiceLocator loc = new LNISoapServletServiceLocator();
        LNISoapServlet lni = loc.getDSpaceLNI(new URL(endpoint));

        // propfind - with optional single-property Name
        if (line.hasOption("f")) {
            String pfXml = (line.hasOption("N"))
                    ? specificPropPrefix + line.getOptionValue("N") + specificPropSuffix
                    : allProp;
            doPropfind(lni, line.getOptionValue("f"), pfXml, 0, null);
        }

        // recursive propfind limited to collection, community objects
        else if (line.hasOption("r")) {
            doPropfind(lni, line.getOptionValue("r"), someProp, -1, "collection,community");
        } else if (line.hasOption("n")) {
            doPropfind(lni, line.getOptionValue("n"), nameProp, 0, null);
        } else if (line.hasOption("p")) {
            if (line.hasOption("N") && line.hasOption("V")) {
                doProppatch(lni, line.getOptionValue("p"), line.getOptionValue("N"), line.getOptionValue("V"));
            } else {
                usage(options, 13, "Missing required args: -N <name> -V <value>n");
            }
        }

        // submit a package
        else if (line.hasOption("s")) {
            if (line.hasOption("P") && line.hasOption("i")) {
                doPut(lni, line.getOptionValue("s"), line.getOptionValue("P"), line.getOptionValue("i"),
                        endpoint);
            } else {
                usage(options, 13, "Missing required args after -s: -P <packager> -i <file>");
            }
        }

        // Disseminate (GET) item as package
        else if (line.hasOption("d")) {
            if (line.hasOption("P") && line.hasOption("o")) {
                doGet(lni, line.getOptionValue("d"), line.getOptionValue("P"), line.getOptionValue("o"),
                        endpoint);
            } else {
                usage(options, 13, "Missing required args after -d: -P <packager> -o <file>");
            }
        }

        // copy from src to dst
        else if (line.hasOption("c")) {
            if (line.hasOption("C")) {
                doCopy(lni, line.getOptionValue("c"), line.getOptionValue("C"));
            } else {
                usage(options, 13, "Missing required args after -c: -C <collection>\n");
            }
        } else {
            usage(options, 14, "Missing command option.\n");
        }

    } catch (ParseException pe) {
        usage(options, 1, "Error in arguments: " + pe.toString());

    } catch (java.rmi.RemoteException de) {
        System.out.println("ERROR, got RemoteException, message=" + de.getMessage());

        de.printStackTrace();

        die(1, "  Exception class=" + de.getClass().getName());
    }
}

From source file:is.idega.idegaweb.egov.gumbo.webservice.client.business.DOFWSClientRealWebservice.java

public static void main(String[] arguments) {
    CreateveidileyfiWithPasswordElement parameters = new CreateveidileyfiWithPasswordElement(
            new BigDecimal(2478), "1272", new IWTimestamp("2011-03-12").getCalendar(),
            new IWTimestamp("2011-05-12").getCalendar(), "1392", "idega", "ws4idega");

    try {/*from  www  .  j a  v  a2s .c  o  m*/
        String endPoint = GumboConstants.WEB_SERVICE_URL + "FSWebServiceVeidileyfiUpdateSoap12HttpPort";

        FSWebServiceVeidileyfiUpdate_ServiceLocator locator = new FSWebServiceVeidileyfiUpdate_ServiceLocator();
        FSWebServiceVeidileyfiUpdate_PortType port = locator
                .getFSWebServiceVeidileyfiUpdateSoap12HttpPort(new URL(endPoint));

        CreateveidileyfiWithPasswordResponseElement res = port.createveidileyfiWithPassword(parameters);
        System.out.println(res.getResult());
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:edu.duke.cabig.c3pr.rules.common.RuleUtil.java

public static boolean categoryExist(RuleAuthoringService authService, String path) {
    boolean exist = true;
    Category base_cat = null;//from w w  w .j a va  2  s  .c  o m
    try {
        base_cat = authService.getCategory(path);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    exist = base_cat == null ? false : true;
    if (exist) {
        log.debug("Path:" + base_cat.getPath());
    }
    return exist;
}

From source file:de.ipbhalle.metfusion.main.SubstructureSearch.java

public static void test() {
    String token = "eeca1d0f-4c03-4d81-aa96-328cdccf171a";
    MassSpecAPISoapProxy chemSpiderProxy = new MassSpecAPISoapProxy();
    try {//  w w  w .  j av a  2 s . com
        ExtendedCompoundInfo cpdInfo = chemSpiderProxy.getExtendedCompoundInfo(905, token);
        System.out.println(cpdInfo.getCommonName());
        chemSpiderProxy.searchByMass2(272.04d, 0.001d);
    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    SearchSoapProxy ssp = new SearchSoapProxy();
    SubstructureSearchOptions sso = new SubstructureSearchOptions();
    sso.setMatchTautomers(false);
    //sso.setMolecule("CC(=O)Oc1ccccc1C(=O)O");
    //sso.setMolecule("O=C(\\C1=C(/O)\\C(=C(\\O)C(C1=O)(C\\C=C(/C)C)C\\C=C(/C)C)C\\C=C(/C)C)C(C)C");
    sso.setMolecule("Cc1cccc2nnnc12");

    CommonSearchOptions cso = new CommonSearchOptions();
    cso.setComplexity(EComplexity.Any);
    cso.setIsotopic(EIsotopic.Any); // NotLabeled when using Formula search
    cso.setHasSpectra(false);
    cso.setHasPatents(false);
    String transactionID = "";
    ERequestStatus ers = null;
    try {
        transactionID = ssp.substructureSearch(sso, cso, token);
        System.out.println("transaction id -> " + transactionID);
        ers = ssp.getAsyncSearchStatus(transactionID, token);
        while (ers.equals(ERequestStatus.Processing)) {
            Thread.sleep(2000);
            ers = ssp.getAsyncSearchStatus(transactionID, token);
        }
    } catch (RemoteException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    if (ers.equals(ERequestStatus.Failed)) {
        System.out.println("failed");
        System.exit(-1);
    }

    //String strucAbsent = "CC=C(C)C";
    String strucAbsent = "O=CO"; // O=CO[H]
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IAtomContainer out = null;
    try {
        out = sp.parseSmiles(strucAbsent);
    } catch (InvalidSmilesException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    if (ers.equals(ERequestStatus.ResultReady)) {
        System.out.println("woohoo");
        try {
            int[] CSIDs = ssp.getAsyncSearchResult(transactionID, token);
            ExtendedCompoundInfo[] info = chemSpiderProxy.getExtendedCompoundInfoArray(CSIDs, token);
            System.out.println("# matches -> " + info.length);
            List<IAtomContainer> containersList = new ArrayList<IAtomContainer>();
            for (int i = 0; i < info.length; i++) {
                System.out.println(
                        info[i].getCSID() + "\t" + info[i].getCommonName() + "\t" + info[i].getSMILES());
                IAtomContainer ac = null;
                try {
                    ac = sp.parseSmiles(info[i].getSMILES());
                } catch (InvalidSmilesException ise) {
                    continue;
                }

                containersList.add(ac);
            }
            //            String sdf = chemSpiderProxy.getRecordsSdf(transactionID, token);
            //            InputStream in = IOUtils.toInputStream(sdf);
            //            MDLReader reader = new MDLReader(in);
            //            ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
            //            List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(chemFile);
            System.out.println("# mols -> " + containersList.size());
            SMARTSQueryTool sqt = new SMARTSQueryTool(strucAbsent);

            // filter out container that contain strucAbsent 
            for (IAtomContainer container : containersList) {

                // MCSS search
                List<IAtomContainer> mcsslist = UniversalIsomorphismTester.getOverlaps(container, out);
                int maxmcss = -9999999;
                IAtomContainer maxac = null;
                for (int j = 0; j < mcsslist.size(); j++) {
                    IAtomContainer a = (IAtomContainer) mcsslist.get(j);
                    if (a.getAtomCount() > maxmcss) { // TODO: leave out candidates that match the substructure !!!
                        maxmcss = a.getAtomCount();
                        maxac = a;
                    }

                    if (a.getAtomCount() == out.getAtomCount()) { // matching number of atoms between MCSS and structure to leave out
                        System.out.println("#atoms in MCSS matches substrucAbsent -> filter out");
                        break;
                    }
                }
                System.out.println("maxac -> " + maxac.getAtomCount());

                // SMARTS matching
                boolean matches = sqt.matches(container); // , true
                if (matches) { // leave out container
                    System.out.println("matches");
                    int nmatch = sqt.countMatches();
                    List<List<Integer>> mappings = sqt.getMatchingAtoms();
                    for (int i = 0; i < nmatch; i++) {
                        List<Integer> atomIndices = mappings.get(i);
                        System.out.println("#atom indices -> " + atomIndices.size());
                    }
                } else { // keep container
                    System.out.println("no match");
                }
            }

        } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (CDKException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else
        System.out.println("oh no");
}

From source file:com.nokia.tools.variant.carbidev.CarbideRCPHandler.java

private void handleOpenedCarbide(List<?> list) {
    String[] nonFrameworkArgs = (String[]) list.toArray(new String[list.size()]);
    if (nonFrameworkArgs.length > 0) {
        for (String arg : nonFrameworkArgs) {
            if (arg.toLowerCase().endsWith(".cpf")) {
                ICarbideVRemote remoteCarbideV = CarbideVRemote.getRemote();
                if (remoteCarbideV != null) {
                    try {
                        remoteCarbideV.openCpf(arg);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }/* w  w w  . j  a v  a  2  s  .  c  o  m*/
                }
            }
        }
    }
}

From source file:com.idega.block.rss.business.RSSAbstractProducer.java

/**
 * /*w  w  w . ja  va 2s . c om*/
 * @param URI
 * @return true if the uri points to a folder in slide or false if it does not or the user has no access priviledges to it
 */
public boolean isAFolderInSlide(String URI, RSSRequest rssRequest) {

    try {
        return getIWSlideSession(rssRequest).isFolder(URI);
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    return false;
}