You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Ronald Becher <wa...@warui.info> on 2008/06/19 12:28:06 UTC

NoClassDefFoundError in Eclipse Plugin IDE

Hi Guys,

I'm new to the list, so I'm waveing a first hello at everyone ... *wave* :)

I'm currently _trying_ to de-bug an Eclipse Plugin (not written by me) 
and am running into some problems (stacktrace at the end)

The code looks like this
> try {
> 	document= XMLTestSuiteDocument.Factory.newInstance();
> } catch(Throwable e) {
> 	e.printStackTrace();
> }
which leads me to an interface XMLTestSuiteDocument (extends 
org.apache.xmlbeans.XmlObject)

Inside I have this "public static final class" Factory, which (you 
would've guessed it) contains the following method

> public static org.bpelunit.framework.xml.suite.XMLTestSuiteDocument newInstance() {
>  XMLTestSuiteDocument t = (org.bpelunit.framework.xml.suite.XMLTestSuiteDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null );
>  t=t; /* TODO for easier inspection, remove later */
>  return t;}

"type" references this var in the XMLTestSuiteDocument interface 
(containing the Factory). Although I'm not a total noob to Java, I have 
to admit, that I am not familiar whith the way, this variable is 
initialized ... but okay
> public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
>         org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XMLTestSuiteDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s21B6514B5535163199D3BCDDAA42EFA0").resolveHandle("testsuite8482doctype");

However, this call leads us to XmlBeans.getContextTypeLoader().
Since the exceptions caught at this point do not match the one thrown, I 
suspect this method itself not to be the problem.
It calls
> return (SchemaTypeLoader)_getContextTypeLoaderMethod.invoke(null, null);
and therefore
> private static Method buildGetContextTypeLoaderMethod()
> {
>   return buildNoArgMethod( "org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl", "getContextTypeLoader" );
> }
leading us to
> private static final Method buildNoArgMethod ( String className, String methodName )
> {
>   return buildMethod( className, methodName, new Class[ 0 ] );
> }
and finally to
> private static final Method buildMethod ( String className, String methodName, Class[] args )
 > /* in XMLBeans.java:170 */

I do not fully understand the architecture of the call in the try-block, 
but suspect that also at this point the problem is somewhere else, 
because buildMethod() throws an IllegalStateException, which I do not 
get ... *hrmpf*

I have compiled XMLBeans from the source on commandline according to the 
  instructions, and until this point everything seemed to work also ...
I've put XMLBeans into Eclipse as a new project for convenient browsing 
and debugging and stuff.

Anyone has any idea or experienced similar problems?
Am I perhaps per any chance missing some dependency in or outside XMLBeans?

Thanks in advance,
Ronald


The halfway full stacktrace would read like this:
> java.lang.NoClassDefFoundError
> 	at org.apache.xmlbeans.XmlBeans.class$(XmlBeans.java:43)
> 	at org.apache.xmlbeans.XmlBeans.buildNodeMethod(XmlBeans.java:195)
> 	at org.apache.xmlbeans.XmlBeans.buildNodeToCursorMethod(XmlBeans.java:232)
> 	at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:131)
> 	at org.bpelunit.framework.xml.suite.XMLTestSuiteDocument$Factory.newInstance(XMLTestSuiteDocument.java:45)
> 	at org.bpelunit.toolsupport.wizards.BPELUnitNewWizard.performFinish(BPELUnitNewWizard.java:80)
> 	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
> 	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
> 	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
> 	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
> 	at org.eclipse.jface.window.Window.open(Window.java:796)
> 	at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)
> 	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> 	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
> 	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
> 	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
> 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
> 	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
> 	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> 	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> 	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:508)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
> Caused by: java.lang.ClassNotFoundException: org.w3c.dom.Node
> 	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:434)
> 	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
> 	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
> 	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
> 	at java.lang.ClassLoader.loadClass(Unknown Source)
> 	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Unknown Source)
> 	... 46 more


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: NoClassDefFoundError in Eclipse Plugin IDE

Posted by Cezar Andrei <ce...@oracle.com>.
There were a couple of emails from people having problems with classloaders in Eclipse. This seems to be in the same class. Check the archives.

Cezar

> -----Original Message-----
> From: Ronald Becher [mailto:warui@warui.info]
> Sent: Thursday, June 19, 2008 5:28 AM
> To: user@xmlbeans.apache.org
> Subject: NoClassDefFoundError in Eclipse Plugin IDE
> 
> Hi Guys,
> 
> I'm new to the list, so I'm waveing a first hello at everyone ... *wave*
> :)
> 
> I'm currently _trying_ to de-bug an Eclipse Plugin (not written by me)
> and am running into some problems (stacktrace at the end)
> 
> The code looks like this
> > try {
> > 	document= XMLTestSuiteDocument.Factory.newInstance();
> > } catch(Throwable e) {
> > 	e.printStackTrace();
> > }
> which leads me to an interface XMLTestSuiteDocument (extends
> org.apache.xmlbeans.XmlObject)
> 
> Inside I have this "public static final class" Factory, which (you
> would've guessed it) contains the following method
> 
> > public static org.bpelunit.framework.xml.suite.XMLTestSuiteDocument
> newInstance() {
> >  XMLTestSuiteDocument t =
> (org.bpelunit.framework.xml.suite.XMLTestSuiteDocument)
> org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type,
> null );
> >  t=t; /* TODO for easier inspection, remove later */
> >  return t;}
> 
> "type" references this var in the XMLTestSuiteDocument interface
> (containing the Factory). Although I'm not a total noob to Java, I have
> to admit, that I am not familiar whith the way, this variable is
> initialized ... but okay
> > public static final org.apache.xmlbeans.SchemaType type =
> (org.apache.xmlbeans.SchemaType)
> >
> org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XMLTestSuiteDocument
> .class.getClassLoader(),
> "schemaorg_apache_xmlbeans.system.s21B6514B5535163199D3BCDDAA42EFA0").reso
> lveHandle("testsuite8482doctype");
> 
> However, this call leads us to XmlBeans.getContextTypeLoader().
> Since the exceptions caught at this point do not match the one thrown, I
> suspect this method itself not to be the problem.
> It calls
> > return (SchemaTypeLoader)_getContextTypeLoaderMethod.invoke(null, null);
> and therefore
> > private static Method buildGetContextTypeLoaderMethod()
> > {
> >   return buildNoArgMethod(
> "org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl",
> "getContextTypeLoader" );
> > }
> leading us to
> > private static final Method buildNoArgMethod ( String className, String
> methodName )
> > {
> >   return buildMethod( className, methodName, new Class[ 0 ] );
> > }
> and finally to
> > private static final Method buildMethod ( String className, String
> methodName, Class[] args )
>  > /* in XMLBeans.java:170 */
> 
> I do not fully understand the architecture of the call in the try-block,
> but suspect that also at this point the problem is somewhere else,
> because buildMethod() throws an IllegalStateException, which I do not
> get ... *hrmpf*
> 
> I have compiled XMLBeans from the source on commandline according to the
>   instructions, and until this point everything seemed to work also ...
> I've put XMLBeans into Eclipse as a new project for convenient browsing
> and debugging and stuff.
> 
> Anyone has any idea or experienced similar problems?
> Am I perhaps per any chance missing some dependency in or outside
> XMLBeans?
> 
> Thanks in advance,
> Ronald
> 
> 
> The halfway full stacktrace would read like this:
> > java.lang.NoClassDefFoundError
> > 	at org.apache.xmlbeans.XmlBeans.class$(XmlBeans.java:43)
> > 	at org.apache.xmlbeans.XmlBeans.buildNodeMethod(XmlBeans.java:195)
> > 	at
> org.apache.xmlbeans.XmlBeans.buildNodeToCursorMethod(XmlBeans.java:232)
> > 	at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:131)
> > 	at
> org.bpelunit.framework.xml.suite.XMLTestSuiteDocument$Factory.newInstance(
> XMLTestSuiteDocument.java:45)
> > 	at
> org.bpelunit.toolsupport.wizards.BPELUnitNewWizard.performFinish(BPELUnitN
> ewWizard.java:80)
> > 	at
> org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
> > 	at
> org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
> > 	at
> org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
> > 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> > 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> > 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> > 	at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> > 	at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> > 	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
> > 	at org.eclipse.jface.window.Window.open(Window.java:796)
> > 	at
> org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)
> > 	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> > 	at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(Acti
> onContributionItem.java:546)
> > 	at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributio
> nItem.java:490)
> > 	at
> org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContri
> butionItem.java:402)
> > 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> > 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> > 	at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> > 	at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> > 	at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
> > 	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
> > 	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
> > 	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> > 	at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:28
> 9)
> > 	at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461
> )
> > 	at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> > 	at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplicatio
> n.java:106)
> > 	at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.jav
> a:169)
> > 	at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplicatio
> n(EclipseAppLauncher.java:106)
> > 	at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Eclipse
> AppLauncher.java:76)
> > 	at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:36
> 3)
> > 	at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:17
> 6)
> > 	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:508)
> > 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
> > 	at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
> > 	at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
> > Caused by: java.lang.ClassNotFoundException: org.w3c.dom.Node
> > 	at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(Bu
> ndleLoader.java:434)
> > 	at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoad
> er.java:369)
> > 	at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoad
> er.java:357)
> > 	at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(Default
> ClassLoader.java:83)
> > 	at java.lang.ClassLoader.loadClass(Unknown Source)
> > 	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> > 	at java.lang.Class.forName0(Native Method)
> > 	at java.lang.Class.forName(Unknown Source)
> > 	... 46 more
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org