Results 1 to 2 of 2
  1. #1
    SatishP is offline Member
    Join Date
    Sep 2008
    Posts
    1
    Rep Power
    0

    Default NoClassDefFoundError in Eclipse Plugin Dev: Are Access Restrictions responsible?

    Hi,
    I am facing an issue in enhancing a Eclipse RCP application. I need to add new functionality in the product. I get a java.lang.NoClassDefFoundError exception.

    Background: The com.product.client.core_2.0.0.jar and com.product.client.extn_2.0.0.jar are two plugins in the application. The extension point is defined in the com.product.client.extn plugin, which I use to plug my own files. The com.product.client.core plugin contains the core code for the product.

    Now I create a new plugin that contains the new functionality code. This plugin is com.customization.client.jar. The MANIFEST.MF for my plugin is as below:


    com.customization.client plugin's MANIFEST:

    Java Code:
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: CustomizationOne Plug-in
    Bundle-SymbolicName: CustomizationOne;singleton:=true
    Bundle-Version: 1.0.0
    Bundle-Activator: customizationOne.Activator
    Bundle-Localization: plugin
    Eclipse-RegisterBuddy: com.product.client.extn
    Require-Bundle: org.eclipse.ui,
     org.eclipse.core.runtime,
     com.product.client.extn,
     com.product.client.core,
     com.product.client.apps
    Eclipse-LazyStart: true
    Export-Package: com.customization.customactions,
     com.customization.customcommands,
     com.customization.customdialogs,
     customizationOne

    Now here's the code that is creating the problem:

    Java Code:
    // com.customization.customdialogs.FindDialog
    public class FindDialog()
    {
    	public FindDialog(FindTypePanel p)
    	{
                 m_panel = p;
    	}
    
    	public void constructUI()
    	{
    		JButton applyButton = new JButton("Apply");
    		applyButton.addActionListener(new ActionListener()
    		{
    			public void actionPerformed( ActionEvent e )
    			{
    				apply();
    			}
    		});
    
    		//...
    		//rest of the code
    	}
    
    
    	public void apply()
    	{
    		//m_panel is a class level FindTypePanel reference
    		FindTree m_tree = m_panel.getTree();
    
    		ResultPanel m_rPanel = (ResultPanel)m_panel.getPanelFromClass
    				("com.product.client.ResultPanel");
    		[COLOR="Red"]//##### the following line is throwing the error ####[/COLOR]
    		m_rPanel.showResults(m_tree);
    	}
    }
    
    
    //com.customization.customcommands.FindCommand
    public class FindCommand()
    {
    	public FindCommand()
    	{
    		processTargets();
    	}
    
    	private void processTargets()
    	{
    		final FindTypePanel m_panel = application.getActivePanel();
    		Runnable runNow = new Runnable()
    		{
    			public void run()
    			{
    				FindDialog dlg = new FindDialog(m_panel);
    				dlg.show();
    			}
    		};
    		
    		SwingUtilities.invokeLater(runNow);
    	}
    }

    The error is given below:

    Java Code:
    ERROR: 13:47:36,071  - Instancer.newInstanceEx:?
    Error in instantiating class Name [com.customization.customcommands.FindCommand]
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.product.client.extn.Instancer.newInstanceEx(Unknown Source)
    at com.customization.customactions.FindAction.run(FindAction.java:43)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: com/product/client/core/common/AbstractTree
    at com.customization.customcommands.FindCommand.processTargets
    (FindCommand.java:172)
    at com.customization.customcommands.FindCommand.<init>(FindCommand.java:52)
    ... 9 more
    
    [B]ERROR: 13:47:36,087  - Instancer.newInstanceEx:?
    Original Execption:
    java.lang.NoClassDefFoundError: com/product/client/core/common/AbstractTree[/B]
    at com.customization.customcommands.FindCommand.processTargets
    (FindCommand.java:172)
    at com.customization.customcommands.FindCommand.<init>(FindCommand.java:52)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.product.client.extn.Instancer.newInstanceEx(Unknown Source)
    at com.customization.customactions.FindAction.run(FindAction.java:43)
    at java.lang.Thread.run(Unknown Source)

    Although I haven't explicitly used the AbstractTree class, it is the super class for the FindTree class (which I am using). Both are present in the com.product.client.core plugin. But the package of the AbstractTree (com.product.client.core.common) is under Access Restriction while that of FindTree isn't.

    Is the 'Access Restriction' imposed on the 'com.product.client.core.common' responsible for the error?

    Can someone help?

    Thanks
    Satish

  2. #2
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Each plugin has its own classloader, hence your problem. To get around this, look into the docs for RCP, or a good book, and look for "buddy classloading". It's been a while since I worked in RCP so I can't recall exactly what you need to do off the top of my head

Similar Threads

  1. Replies: 5
    Last Post: 09-03-2008, 06:29 PM
  2. plugin for using jsf in eclipse
    By shu2hua in forum Eclipse
    Replies: 0
    Last Post: 05-30-2008, 06:54 AM
  3. Eclipse Plugin Dev
    By eva in forum Eclipse
    Replies: 1
    Last Post: 01-21-2008, 11:56 PM
  4. AnyEdit Plugin For Eclipse Plugin
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 05-18-2007, 01:28 PM
  5. plugin for eclipse
    By sin in forum Eclipse
    Replies: 1
    Last Post: 05-10-2007, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •