Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0(problem with ClassNotFoundException)
Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064680] Thu, 20 June 2013 10:08 Go to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
Hello!

i moved my application from Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with NatTable 1.0.0;
the bundles i created with my customized table were not touched/changed while moving to the newer versions.

so in 3.7 al was fine, now i get the exception below.

important notice:
the application starts as usual, also the table gets rendered ok.
i can add and remove columns, add filters etc.
the only thing i can NO MORE do is 'choose columns' - open the dialog which lets you choose the columns to display, thats where the exception gets raised...

java.lang.ClassNotFoundException: lumo.widgets.table.ColumnCategoriesModelProvider
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at java.io.ObjectInputStream.resolveClass(Unknown Source)
	at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
	at java.io.ObjectInputStream.readClassDesc(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at org.eclipse.nebula.widgets.nattable.util.ObjectCloner.deepCopy(ObjectCloner.java:41)
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.AvailableColumnCategoriesProvider.<init>(AvailableColumnCategoriesProvider.java:34)
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.ColumnCategoriesDialog.populateAvailableTree(ColumnCategoriesDialog.java:156)
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.ColumnCategoriesDialog.populateDialogArea(ColumnCategoriesDialog.java:85)
	at org.eclipse.nebula.widgets.nattable.columnChooser.gui.AbstractColumnChooserDialog.createDialogArea(AbstractColumnChooserDialog.java:56)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:760)
	at org.eclipse.jface.window.Window.create(Window.java:431)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
	at org.eclipse.jface.window.Window.open(Window.java:790)
	at org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommandHandler.doCommand(ChooseColumnsFromCategoriesCommandHandler.java:65)
	at org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommandHandler.doCommand(ChooseColumnsFromCategoriesCommandHandler.java:1)
	at org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler.doCommand(AbstractLayerCommandHandler.java:19)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.doCommand(AbstractLayer.java:154)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform.doCommand(AbstractLayerTransform.java:102)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommandOnChildLayer(GridLayer.java:109)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommandOnChildLayers(GridLayer.java:96)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.doCommand(CompositeLayer.java:137)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommand(GridLayer.java:178)
	at org.eclipse.nebula.widgets.nattable.NatTable.doCommand(NatTable.java:516)
	at org.eclipse.nebula.widgets.nattable.ui.menu.MenuItemProviders$14$1.widgetSelected(MenuItemProviders.java:468)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at at.biooffice.application.Application.start(Application.java:44)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

!ENTRY org.eclipse.ui 4 0 2013-06-20 15:48:31.099
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.AvailableColumnCategoriesProvider.hideEntries(AvailableColumnCategoriesProvider.java:43)
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.ColumnCategoriesDialog.populateAvailableTree(ColumnCategoriesDialog.java:157)
	at org.eclipse.nebula.widgets.nattable.columnCategories.gui.ColumnCategoriesDialog.populateDialogArea(ColumnCategoriesDialog.java:85)
	at org.eclipse.nebula.widgets.nattable.columnChooser.gui.AbstractColumnChooserDialog.createDialogArea(AbstractColumnChooserDialog.java:56)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:760)
	at org.eclipse.jface.window.Window.create(Window.java:431)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
	at org.eclipse.jface.window.Window.open(Window.java:790)
	at org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommandHandler.doCommand(ChooseColumnsFromCategoriesCommandHandler.java:65)
	at org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommandHandler.doCommand(ChooseColumnsFromCategoriesCommandHandler.java:1)
	at org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler.doCommand(AbstractLayerCommandHandler.java:19)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayer.doCommand(AbstractLayer.java:154)
	at org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform.doCommand(AbstractLayerTransform.java:102)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommandOnChildLayer(GridLayer.java:109)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommandOnChildLayers(GridLayer.java:96)
	at org.eclipse.nebula.widgets.nattable.layer.CompositeLayer.doCommand(CompositeLayer.java:137)
	at org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer.doCommand(GridLayer.java:178)
	at org.eclipse.nebula.widgets.nattable.NatTable.doCommand(NatTable.java:516)
	at org.eclipse.nebula.widgets.nattable.ui.menu.MenuItemProviders$14$1.widgetSelected(MenuItemProviders.java:468)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at at.biooffice.application.Application.start(Application.java:44)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


the class lumo.widgets.table.ColumnCategoriesModelProvider is in the same bundle, even in the same package (!) as my customized table class!

the stacktrace tells (me) nothing as at.biooffice.application.Application.start(Application.java:44) is simply
final int returnCode = PlatformUI.createAndRunWorkbench(display,
					new ApplicationWorkbenchAdvisor());


you guys are my last hope to get this thing working again...
thanks in advance
lumo


EDIT: if you need any more information let me know
see screenshot

[Updated on: Thu, 20 June 2013 10:29]

Report message to a moderator

Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064700 is a reply to message #1064680] Thu, 20 June 2013 11:05 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1201
Registered: July 2012
Senior Member
Sorry, I haven't ever worked with the ColumnCategories before.

Have you tried to switch step by step? Like first change to NatTable 1.0 and then to Eclipse 4.2? Just to see which change causes the issue?

It looks like an issue related to OSGi classloading. Because the NatTable bundles don't know and see your classes, the code in NatTable is not able to serialize and deserialize your classes. Maybe you need to add some buddy policy to your MANIFEST. But I'm not quite sure if that would help without adding some counterpart in the NatTable bundle MANIFEST.
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064779 is a reply to message #1064700] Fri, 21 June 2013 01:07 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
Dirk,

i just tried to switch back to 0.9 (i just pointed to the 0.9 jars in my target platform) on Eclipse 4.2 and its exactly the same exception.
so it must be the switch from E3.7 to E4.2.

buddy policy in my manifest. declare nattable as buddy in the bundle which defines my custom table?

EDIT: adding
Eclipse-BuddyPolicy: dependent
to my bundle (the one which includes the custom table code) did not resolve the problem (or is this the wrong place)

[Updated on: Fri, 21 June 2013 01:19]

Report message to a moderator

Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064781 is a reply to message #1064779] Fri, 21 June 2013 01:43 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
UPDATE: i grabbed the MANIFEST.MF from the
org.eclipse.nebula.widgets.nattable.core_1.0.0.201305291732.jar
and added:
Eclipse-BuddyPolicy: registered


then i opened the MANIFEST.MF from my bundle with the custom code and added:
Eclipse-RegisterBuddy: org.eclipse.nebula.widgets.nattable.core

now it is working again!

probably you should add the registered option to your MANIFEST.MF by default (let me know if you do so, so i can remove my notice from my targetplatform folder Wink
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064786 is a reply to message #1064781] Fri, 21 June 2013 02:37 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1201
Registered: July 2012
Senior Member
Hi,

glad I had the correct solution in mind and you were able to verify a fix. Smile

Could you please create a ticket for this? I don't think that it should be an issue to add the BuddyPolicy to NatTable, but I definitely want to discuss this with Edwin first. Also we need to track every change in Bugzilla. So this is the way to go and you get informed about the progress automatically. Smile

We also plan to bring out a bugfix release soon, so stay tuned.

Greez,
Dirk
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1064789 is a reply to message #1064786] Fri, 21 June 2013 02:56 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i added the bug to the list
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411332
btw i found another bug right now. will create a new thread for this one Smile
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065362 is a reply to message #1064789] Tue, 25 June 2013 08:43 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
could you please commit the manifest stuff into the next nightly build, as i can no
longer export my product (as eclipse tells me i use a modified jar)

it just stops.

Quote:
Either the manifest file or the signature file has been tampered in this jar


just to be sure, i exchanged my modded jar to a fresh one from the dl site.
and now it works, but resolves in the osgi loading problem described above Smile
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065363 is a reply to message #1065362] Tue, 25 June 2013 08:49 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1201
Registered: July 2012
Senior Member
I forwarded this to Edwin to get his opinion on this too. As we co-lead the NatTable project this change should be verified by both of us.

We also think about bringing out a bugfix version soon to solve the main issues that were reported the last days.
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065389 is a reply to message #1065363] Tue, 25 June 2013 10:21 Go to previous messageGo to next message
Edwin Park is currently offline Edwin Park
Messages: 124
Registered: July 2009
Senior Member
Hi Ludwig,

Can you tell me why you are subclassing ColumnCategoriesModel? I looked through the code and it looks like we are using a reflective deep copy as a convenience to do some things for available column categories. We should be able to rewrite this so that this isn't necessary, but I wanted to understand your use case first.

Thanks,
Edwin
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065400 is a reply to message #1065389] Tue, 25 June 2013 10:53 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i have a FieldInfoCollection (collection of informations on fields displayed in table and formular)
from this flat collection i generate my ColumnCategoriesModel.
it creates a Java-Object tree representation of my Data (from flat table)
eg: Person with Address:

Person.firstName
Person.lastName
Person.Address.street
Person.Address.country
etc...

this is built into the tree:
Person
  +firstName
  +lastName
  ->Address
    +street
    +country


here is my ColumnCategoriesModelProvider:
package lumo.widgets.table;

import java.util.HashMap;

public class ColumnCategoriesModelProvider extends ColumnCategoriesModel {
	private static final long serialVersionUID = 1001L;

	public ColumnCategoriesModelProvider(FieldInfoCollection fiCollection) {
		String cls = fiCollection.get(0).getSimpleClassName();
		Node root = addRootCategory(cls);
		
		Map<String, Node> mapping = new HashMap<String, Node>();

		List<FieldInfo> infos = fiCollection.getAll();
		for (int i = 0; i < infos.size(); i++) {
			FieldInfo fi = infos.get(i);
			String nodeName = cls+"."+fi.getInternal();
			String[] split = nodeName.split("\\.");
			Node parentCategory = root;
			for (int j = 0; j < split.length; j++) {
				if (j < split.length - 1) {
					// its no leaf yet
					Node n = mapping.get(split[j].toLowerCase());
					if (n == null) {
						n = addCategory(parentCategory, ColumnCategoriesModelProvider.capitaliseFirstLetter(split[j]));
						mapping.put(split[j].toLowerCase(), n);
					}
					parentCategory = n;
				} else {
					addColumnsToCategory(parentCategory, fi.getIndex());
					break;
				}
			}
			while (parentCategory!=root) {
				parentCategory = parentCategory.getParent();
			}
		}
	}

	public static String capitaliseFirstLetter(String string) {
		return string.substring(0, 1).toUpperCase() + string.substring(1);
	}

	/**
	 * Method to join array elements of type string
	 * 
	 * @author lumo
	 * @param inputArray
	 *            Array which contains strings
	 * @param toIndex
	 *            to the position of the array - stops here
	 * @param glueString
	 *            String between each array element
	 * @return String containing all array elements seperated by glue string
	 */
	public static String implode(String[] inputArray, int toIndex,
			String glueString) {
		String output = "";
		if (toIndex >= inputArray.length) {
			throw new IndexOutOfBoundsException(
					"You tried to Implode an Array to an Index, which is outside of the Size of the given Array.");
		}

		if (inputArray.length > 0) {
			StringBuilder sb = new StringBuilder();
			sb.append(inputArray[0]);

			for (int i = 1; i <= toIndex; i++) {
				sb.append(glueString);
				sb.append(inputArray[i]);
			}

			output = sb.toString();
		}

		return output;
	}
}


i am open to any other solutions!
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065428 is a reply to message #1065400] Tue, 25 June 2013 12:29 Go to previous messageGo to next message
Edwin Park is currently offline Edwin Park
Messages: 124
Registered: July 2009
Senior Member
Hi Ludwig,

Okay, that's fine. The issue with NatTable right now is that you're subclassing ColumnCategoriesModel and NatTable is trying to do a reflective copy of the model. It looks like you should be able to change your code to just create and configure a ColumnCategoriesModel instance instead of subclassing, which would get around this issue. That said, there's no real reason NatTable needs to do a reflective copy of the model in the first place. I'm checking in a change to remove the reflective copy which you should be able to try out shortly.

Cheers,
Edwin
Re: Eclipse 3.7 with NatTable 0.9 to Eclipse 4.2 with Nattable 1.0.0 [message #1065431 is a reply to message #1065428] Tue, 25 June 2013 12:34 Go to previous message
Edwin Park is currently offline Edwin Park
Messages: 124
Registered: July 2009
Senior Member
Okay, I just checked in the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=411332. You can try it out via the latest snapshot after it finishes building.

Cheers,
Edwin
Previous Topic:Auto resize Column/Row Width/Height empties table
Next Topic:Display values in GroupBy tree nodes
Goto Forum:
  


Current Time: Tue Jul 22 03:33:41 EDT 2014

Powered by FUDForum. Page generated in 0.01852 seconds