2016-02-08 37 views
0

Java應用程序終止,出現異常:如何在不更改代碼的情況下從編譯的jar中檢索完整的異常消息?

liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException 
     at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211) 
     at liquibase.integration.commandline.Main.doMigration(Main.java:967) 
     at liquibase.integration.commandline.Main.run(Main.java:180) 
     at liquibase.integration.commandline.Main.main(Main.java:99) 
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException 
     at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13) 
     at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209) 
     ... 3 more 
Caused by: liquibase.exception.DatabaseException: java.lang.NumberFormatException 
     at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:120) 
     at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:73) 
     at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) 
     at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:194) 
     at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:292) 
     at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:314) 
     at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:234) 
     at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:208) 
     at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70) 
     at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:44) 
     at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21) 
     at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150) 
     at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139) 
     at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:190) 
     at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:140) 
     at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:51) 
     at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8) 
     ... 4 more 
Caused by: java.lang.NumberFormatException 
     at java.math.BigDecimal.<init>(Unknown Source) 
     at java.math.BigDecimal.<init>(Unknown Source) 
     at java.math.BigDecimal.<init>(Unknown Source) 
     at liquibase.util.SqlUtil.parseValue(SqlUtil.java:208) 
     at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(ColumnSnapshotGenerator.java:387) 
     at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:223) 
     at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:115) 
     ... 20 more 

我現在NumberFormatException的應該包含「對於輸入字符串」文本。我能做些什麼來查看該異常的消息文本?

不從代碼,這是運行與bat文件這樣的編譯的Jar應用:

java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS% 
+0

你用什麼java運行時來運行你的應用程序? – SpaceTrucker

+0

相關問題(如果你自己控制代碼,該怎麼做):http://stackoverflow.com/questions/1791610/java-find-the-first-cause-of-an-exception –

+0

@SpaceTrucker Java(TM) SE運行時環境(build 1.8.0_66-b18) – Vlad

回答

2
Caused by: java.lang.NumberFormatException 

...

我現在NumberFormatException的應該包含「對於輸入字符串「文本。我能做些什麼來查看該異常的消息文本?

可能沒有留言供您查看。如果NumberFormatException有詳細消息,它將成爲堆棧跟蹤的一部分。 Here is the javadoc for NumberFormatException。你會注意到,不能保證例外會有詳細的信息。實際上,它有a no-argument constructor,它被記錄爲構造「沒有詳細消息的NumberFormatException」。

此外,here is the main constructor用於BigDecimal類的OpenJDK實現。如果你仔細觀察它,你會發現它在幾個地方拋出了沒有詳細信息的NumberFormatExceptions。

相關問題