java异常堆栈中的Unknown source

本文探讨了使用Ant工具编译Java程序时调试信息缺失的问题。详细解释了Ant默认编译选项导致的行号信息丢失,并给出了配置示例来解决这一问题。

  最近做完一个项目的Demo版本,将应用程序deploy到服务器上。运行一段时间后,把相关的日志从服务器load下来,发现异常堆栈信息里,没有相应的代码行号。只显示Unknown source.这对我们定位问题相当麻烦。

  应用程序是用ant编译的,于是股沟了一下,发是用ant编译Java程序与javac编译是有些差别的。当通过javac编译时,默认相当于指定-g:source,lines,这样编译出来的class文件中会包含源代码和行号信息;而通过ant编译时,默认相当于指定-g:none,这样编译出来的class文件会比较小,但是不包含任何调试信息,所以出错的时候就不会带行号等信息。

  所以用ant编译时,加上debug="true" debuglevel="source,lines,vars"就可以了,示例如下:

  

1 <javac destdir="${build.classes}" srcdir="${src.java}"classpathref="lib.classpath" encoding="utf-8" debug="true" debuglevel="source,lines,vars"/>  

 

 

转载于:https://www.cnblogs.com/51cto/archive/2010/06/29/1767605.html

#-------------------------------------------------------------------------- # Xilinx Vivado v2019.2 (64-bit) # SW Build: 2700185 on Thu Oct 24 18:46:05 MDT 2019 # IP Build: 2699827 on Thu Oct 24 21:16:38 MDT 2019 # Current time: Wed Aug 20 16:27:09 CST 2025 # Process ID (PID): 9040 # User: jianbin.zhan # OS: Windows 10 # # This report is an indication that an internal application error occurred. # This information is useful for debugging. Please open a case with Xilinx. # Technical Support with this file and a testcase attached. #-------------------------------------------------------------------------- ui.utils.e: ui.frmwork.CommandFailedException: unknown escape sequence ui.frmwork.CommandFailedException: unknown escape sequence at ui.data.labtools.lthwdatai.HWDevice_getHWCfgMem(Native Method) at ui.data.labtools.d.bhs(SourceFile:229) at ui.data.labtools.j.ff(SourceFile:241) at ui.views.c.o.f.a.ej(SourceFile:46) at ui.views.c.o.f.d.l(SourceFile:31) at ui.views.S.b.k.P(SourceFile:394) at ui.views.S.b.d.getTreeCellRendererComponent(SourceFile:153) at ui.views.S.b.h.getTreeCellRendererComponent(SourceFile:54) at org.jdesktop.swingx.JXTree$DelegatingRenderer.getTreeCellRendererComponent(JXTree.java:1243) at java.desktop/javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(Unknown Source) at java.desktop/javax.swing.tree.AbstractLayoutCache.getNodeDimensions(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.setExpandedState(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTreeUI$Handler.treeExpanded(Unknown Source) at java.desktop/javax.swing.JTree.fireTreeExpanded(Unknown Source) at java.desktop/javax.swing.JTree.setExpandedState(Unknown Source) at java.desktop/javax.swing.JTree.expandPath(Unknown Source) at ui.utils.p.x.L.aY(SourceFile:134) at ui.utils.p.x.L.cUl(SourceFile:101) at ui.views.S.b.s.update(SourceFile:672) at ui.views.S.b.D.update(SourceFile:78) at ui.views.S.u.gSr(SourceFile:2580) at ui.bo.fB(SourceFile:1968) at ui.bo.cR(SourceFile:1936) at ui.utils.o.ahG(SourceFile:2714) at ui.b.c.bB.cs(SourceFile:514) at ui.b.c.bK.finished(SourceFile:1174) at ui.frmwork.z.run(SourceFile:190) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$2.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.WaitDispatchSupport.enter(Unknown Source) at java.desktop/java.awt.Dialog.show(Unknown Source) at java.desktop/java.awt.Component.show(Unknown Source) at java.desktop/java.awt.Component.setVisible(Unknown Source) at java.desktop/java.awt.Window.setVisible(Unknown Source) at java.desktop/java.awt.Dialog.setVisible(Unknown Source) at ui.b.c.g.setVisible(SourceFile:919) at ui.b.c.bB.showDialog(SourceFile:978) at ui.b.c.bI.fQ(SourceFile:1123) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) at ui.utils.d.c.f(SourceFile:845) at ui.utils.d.c.e(SourceFile:190) at ui.utils.o.e(SourceFile:213) at ui.frmwork.b.d.dispatchEvent(SourceFile:95) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$2.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.WaitDispatchSupport.enter(Unknown Source) at java.desktop/java.awt.Dialog.show(Unknown Source) at java.desktop/java.awt.Component.show(Unknown Source) at java.desktop/java.awt.Component.setVisible(Unknown Source) at java.desktop/java.awt.Window.setVisible(Unknown Source) at java.desktop/java.awt.Dialog.setVisible(Unknown Source) at ui.b.c.g.setVisible(SourceFile:919) at ui.b.c.bB.showDialog(SourceFile:978) at ui.b.c.bI.fQ(SourceFile:1123) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
最新发布
08-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值