facebook

Matisse Palette widget (ClassNotFoundException)

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #257387 Reply

    jbarde
    Member

    I’ve installed Matisse on MyEclipse 5.0.

    Yesterday, I tried out using widgets and dragging them onto an applet form. Worked fine.
    Stubbed out some events. Still worked fine (although I had to restart the workbench for the palette widget to be updated with the newest version of said widget).

    Today, I took the same widgets, added a Log4j Log object, and put log.debug calls in the event methods, e.g.:

    
    package com.foo.ui;
    
    import org.apache.commons.logging.*;
    
    public class EnvironmentSettings extends javax.swing.JPanel implements java.awt.event.ItemListener {
    
        private static final long serialVersionUID = 4890948659027798007L;
    
        private static Log log = LogFactory.getLog(EnvironmentSettings.class);
        
        /** Creates new form EnvironmentSettings */
        public EnvironmentSettings() {
            initComponents();
        }
    
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
        private void initComponents() {
            jComboBoxAudio.setBackground(new java.awt.Color(255, 255, 255));
            jComboBoxAudio.setFont(new java.awt.Font("Arial", 1, 12));
            jComboBoxAudio.setText("Play Audio");
            jComboBoxAudio.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
                    0, 0, 0));
            jComboBoxAudio.setMargin(new java.awt.Insets(0, 0, 0, 0));
            jComboBoxAudio.addItemListener(this);
    
            // layout and placement code ... removed for brevity.
        }
    
        // Code for dispatching events from components to event handlers.
    
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            if(evt.getSource() == jComboBoxAudio) {
                EnvironmentSettings.this.jComboBoxAudioItemStateChanged(evt);
            }
        }// </editor-fold>//GEN-END:initComponents
    
        private void jComboBoxAudioItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxAudioItemStateChanged
            log.debug(evt.getSource() + ":" + evt.getClass());
        }//GEN-LAST:event_jComboBoxAudioItemStateChanged
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JCheckBox jComboBoxAudio;
    
        // End of variables declaration//GEN-END:variables
    }
    

    Now, when I try to add this new widget to an applet form, this error comes up. I tried a workbench restart, no dice.

    Cannot load component class com.foo.ui.EnvironmentSettings from unknown source.
    The class must be compiled and must be on the classpath of the project this form belongs to.

    Log4j instances workfine in other non-form classes (it’s in the classpath of the project). And once I remove the references to log4j, everything is fine again.

    Is this perhaps a bug? If further info is required please let me know. I’m used to having my logger, but I can do without for now. Just thought this might be of interest for you folks.

    Regards.

    Here’s the workbench logfile:

    
    !ENTRY org.eclipse.wst.internet.cache 1 0 2006-08-22 11:21:09.187
    !MESSAGE wtp.autotest.noninteractive is set. Licenses dialogs will not be displayed.
    !SESSION 2006-08-22 11:23:38.296 -----------------------------------------------
    eclipse.buildId=M20060629-1905
    java.version=1.5.0_07
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    Framework arguments:  -product com.genuitec.myeclipse.product.ide
    Command-line arguments:  -os win32 -ws win32 -arch x86 -product com.genuitec.myeclipse.product.ide
    
    !ENTRY com.genuitec.eclipse.dehory 4 4 2006-08-22 11:24:43.890
    !MESSAGE com.foo.ui.EnvironmentSettings
    !STACK 0
    java.lang.ClassNotFoundException: com.foo.ui.EnvironmentSettings
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:407)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:352)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:276)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1245)
        at org.netbeans.modules.form.palette.PaletteItem.getComponentClass(PaletteItem.java:139)
        at org.netbeans.modules.form.HandleLayer$NewComponentDrag.init(HandleLayer.java:2520)
        at org.netbeans.modules.form.HandleLayer$NewComponentDrag.<init>(HandleLayer.java:2466)
        at org.netbeans.modules.form.HandleLayer.mouseMoved(HandleLayer.java:1612)
        at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:271)
        at java.awt.Component.processMouseMotionEvent(Component.java:5533)
        at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3144)
        at java.awt.Component.processEvent(Component.java:5257)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3905)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1774)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    
    #257484 Reply

    Riyad Kalla
    Member

    Very interesting, this does sound like a bug. Can you create a small Java project with this form in it with the logging enabled and send it to us so I can reproduce the problem and comment out the log and reproduce that it works then, and then attach thtat to a bug report internally?

    support@genuitec.com ATTN Riyad

    #257628 Reply

    jbarde
    Member

    One more thing…

    I also found that if a widget or a member object of said widget uses a properties files, if the properties is non-locale specific, it tacks on en_US.

    For examle, I had a widget that connected to a database using other objects and static calls to populate comboboxen and other widget components. The class that I used to issue database commands references a properties file (com.foo.myproject.ApplicationResources).

    If I commented the widget’s populateComponents() method, I am able to use it and drag it on to other forms, no problem.
    However, if left uncommented (thus the components would be populated by these database calls) and attempted to drag it on to another form, I would get the error below, but if I created the applet manually in lieu of Matisse, I can compile and run the applet without a hitch.

    I’m new to GUI programming, so perhaps I am calling populateComponents() at the wrong time, (currently in the widget’s constructor)…

    I’ll try to supply example code in the near future, currently I’m pressed for time.

    NOTE: Property file com.foo.myproject.ApplicationResources exists, com.foo.myproject.ApplicationResources_en_US does not.

    The component cannot be instantiated. Please make sure it is a JavaBean.

    details:

    
    Annotation: The component cannot be instantiated. Please make sure it is a JavaBean.
    Annotation: Missing resource from class: com.foo.myproject.ApplicationResources_en_US
    Annotation: Key which was not found: 
    java.util.MissingResourceException: Can't find bundle for base name com.foo.myproject.ApplicationResources, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:549)
        at com.foo.myproject.model.util.PropertyUtil.loadParams(PropertyUtil.java:22)
        at com.foo.myproject.model.database.DatabaseConnection.createConnection(DatabaseConnection.java:56)
        at com.foo.myproject.model.database.DatabaseConnection.getConnection(DatabaseConnection.java:217)
        at com.foo.myproject.model.database.DbExecute.executeQuery(DbExecute.java:87)
        at com.foo.myproject.model.data.access.FinishTypeDb.getFinishTypes(FinishTypeDb.java:23)
        at com.foo.myproject.model.module.FinishTypeModule.getFinishTypes(FinishTypeModule.java:32)
        at com.foo.myproject.applet.panels.LessonSettings.populateControls(LessonSettings.java:1005)
        at com.foo.myproject.applet.panels.LessonSettings.<init>(LessonSettings.java:35)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:130)
        at org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:193)
        at org.netbeans.modules.form.RADComponent.initInstance(RADComponent.java:137)
        at org.netbeans.modules.form.MetaComponentCreator.initComponentInstance(MetaComponentCreator.java:1258)
        at org.netbeans.modules.form.MetaComponentCreator.createVisualComponent(MetaComponentCreator.java:757)
        at org.netbeans.modules.form.MetaComponentCreator.access$1(MetaComponentCreator.java:746)
        at org.netbeans.modules.form.MetaComponentCreator$2.run(MetaComponentCreator.java:169)
        at org.netbeans.modules.form.FormLAF$1.run(FormLAF.java:58)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1172)
        at org.openide.util.Mutex.readAccess(Mutex.java:253)
        at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:43)
        at org.netbeans.modules.form.MetaComponentCreator.precreateVisualComponent(MetaComponentCreator.java:166)
        at org.netbeans.modules.form.HandleLayer$NewComponentDrag.init(HandleLayer.java:2471)
        at org.netbeans.modules.form.HandleLayer$NewComponentDrag.<init>(HandleLayer.java:2466)
        at org.netbeans.modules.form.HandleLayer.mouseMoved(HandleLayer.java:1612)
        at java.awt.Component.processMouseMotionEvent(Component.java:5533)
        at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3144)
        at java.awt.Component.processEvent(Component.java:5257)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3905)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1774)
        at java.awt.Component.dispatchEvent(Component.java:3803)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    
    #257636 Reply

    Riyad Kalla
    Member

    Let’s address the first issue first, I got your project, imported it, and opened the MyPanelWithLogger.form file:

    I didn’t get any exceptions, errors or log file entries. I double checked the source tab, and the log is uncommented. Maybe I need to do something to cause the error to happen, please let me know what I missed.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Matisse Palette widget (ClassNotFoundException)

You must be logged in to post in the forum log in