Example usage for java.lang Exception printStackTrace

List of usage examples for java.lang Exception printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.dianping.dpsf.other.echo.SimpleEchoClient.java

/**
 * @param args/*from   w w  w. j av a 2s . c om*/
 * @throws Exception 
 */
public static void main(String[] args) throws Exception {

    ConfigCache.getInstance("192.168.7.41:2182");
    ApplicationContext ctx = new ClassPathXmlApplicationContext("echo-client.xml");
    IEcho s = (IEcho) ctx.getBean("echo");

    while (true) {
        try {
            System.out.println(s.echo("aa"));
            Thread.sleep(500);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

From source file:org.wso2.carbon.tfl.realtime.TflStream.java

public static void main(String[] args) throws XMLStreamException {
    try {/*  w w w . j a v a  2 s .  c  o  m*/
        Update update = new Update(System.currentTimeMillis(), 1000, endPointBus);
        GetData busData = new GetData();
        busData.start();
        log.info("started collecting data");
        Thread.sleep(30000);
        update.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:test.gov.nih.nci.system.web.client.ComputerClient.java

public static void main(String[] args) {
    try {//from w w  w .j  a va2 s  .  c  om
        Computer computer = new Computer();
        computer.setType("DellPC");

        if (args == null || args.length != 1) {
            System.out.println("Usage: RESTFulReadClient <RESTful resource URL>");
            return;
        }
        String url = args[0];

        File myFile = marshall(computer);
        RESTfulCreateClient client = new RESTfulCreateClient();
        client.create(myFile, url);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.anhth12.models.featuredetectors.rbm.run.App.java

public static void main(String[] args) {
    try {// w  w  w  .j  av  a2s. c  o m
        String path = "D:\\1.Source\\LogisticRegression\\src\\resources\\mnist_784_1000.txt";
        FilleDatsetIterator dsi = new FilleDatsetIterator(path);
        DataSet d = dsi.next();
        RandomGenerator rng = new MersenneTwister(123);

        NeuralNetworkConfiguration conf = new NeuralNetworkConfiguration();
        conf.setWeightInit(WeightInit.VI);
        conf.setDropOut(0.3f);
        conf.setHiddenUnit(RBM.HiddenUnit.SOFTMAX);
        conf.setVisibleUnit(RBM.VisibleUnit.SOFTMAX);
        conf.setLossFunction(LossFunctions.LossFunction.RECONSTRUCTION_CROSSENTROPY);
        conf.setRng(rng);
        conf.setnIn(d.numInputs());
        conf.setnOut(d.numOutcomes());
        conf.setNumIterations(10);
        conf.setActivationFunction(new Sigmoid());

        LayerFactory rbmFactory = LayerFactories.getLayerFactory(RBM.class);
        RBM rbm = rbmFactory.create(conf);
        //            RBM rbm = new RBM(conf);
        rbm.fit(d.getFeatureMatrix());

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:TableCellFormatNoBorderPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4, 50, 50, 50, 50);
    try {/*from   w w w . j av a2  s.c  om*/
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("TableCellFormatNoBorderPDF.pdf"));
        document.open();

        PdfPTable table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.getDefaultCell().setFixedHeight(70);
        table.addCell("!");
        table.addCell("Text Text Text Text Text Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text Text Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text \nText \nText ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        table.addCell("Text ");
        table.addCell(new Phrase(new Chunk("cell")));
        document.add(table);

    } catch (Exception de) {
        de.printStackTrace();
    }
    document.close();
}

From source file:DemoUpdatableResultSet.java

public static void main(String[] args) {
    ResultSet rs = null;//ww w  .  j  ava  2 s .  c  om
    Connection conn = null;
    PreparedStatement pstmt = null;
    try {
        conn = getConnection();
        String query = "select id, name, age from employees where age > ?";
        pstmt = conn.prepareStatement(query, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
        pstmt.setInt(1, 20); // set input values
        rs = pstmt.executeQuery(); // create an updatable ResultSet
                                   // update a column value in the current row.
        rs.absolute(2); // moves the cursor to the 2nd row of rs
        rs.updateString("name", "newName"); // updates the 'name' column of row 2 to newName
        rs.updateRow(); // updates the row in the data source
                        // insert column values into the insert row.
        rs.moveToInsertRow(); // moves cursor to the insert row
        rs.updateInt(1, 1234); // 1st column id=1234
        rs.updateString(2, "newName"); // updates the 2nd column
        rs.updateInt(3, 99); // updates the 3rd column to 99
        rs.insertRow();
        rs.moveToCurrentRow();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            rs.close();
            pstmt.close();
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getMySQLConnection();
    Statement stmt = null;// w w  w . ja va 2 s  .  c om
    try {
        stmt = conn.createStatement();
        stmt.executeUpdate("DELETE FROM Mytable");
        displayError(stmt.getWarnings());
        stmt.executeUpdate(
                "INSERT INTO Mytable(id, name)" + "VALUES(1, 'NameLongerThanColumnLengthInDatabase')");
        displayError(stmt.getWarnings());
    } catch (DataTruncation dt) {
        displayError(dt);
        dt.printStackTrace();
    } catch (SQLException se) {
        System.out.println("Database error message: " + se.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        stmt.close();
        conn.close();
    }
}

From source file:ChapterSectionAlignmentPDF.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A4, 50, 50, 50, 50);
    try {/* ww  w  . j a  va2s  .c  o  m*/
        PdfWriter writer = PdfWriter.getInstance(document,
                new FileOutputStream("ChapterSectionAlignmentPDF.pdf"));
        writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
        document.open();
        Font chapterFont = FontFactory.getFont(FontFactory.HELVETICA, 24, Font.NORMAL, new Color(255, 0, 0));
        Font sectionFont = FontFactory.getFont(FontFactory.HELVETICA, 20, Font.NORMAL, new Color(0, 0, 255));
        Font subsectionFont = FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64));

        Paragraph paragraph1 = new Paragraph("text 1");
        Paragraph paragraph2 = new Paragraph("text 2");

        Paragraph cTitle = new Paragraph("This is a chapter ", chapterFont);
        Chapter chapter = new Chapter(cTitle, 1);

        paragraph2.setAlignment(Element.ALIGN_CENTER);
        paragraph1.setAlignment(Element.ALIGN_RIGHT);
        chapter.add(paragraph1);

        Paragraph sTitle = new Paragraph("This is section 1 in chapter 1", sectionFont);
        Section section = chapter.addSection(sTitle, 1);
        section.add(paragraph1);

        Paragraph subTitle = new Paragraph("This is subsection 1 of section 1", subsectionFont);
        Section subsection = section.addSection(subTitle, 3);

        document.add(chapter);
    } catch (Exception de) {
        de.printStackTrace();
    }
    document.close();
}

From source file:Main.java

public static void main(String args[]) {
    try {//w w w .ja  v  a  2  s . c  o  m
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getMinimum());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String args[]) {
    try {// w  w  w . j  a v a 2 s.  co  m
        DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
        ChangeListener myListener = new MyChangeListener();
        model.addChangeListener(myListener);

        System.out.println(model.toString());
        System.out.println("Now setting minimum to 50 . . .");
        model.setMinimum(50);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 40 . . .");
        model.setMaximum(40);
        System.out.println(model.toString());
        System.out.println("Now setting maximum to 50 . . .");
        model.setMaximum(50);
        System.out.println(model.toString());
        System.out.println("Now setting extent to 30 . . .");
        model.setExtent(30);
        System.out.println(model.toString());

        System.out.println(model.getMaximum());

        System.out.println("Now setting several properties . . .");
        if (!model.getValueIsAdjusting()) {
            model.setValueIsAdjusting(true);
            System.out.println(model.toString());
            model.setMinimum(0);
            model.setMaximum(100);
            model.setExtent(20);
            model.setValueIsAdjusting(false);
        }
        System.out.println(model.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
}