Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343640 - API use scan NPE with ant (PDE core not initialized)
Summary: API use scan NPE with ant (PDE core not initialized)
Status: CLOSED DUPLICATE of bug 342193
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE API Tools Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-22 04:28 EDT by Nicolas Bros CLA
Modified: 2011-04-25 11:03 EDT (History)
2 users (show)

See Also:


Attachments
stacktrace (1.80 KB, text/plain)
2011-04-22 04:28 EDT, Nicolas Bros CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Bros CLA 2011-04-22 04:28:45 EDT
Created attachment 193905 [details]
stacktrace

I am trying to run an API use scan as described in:
http://wiki.eclipse.org/PDE/API_Tools/Resources#Running_an_API_use_scan_.28commandline.29

But I am blocked by a NPE apparently due to PDE Core not being initialized (see attached stacktrace).

I get this exception both in my local installation when running ant in a separate JRE, and on the Hudson instance on build.eclipse.org, but not when running ant in the same JRE as my Eclipse instance (in this case, I suppose Eclipse already properly initialized the bundles).

When the static variable LocalTargetHandle#LOCAL_TARGET_CONTAINER_PATH is initialized, PDECore#inst is still null, leading to a NPE in "PDECore.getDefault().getStateLocation()"

What I don't understand is that the wiki page describes running the API scan like a standard Java application. Shouldn't it be run as an Eclipse application instead? Otherwise, how are the bundles supposed to be started if there is no Equinox running?
Comment 1 Michael Rennie CLA 2011-04-25 11:03:01 EDT
This is a known issue and has been fixed in bug 342193.

> What I don't understand is that the wiki page describes running the API scan
> like a standard Java application. 

I am not sure what you mean. The section describes how to run the tasks from the commandline; there is no Java nor running Eclipse involved at all.

> Shouldn't it be run as an Eclipse application
> instead? 

It *could* be run that way as well. But we also support running the Ant tasks from the commandline using only Ant like the following:

   root%>ant -buildfile <build file name>

> Otherwise, how are the bundles supposed to be started if there is no
> Equinox running?

The bundles do not get started in the commandline case. The cause of this issue is that there is no OSGi running and the target platform service was not working as expected without OSGi.

*** This bug has been marked as a duplicate of bug 342193 ***