Example usage for java.lang Throwable printStackTrace

List of usage examples for java.lang Throwable printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:TestDB.java

 public static void main(String args[])
{
   try/*from w w  w .j av  a2s.com*/
   {
      runTest();
   }
   catch (SQLException ex)
   {
      for (Throwable t : ex)
         t.printStackTrace();
   }
   catch (IOException ex)
   {
      ex.printStackTrace();
   }
}

From source file:com.hotinno.feedmonitor.batch.Main.java

public static void main(String[] args) throws Throwable {
    try {/* w w  w. jav a2 s . c  o m*/
        log.error("Entering batch...");

        String env = System.getenv("VCAP_SERVICES");
        log.error("************************************************************************");
        log.error("VCAP_SERVICES is: " + env);
        log.error("************************************************************************");

        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
                BuffaloBatchConfiguration.class);

        org.apache.commons.dbcp.BasicDataSource ds = (org.apache.commons.dbcp.BasicDataSource) applicationContext
                .getBean("myDataSource");

        log.error(String.format("URL: %s", ds.getUrl()));
        log.error(String.format("Username: %s", ds.getUsername()));
        log.error(String.format("Password: %s", ds.getPassword()));

        applicationContext.start();

        log.error("Running...");
    } catch (Throwable t) {
        System.err.println(t);
        t.printStackTrace();
        log.error("Error occurred.", t);
    }
}

From source file:AIR.Common.Utilities.Path.java

public static void main(String[] arhs) {
    try {//w  ww.  j  a va2  s .c om
        String folder = "C:/WorkSpace/Student-Geo-SBACOSS/ItemPreview/TDS.ItemPreview.Web";
        for (File file : Path.getFilesMatchingExtensions(folder, new String[] { ".xml" })) {
            System.err.println(file.getAbsolutePath());
        }
    } catch (Throwable exp) {
        exp.printStackTrace();
    }
}

From source file:locking.LockingExample.java

public static void main(String[] args) throws Exception {
    // all of the useful sample code is in ExampleClientThatLocks.java

    // FakeLimitedResource simulates some external resource that can only be access by one process at a time
    final FakeLimitedResource resource = new FakeLimitedResource();

    ExecutorService service = Executors.newFixedThreadPool(QTY);
    final TestingServer server = new TestingServer();
    try {// w w  w . ja  v  a  2  s.  co  m
        for (int i = 0; i < QTY; ++i) {
            final int index = i;
            Callable<Void> task = new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
                            new ExponentialBackoffRetry(1000, 3));
                    try {
                        client.start();

                        ExampleClientThatLocks example = new ExampleClientThatLocks(client, PATH, resource,
                                "Client " + index);
                        for (int j = 0; j < REPETITIONS; ++j) {
                            example.doWork(10, TimeUnit.SECONDS);
                        }
                    } catch (Throwable e) {
                        e.printStackTrace();
                    } finally {
                        IOUtils.closeQuietly(client);
                    }
                    return null;
                }
            };
            service.submit(task);
        }

        service.shutdown();
        service.awaitTermination(10, TimeUnit.MINUTES);
    } finally {
        IOUtils.closeQuietly(server);
    }
}

From source file:caarray.client.test.full.FullTest.java

/**
 * @param args//from ww w.  j  av  a 2 s .co m
 */
public static void main(String[] args) {
    TestMain test = new TestMain();
    try {
        test.runTests(new FullApiFacade());
    } catch (Throwable t) {
        System.out.println("An unexpected error occurred during test execution.");
        t.printStackTrace();
        log.error("Exception encountered:", t);
    }

}

From source file:io.paradoxical.francois.ServiceApplication.java

public static void main(String[] args) throws Exception {
    DateTimeZone.setDefault(DateTimeZone.UTC);

    ServiceApplication serviceApplication = new ServiceApplication(new GuiceBundleProvider());

    try {//w w  w  . ja v a2s  . c o  m
        serviceApplication.run(args);
    } catch (Throwable ex) {
        ex.printStackTrace();

        System.exit(1);
    }
}

From source file:caarray.client.test.java.JavaTest.java

/**
 * @param args//from www .ja  va 2s .  c o m
 */
public static void main(String[] args) {
    TestMain test = new TestMain();
    try {
        System.setProperty(TestProperties.API_KEY, TestProperties.API_JAVA);
        test.runTests(new JavaApiFacade());
    } catch (Throwable t) {
        System.out.println("An unexpected error occurred during test execution.");
        t.printStackTrace();
        log.error("Exception encountered:", t);
    }
}

From source file:caarray.client.test.grid.GridTest.java

/**
 * @param args//w w  w .j a  v a2s  . c  o  m
 */
public static void main(String[] args) {
    TestMain test = new TestMain();
    try {
        System.setProperty(TestProperties.API_KEY, TestProperties.API_GRID);
        test.runTests(new GridApiFacade());
    } catch (Throwable t) {
        System.out.println("An unexpected error occurred during test execution.");
        t.printStackTrace();
        log.error("Exception encountered:", t);
    }

}

From source file:com.bc.fiduceo.ingest.IngestionToolMain.java

public static void main(String[] args) throws ParseException, IOException, SQLException {
    final IngestionTool ingestionTool = new IngestionTool();

    if (args.length == 0) {
        ingestionTool.printUsageTo(System.err);
        return;//from  w  w w  . j av  a  2 s . c  o m
    }

    final CommandLineParser parser = new PosixParser();
    final CommandLine commandLine = parser.parse(IngestionTool.getOptions(), args);
    if (commandLine.hasOption("h") || commandLine.hasOption("--help")) {
        ingestionTool.printUsageTo(System.out);
        return;
    }

    try {
        ingestionTool.run(commandLine);
    } catch (Throwable e) {
        FiduceoLogger.getLogger().severe(e.getMessage());
        e.printStackTrace();
        System.exit(-1);
    }
}

From source file:com.bc.fiduceo.matchup.MatchupToolMain.java

public static void main(String[] args) throws ParseException, IOException, SQLException, InvalidRangeException {
    final MatchupTool matchupTool = new MatchupTool();

    if (args.length == 0) {
        matchupTool.printUsageTo(System.err);
        return;/*w w w.j  a  va2  s.com*/
    }

    final CommandLineParser parser = new PosixParser();
    final CommandLine commandLine = parser.parse(MatchupTool.getOptions(), args);
    if (commandLine.hasOption("h") || commandLine.hasOption("--help")) {
        matchupTool.printUsageTo(System.err);
        return;
    }

    try {
        matchupTool.run(commandLine);
    } catch (Throwable e) {
        FiduceoLogger.getLogger().severe(e.getMessage());
        e.printStackTrace();
        System.exit(-1);
    }
}