feedburner
Enter your email address:

Delivered by FeedBurner

feedburner count

Eclipse DbUnit Plugin

Labels: , , ,

The eclipse DbUnit plugin in eclipse 3.3 is a shell project and is missing the DbUnit jars.
Because of this, the DbUnit Test Case wizard fails with the following error:


Creation of element failed.

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:383)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1149)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1142)
at org.eclipse.datatools.enablement.jdt.dbunit.internal.wizards.DbUnitWizard.finishPage(DbUnitWizard.java:69)
at org.eclipse.datatools.enablement.jdt.dbunit.internal.wizards.NewTestCaseCreationWizard.performFinish(NewTestCaseCreationWizard.java:63)
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:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:135)
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:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
Caused by: java.lang.NoClassDefFoundError
at org.eclipse.datatools.enablement.jdt.dbunit.internal.wizards.NewDbUnitTestCaseWizardPage1.class$(NewDbUnitTestCaseWizardPage1.java:674)
at org.eclipse.datatools.enablement.jdt.dbunit.internal.wizards.NewDbUnitTestCaseWizardPage1.createGetDataSet(NewDbUnitTestCaseWizardPage1.java:673)
at org.eclipse.datatools.enablement.jdt.dbunit.internal.wizards.NewDbUnitTestCaseWizardPage1.createTypeMembers(NewDbUnitTestCaseWizardPage1.java:520)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:2053)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$7.run(NewTypeWizardPage.java:2543)
at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:68)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:101)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:113)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
... 46 more
Caused by: java.lang.ClassNotFoundException: org.dbunit.dataset.IDataSet
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(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
... 56 more

In order to fix the problem we need to fetch the missing DbUnit jars by running the fetch-lib.xml ANT script in the DbUnit plugin directory (plugins/org.dbunit_2.2.0.200706071).

<?xml version="1.0"?>

<project default="main" basedir=".">
<target name="main">
<mkdir dir="libs" />
<property name="base.url" value="http://superb-west.dl.sourceforge.net/sourceforge/dbunit"/>
<get usetimestamp="true" src="${base.url}/dbunit-2.2.jar" dest="libs/dbunit-2.2.jar" />
<get usetimestamp="true" src="${base.url}/dbunit-2.2.jar" dest="libs/dbunit-2.2-javadoc.jar" />
<get usetimestamp="true" src="${base.url}/dbunit-2.2.jar" dest="libs/dbunit-2.2-sources.jar" />
<eclipse.refreshLocal resource="org.dbunit" depth="4"/>
</target>
</project>

Another options is to download the DbUnit jar manually to the DbUnit libs plugin directory. We will need to copy the file to libs/dbunit-2.2.jar, libs/dbunit-2.2-javadoc.jar and libs/dbunit-2.2-sources.jar.

0 comments:

Post a Comment