被禁止的Java异常堆栈 - 如何打印出整个堆栈?

时间:2011-12-27 20:57:12

标签: java ant

n:我收到了以下Java异常堆栈。正如您所看到的那样,堆栈被抑制(请注意下面的Java中的“... 5 more”指示符。)

java程序作为Ant任务启动。有谁知道如何让Java或Ant打印出整个错误堆栈?

 [java] javax.jms.JMSException: Failed to create session factory
 [java]       at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:615)
 [java]       at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:121)
 [java]       at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)
 [java]       at org.hornetq.jms.example.QueueExample.runExample(QueueExample.java:56)
 [java]       at org.hornetq.common.example.HornetQExample.run(HornetQExample.java:76)
 [java]       at org.hornetq.jms.example.QueueExample.main(QueueExample.java:35)
 [java] Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
 [java]       at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:619)
 [java]       at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:611)
 [java]       ... 5 more
 [java]
 [java] #####################
 [java] ###    FAILURE!   ###
 [java] #####################
 [java] Java Result: 1

1 个答案:

答案 0 :(得分:1)

您无需查看整个堆栈。 ... 5表示以下5 StackTraceElement是包装器异常的最后5个元素(在您的情况下:javax.jms.JMSException)。有关更多信息,请访问Javadoc上的printStacktrace()方法,它包含您在堆栈跟踪中看到的非常详细的示例