Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » AntRunner fails in RCP application
AntRunner fails in RCP application [message #550672] Wed, 04 August 2010 06:34 Go to next message
Juergen Weber is currently offline Juergen WeberFriend
Messages: 62
Registered: July 2009
Member
Hi,

I tried to call AntRunner from an RCP application, but it fails with the stacktrace below.
Caused by: java.lang.NullPointerException
at org.eclipse.ant.core.AntCorePreferences.findHighestAntVersio n(AntCorePreferences.java:491)

Does the ant.core plugin contain an ant installation?
But it even failed when I set anthome.

AntRunner ant = new AntRunner();
ant.setAntHome("D:/java/apache-ant-1.8.1");

URL url = new URL("platform:/plugin/org.eclipse.SamplePlugin/mybuild.xml");
URL fileURL = FileLocator.toFileURL(url);
File f = new File(fileURL.toURI());
ant.setBuildFileLocation(f.toString());
ant.run();

org.eclipse.core.runtime.CoreException: BUILD FAILED
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:388)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:475)
at org.eclipse.SampleHandler.execute(RunCoxHandler.java:97)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle rProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman d(WorkbenchKeyboard.java:468)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(Workben chKeyboard.java:786)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve nt(WorkbenchKeyboard.java:885)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ enceBindings(WorkbenchKeyboard.java:567)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(Work benchKeyboard.java:508)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter .handleEvent(WorkbenchKeyboard.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:125 3)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103 )
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099 )
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4268)
at org.eclipse.swt.widgets.ToolBar.WM_CHAR(ToolBar.java:1202)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4160 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4886 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:24 59)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3655)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.sample.rcp.Application.start(Application.java:31 )
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.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(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.NullPointerException
at org.eclipse.ant.core.AntCorePreferences.findHighestAntVersio n(AntCorePreferences.java:491)
at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHomeEnt ries(AntCorePreferences.java:440)
at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHome(An tCorePreferences.java:304)
at org.eclipse.ant.core.AntCorePreferences.restoreAntHome(AntCo rePreferences.java:292)
at org.eclipse.ant.core.AntCorePreferences.restoreCustomObjects (AntCorePreferences.java:197)
at org.eclipse.ant.core.AntCorePreferences.<init>(AntCorePreferences.java:163)
at org.eclipse.ant.core.AntCorePlugin.getPreferences(AntCorePlu gin.java:221)
at org.eclipse.ant.core.AntCorePlugin.getNewClassLoader(AntCore Plugin.java:252)
at org.eclipse.ant.core.AntRunner.getClassLoader(AntRunner.java :523)
at org.eclipse.ant.core.AntRunner.getInternalAntRunner(AntRunne r.java:396)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:323)
... 48 more
Re: AntRunner fails in RCP application [message #552830 is a reply to message #550672] Fri, 13 August 2010 16:13 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
The ant.core plugin does not contain an ant installation. The
org.apache.ant bundle is the ant install.

The NPE here seems to be setting the default preferences which expects the
ant install to be part of the osgi runtime.

You can just include org.apache.ant in your rcp product, or if you want to
use an external ant, it looks like you will need to set some preferences
before calling the ant runner.

I would suggest getting the org.eclipse.ant.core source and looking at
AntCorePreferences.restorCustomObjects to see the preferences it is reading
and set those as appropriate.

-Andrew

Juergen Weber wrote:

> Hi,
>
> I tried to call AntRunner from an RCP application, but it fails with the
> stacktrace below. Caused by: java.lang.NullPointerException
> at org.eclipse.ant.core.AntCorePreferences.findHighestAntVersio
> n(AntCorePreferences.java:491)
>
> Does the ant.core plugin contain an ant installation?
> But it even failed when I set anthome.
>
> AntRunner ant = new AntRunner();
> ant.setAntHome("D:/java/apache-ant-1.8.1");
>
> URL url = new
> URL("platform:/plugin/org.eclipse.SamplePlugin/mybuild.xml"); URL fileURL
> = FileLocator.toFileURL(url); File f = new File(fileURL.toURI());
> ant.setBuildFileLocation(f.toString());
> ant.run();
>
> org.eclipse.core.runtime.CoreException: BUILD FAILED
> at org.eclipse.ant.core.AntRunner.run(AntRunner.java:388)
> at org.eclipse.ant.core.AntRunner.run(AntRunner.java:475)
> at org.eclipse.SampleHandler.execute(RunCoxHandler.java:97)
> at org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle
> rProxy.java:293)
> at org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
> at org.eclipse.core.commands.ParameterizedCommand.executeWithCh
> ecks(ParameterizedCommand.java:508)
> at org.eclipse.ui.internal.handlers.HandlerService.executeComma
> nd(HandlerService.java:169)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeComman
> d(WorkbenchKeyboard.java:468)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(Workben
> chKeyboard.java:786)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEve
> nt(WorkbenchKeyboard.java:885)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequ
> enceBindings(WorkbenchKeyboard.java:567)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(Work
> benchKeyboard.java:508)
> at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter
> .handleEvent(WorkbenchKeyboard.java:123)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Display.filterEvent(Display.java:125 3)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
> at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103 )
> at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099 )
> at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
> at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4268)
> at org.eclipse.swt.widgets.ToolBar.WM_CHAR(ToolBar.java:1202)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:4160 )
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4886 )
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:24 59)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3655)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work
> bench.java:663)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.sample.rcp.Application.start(Application.java:31 )
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips
> eAppHandle.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(EclipseS
> tarter.java:369)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:25) at
> java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
> Caused by: java.lang.NullPointerException
> at org.eclipse.ant.core.AntCorePreferences.findHighestAntVersio
> n(AntCorePreferences.java:491)
> at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHomeEnt
> ries(AntCorePreferences.java:440)
> at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHome(An
> tCorePreferences.java:304)
> at org.eclipse.ant.core.AntCorePreferences.restoreAntHome(AntCo
> rePreferences.java:292)
> at org.eclipse.ant.core.AntCorePreferences.restoreCustomObjects
> (AntCorePreferences.java:197) at
>
org.eclipse.ant.core.AntCorePreferences.<init>(AntCorePreferences.java:163)
> at org.eclipse.ant.core.AntCorePlugin.getPreferences(AntCorePlu
> gin.java:221)
> at org.eclipse.ant.core.AntCorePlugin.getNewClassLoader(AntCore
> Plugin.java:252)
> at org.eclipse.ant.core.AntRunner.getClassLoader(AntRunner.java :523)
> at org.eclipse.ant.core.AntRunner.getInternalAntRunner(AntRunne
> r.java:396) at org.eclipse.ant.core.AntRunner.run(AntRunner.java:323)
> ... 48 more
Previous Topic:product run error
Next Topic:Where are the branding infos taken from: .product or plugin.xml?
Goto Forum:
  


Current Time: Mon Dec 06 12:10:42 GMT 2021

Powered by FUDForum. Page generated in 0.02568 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top