2

我刚刚安装了最新版本的 Netbeans ( 7.2 ) 并尝试在其中运行现有的 Swing 项目。我得到以下异常:

堆栈跟踪:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file com/eositservices/eldorado/dialogs/zahlungverrechnung/model/InitDataList
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    at java.lang.Class.getDeclaredMethod(Class.java:1935)
    at java.awt.Component.isCoalesceEventsOverriden(Component.java:5975)
    at java.awt.Component.access$500(Component.java:169)
    at java.awt.Component$3.run(Component.java:5929)
    at java.awt.Component$3.run(Component.java:5927)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Component.checkCoalescing(Component.java:5926)
    at java.awt.Component.<init>(Component.java:5895)
    at java.awt.Container.<init>(Container.java:249)
    at javax.swing.JComponent.<init>(JComponent.java:570)
    at javax.swing.JPanel.<init>(JPanel.java:65)
    at javax.swing.JPanel.<init>(JPanel.java:92)
    at javax.swing.JPanel.<init>(JPanel.java:100)
    at com.eositservices.eldorado.masken.FormForderung.<init>(FormForderung.java:72)
    at com.eositservices.eldorado.tabsheets.zahlung.TSZahlung.<init>(TSZahlung.java:183)
    at com.eositservices.eldorado.masken.TFormForderung.addTabs(TFormForderung.java:366)
    at com.eositservices.eldorado.masken.TFormForderung.initializeComponents(TFormForderung.java:275)
    at com.eositservices.eldorado.masken.TFormForderung.configureComponents(TFormForderung.java:148)
    at com.eositservices.bones.view.components.EOSInternalFrame.setUp(EOSInternalFrame.java:81)
    at com.eositservices.eldorado.masken.TFormForderung.<init>(TFormForderung.java:113)
    at com.eositservices.eldorado.main.MainFrame.oeffneForderung(MainFrame.java:577)
    at com.eositservices.eldorado.main.MainFrame.showForderung(MainFrame.java:488)
    at com.eositservices.eldorado.dev.QuickLogin.openForderung(QuickLogin.java:109)
    at com.eositservices.eldorado.dev.QuickLogin.openInitialViews(QuickLogin.java:143)
    at com.eositservices.eldorado.main.MainFrame$2.run(MainFrame.java:433)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:646)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:607)
    at java.awt.EventQueue$1.run(EventQueue.java:605)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
    at com.eositservices.bones.view.GlobalHotkeyManager.dispatchEvent(GlobalHotkeyManager.java:163)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

有问题的方法如下所示:

@Override
public boolean add( InitData e ) {
    boolean returnValue = super.add( e );
     Collections.sort( this, c );
    return returnValue;
}

奇怪的是,只有当我将项目属性设置为“保存时编译”时才会出现异常。当该选项未选中时,它运行良好。在以前的 NetBeans 版本中我们没有遇到这样的问题。这只是一个巧合,我应该在其他地方寻找这个错误的来源还是有人遇到过类似的问题?在此先感谢您的帮助。

4

1 回答 1

4

这似乎是NetBeans中的一个错误。

当这个异常发生时,让我们在代码中出错(例如

@Override
**efefefefef**
public boolean add( InitData e ) {
    boolean returnValue = super.add( e );
     Collections.sort( this, c );
    return returnValue;
}

)

保存它,当 Netbeans 显示错误时,将其更正回来。我试图清除项目,从缓存中删除所有内容,但什么也没发生。但这种方式对我有帮助。

于 2012-10-16T05:37:20.080 回答