Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Plug-in compiles and exports, but throws NPE when accessed
Plug-in compiles and exports, but throws NPE when accessed [message #35984] Thu, 04 December 2008 22:09 Go to next message
Bret Schuhmacher is currently offline Bret SchuhmacherFriend
Messages: 26
Registered: July 2009
Junior Member
Hi all,

I'm trying to extend a plug-in that works with my company's Eclipse v3.2
base. Before writing any new code, I'm trying to verify my build
environment setup.

I created a plug-in using Ganymede, v3.4, from the existing jar and
rebuilt it, then exported it. I set all the dependencies to the jars we
ship with our product, which are all v3.2 based. I can get our product to
load and resolve the new jar just fine. However, when I access any part
of the code in the jar (i.e. preference page, etc.) Eclipse pops up errors
about null pointer exceptions. Remember, I haven't touched a line of
working code.

I went through my jar and the original jar and my newly compiled classes
are all a little bigger (100-200 bytes) than the originals.

If I remove my version and replace the original version everything is back
to normal, so it's definitely something in my jar, although it
compiles,exports, and resolves successfully.

Am I running into a versioning issue? Should I be compiling with a
certain version of the compiler with certain compatibility flags set? All
I want to do at this point is rebuild some working code. Once I can
reliably do that I'll know any new problems are MY doing ;-).

Thanks in advance for any insights.

Rgds,

Bret
Re: Plug-in compiles and exports, but throws NPE when accessed [message #36125 is a reply to message #35984] Fri, 05 December 2008 15:57 Go to previous messageGo to next message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
You should set your target environment to point to a 3.2 install to
compile against. (Window->Preferences->Plug-in Development->Target
Platform).

A bundle compiled against 3.2 will be different than one compiled
against 3.4. Whether or not those differences matter depends on what
changed between 3.2 and 3.4. It is quite likely that there are changes
that are not binary compatible.

-Andrew
Bret Schuhmacher wrote:
> Hi all,
>
> I'm trying to extend a plug-in that works with my company's Eclipse v3.2
> base. Before writing any new code, I'm trying to verify my build
> environment setup.
>
> I created a plug-in using Ganymede, v3.4, from the existing jar and
> rebuilt it, then exported it. I set all the dependencies to the jars we
> ship with our product, which are all v3.2 based. I can get our product
> to load and resolve the new jar just fine. However, when I access any
> part of the code in the jar (i.e. preference page, etc.) Eclipse pops up
> errors about null pointer exceptions. Remember, I haven't touched a
> line of working code.
>
> I went through my jar and the original jar and my newly compiled classes
> are all a little bigger (100-200 bytes) than the originals.
>
> If I remove my version and replace the original version everything is
> back to normal, so it's definitely something in my jar, although it
> compiles,exports, and resolves successfully.
>
> Am I running into a versioning issue? Should I be compiling with a
> certain version of the compiler with certain compatibility flags set?
> All I want to do at this point is rebuild some working code. Once I can
> reliably do that I'll know any new problems are MY doing ;-).
>
> Thanks in advance for any insights.
>
> Rgds,
>
> Bret
>
>
>
Re: Plug-in compiles and exports, but throws NPE when accessed [message #36261 is a reply to message #36125] Mon, 08 December 2008 01:17 Go to previous messageGo to next message
Bret Schuhmacher is currently offline Bret SchuhmacherFriend
Messages: 26
Registered: July 2009
Junior Member
Thanks for the tip, Andrew. I have done what you suggested, as well as
played with all the options the PDE options allow, and I cannot seem to
affect the size of the compiled classes at all. No matter what I do the
classes come out larger than the original ones and fail to load with
NullPointerExceptions.

Is there any way to cause Eclipse to log *everything* it's doing as it
loads my plugin? A log file would help SO much more than a popup showing
me an NPE.

Thanks again,

Bret
Re: Plug-in compiles and exports, but throws NPE when accessed [message #36294 is a reply to message #36261] Mon, 08 December 2008 03:12 Go to previous message
Bret Schuhmacher is currently offline Bret SchuhmacherFriend
Messages: 26
Registered: July 2009
Junior Member
Ok, I found this
page:http://www.eclipse.org/eclipse/platform-core/documents/ 3.1/debug.html
which talks about the osgi console and other debugging tips. I stopped
and started my plugin and it works! So here's the problem:
1) I start Eclipse and go to my preference page and it fails to load,
throwing NullPointerExceptions. I dismiss these and the entire
preferences dialog.
2) I go to the osgi console and type "stop 5" (5 is my bundle id) and
"start 5"
3) I go back to the preference page for my plugin and now it works!

Soooo.... how can I force my plugin to load last?

Why must I do this? Is there a setting in the PDE that takes care of this?

Thanks!

Bret
Re: Plug-in compiles and exports, but throws NPE when accessed [message #586537 is a reply to message #35984] Fri, 05 December 2008 15:57 Go to previous message
Andrew Niefer is currently offline Andrew NieferFriend
Messages: 990
Registered: July 2009
Senior Member
You should set your target environment to point to a 3.2 install to
compile against. (Window->Preferences->Plug-in Development->Target
Platform).

A bundle compiled against 3.2 will be different than one compiled
against 3.4. Whether or not those differences matter depends on what
changed between 3.2 and 3.4. It is quite likely that there are changes
that are not binary compatible.

-Andrew
Bret Schuhmacher wrote:
> Hi all,
>
> I'm trying to extend a plug-in that works with my company's Eclipse v3.2
> base. Before writing any new code, I'm trying to verify my build
> environment setup.
>
> I created a plug-in using Ganymede, v3.4, from the existing jar and
> rebuilt it, then exported it. I set all the dependencies to the jars we
> ship with our product, which are all v3.2 based. I can get our product
> to load and resolve the new jar just fine. However, when I access any
> part of the code in the jar (i.e. preference page, etc.) Eclipse pops up
> errors about null pointer exceptions. Remember, I haven't touched a
> line of working code.
>
> I went through my jar and the original jar and my newly compiled classes
> are all a little bigger (100-200 bytes) than the originals.
>
> If I remove my version and replace the original version everything is
> back to normal, so it's definitely something in my jar, although it
> compiles,exports, and resolves successfully.
>
> Am I running into a versioning issue? Should I be compiling with a
> certain version of the compiler with certain compatibility flags set?
> All I want to do at this point is rebuild some working code. Once I can
> reliably do that I'll know any new problems are MY doing ;-).
>
> Thanks in advance for any insights.
>
> Rgds,
>
> Bret
>
>
>
Re: Plug-in compiles and exports, but throws NPE when accessed [message #586588 is a reply to message #36125] Mon, 08 December 2008 01:17 Go to previous message
Bret Schuhmacher is currently offline Bret SchuhmacherFriend
Messages: 26
Registered: July 2009
Junior Member
Thanks for the tip, Andrew. I have done what you suggested, as well as
played with all the options the PDE options allow, and I cannot seem to
affect the size of the compiled classes at all. No matter what I do the
classes come out larger than the original ones and fail to load with
NullPointerExceptions.

Is there any way to cause Eclipse to log *everything* it's doing as it
loads my plugin? A log file would help SO much more than a popup showing
me an NPE.

Thanks again,

Bret
Re: Plug-in compiles and exports, but throws NPE when accessed [message #586598 is a reply to message #36261] Mon, 08 December 2008 03:12 Go to previous message
Bret Schuhmacher is currently offline Bret SchuhmacherFriend
Messages: 26
Registered: July 2009
Junior Member
Ok, I found this
page:http://www.eclipse.org/eclipse/platform-core/documents/ 3.1/debug.html
which talks about the osgi console and other debugging tips. I stopped
and started my plugin and it works! So here's the problem:
1) I start Eclipse and go to my preference page and it fails to load,
throwing NullPointerExceptions. I dismiss these and the entire
preferences dialog.
2) I go to the osgi console and type "stop 5" (5 is my bundle id) and
"start 5"
3) I go back to the preference page for my plugin and now it works!

Soooo.... how can I force my plugin to load last?

Why must I do this? Is there a setting in the PDE that takes care of this?

Thanks!

Bret
Previous Topic:How to switch menu & toolbar actions conveniently?
Next Topic:UI methods in normal Job
Goto Forum:
  


Current Time: Thu Apr 25 21:21:12 GMT 2024

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

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

Back to the top