我做了一个cs结构的聊天程序,用了swing,hibernate。可是有时候会出现会出现下列异常,它也没说我程序的哪行出错,
我该怎么找错误啊。什么原因可能导致不报异常位置。
哪位仁兄帮帮忙,都困扰我好几天了。
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1140)
at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:152)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:763)
at javax.swing.JComponent.paint(JComponent.java:1027)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
------解决方案--------------------
怎么会不报异常位置呢?
难道……
------解决方案--------------------
空指针异常,看看那个对象没有被初始化,如果用Netbeans或Eclipse根据输出提示找错误所在行
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
括号里都可以点进去啊 基本是在paint方法中碰到的空指针 再看看吧
------解决方案--------------------
java.lang.NullPointerException
为空指针,Exception
看下你new 没有呀,
没有出错的位置 ,就跟到程序走一次,
每一个地方都System.out.println()下,
慢慢来,总找的出来的,
------解决方案--------------------
估计楼主没解决呢
我也碰到啦。。也是cs的程序连接数据库
最开始报
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
我发现是那个数据库服务器的防火墙关啦后再连就报这个
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
还没解决正在找答案!
------解决方案--------------------
此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【bill_hai】截止到2008-06-28 09:58:56的历史汇总数据(不包括此帖):
发帖数:11 发帖分:200
结贴数:4 结贴分:80
未结数:7 未结分:120
结贴率:36.36 % 结分率:40.00 %
楼主该结一些帖子了
------解决方案--------------------
LZ是不是调用了updateUI()来刷新啊,
------解决方案--------------------