Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Exposing own extension in plugin fails in runtime
Exposing own extension in plugin fails in runtime [message #297595] Tue, 17 January 2006 10:31 Go to next message
Eclipse UserFriend
Hi all,
I am experiecing a problem when I have a plugin exposing an extension
point. In debug mode (PDE) it all works very fine. When exported and
installed it seemingly doesn't work as well.. anyhow, the error I get
indicates that my plug exteding the extension point cannot load a class
within its own plugin (!), from the same package.

What am I doing wrong here? What is missing??

The classes are all .class files at the root of the JR-file (no JAR within
a JAR). The plugin also has a preference page, it has no problem
instantiating and creating it, it is visible in Window->Preferences
dialogue.

Thanks in advance,

Robert
Re: Exposing own extension in plugin fails in runtime [message #297602 is a reply to message #297595] Tue, 17 January 2006 11:22 Go to previous messageGo to next message
Eclipse UserFriend
So the most common cause of your problem is JAR within JAR, but you
already mentioned you're not using 3rd party libraries.

What is the exception stack trace?


What does you manifest look like? What version of eclipse? When you do
a jar tf <plugin> can you see your .class file next to the extension
point class file? What does your plugin.xml look like?

Later,
PW
Re: Exposing own extension in plugin fails in runtime [message #297607 is a reply to message #297602] Tue, 17 January 2006 12:00 Go to previous messageGo to next message
Eclipse UserFriend
Paul Webster wrote:

> So the most common cause of your problem is JAR within JAR, but you
> already mentioned you're not using 3rd party libraries.

> What is the exception stack trace?


> What does you manifest look like? What version of eclipse? When you do
> a jar tf <plugin> can you see your .class file next to the extension
> point class file? What does your plugin.xml look like?

> Later,
> PWPaul,
Thank you for your swift reply. I am using Eclipse 3.1. The extension
point class is within the same package as the plugin class, and they are
visible in the root of the JAR-file that makes up the plugin.
Unfortunately I am experiencing some trouble getting the stack trace, but
I found that the CoreException thrown indicates the plugin class unable to
load the class implementing the extension point.

Here is some more data from my extending plugin (removed my company's
name...):

Comment:the preference page has no problem when instantiating the class
creating the page, etc.

First the plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.ui.preferencePages">
<page

category=" com.xxxxxx.bronzefish2.preferences.BronzeFish2PreferencePage "

class=" com.xxxxxx.bronzefish.baseline.preferences.BaselinePreferenc ePage "

id=" com.xxxxxx.bronzefish.baseline.preferences.BaselinePreferenc ePage "
name="Baseline"/>
</extension>
<extension
point="com.xxxxxx.bronzefish2.BronzeFishBaseLineUpdate">
<BronzeFishBaseLineUpdate
class="com.xxxxxx.bronzefish.baseline.BaselineUpdater"/>
</extension>

</plugin>


The manifest file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Baseline Plug-in
Bundle-SymbolicName: com.xxxxxx.bronzefish.baseline; singleton:=true
Bundle-Version: 0.0.2
Bundle-Activator: com.xxxxxx.bronzefish.baseline.BaselinePlugin
Bundle-Vendor: xxxxxx
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.xxxxxx.bronzefish2
Eclipse-AutoStart: true

... anything missing that should be there? Is this enough to go on for the
moment?

//Robert
Re: Exposing own extension in plugin fails in runtime [message #297608 is a reply to message #297607] Tue, 17 January 2006 12:10 Go to previous messageGo to next message
Eclipse UserFriend
So that was useful information, but we need a little more ... what's
your usecase?

ex: com.xxxxxx.bronzefish2 defines the extension point? and it's
activator is the one walking through the config elements? it
instantiates the executable extension and tries to do something with it
(and that's when you get the ClassNotFound)? Does anything in your
extension point try and use loadClass(*) or forName(*), or does it just
work by instantiating the executable extension?

And then com.xxxxxx.bronzefish.baseline actually implements the 2
extensions (preference page and
com.xxxxxx.bronzefish2.BronzeFishBaseLineUpdate). Or is this the plugin
that you get the ClassNotFound in?

Later,
PW
Re: Exposing own extension in plugin fails in runtime [message #297613 is a reply to message #297608] Tue, 17 January 2006 12:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: robert.varttinen.sonyericsson.com

See my answers in-line:

Paul Webster wrote:

> So that was useful information, but we need a little more ... what's
> your usecase?

> ex: com.xxxxxx.bronzefish2 defines the extension point?

Yes, it defiens the extnsion point.

> and it's
> activator is the one walking through the config elements? it
> instantiates the executable extension and tries to do something with it
> (and that's when you get the ClassNotFound)? Does anything in your
> extension point try and use loadClass(*) or forName(*), or does it just
> work by instantiating the executable extension?

Yes, the activator walks (for-loop) through each extension it finds, one
in my test as of now. The ClassNotFound seems to come from the other,
extending plugin.
The activator, what I think it is, uses createExecutableExtension(...) on
the element it found. I basically followed an example on how to create
extension points.

No, there is no loadClass(..) or forName(..) in my code.

> And then com.xxxxxx.bronzefish.baseline actually implements the 2
> extensions (preference page and
> com.xxxxxx.bronzefish2.BronzeFishBaseLineUpdate). Or is this the plugin
> that you get the ClassNotFound in?

Yes, so it seems. I am currently trying to get the exceptiom stack trace
to the log ... but that seems a bit tricky.

> Later,
> PW

Thanks,

//Robert
Re: Exposing own extension in plugin fails in runtime [message #297615 is a reply to message #297613] Tue, 17 January 2006 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: robert.varttinen.sonyericsson.com

Managed to get something to the log, hope it is useful:

//Robert


!ENTRY com.xxxxxx.bronzefish2 4 0 2006-01-17 18:42:17.155
!MESSAGE Unable to execute early startup code for an extension
!STACK 1
org.eclipse.core.runtime.CoreException[1]: java.lang.NoClassDefFoundError:
com/xxxxxx/bronzefish2/BronzeFishBaselineUpdate
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.d efineClass(DefaultClassLoader.java:370)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.defineCl ass(EclipseClassLoader.java:227)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.f indClassImpl(DefaultClassLoader.java:343)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.f indClass(DefaultClassLoader.java:235)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. findLocalClass(AbstractClassLoader.java:183)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.basicFin dLocalClass(EclipseClassLoader.java:141)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLoca lClass(EclipseClassLoader.java:122)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:337)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:389)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:275)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1259)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:152)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:142)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:129)
at
org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 48)
at
com.xxxxxx.bronzefish2.rmi.BaselineRunner.getExecutableExten sion(BaselineRunner.java:73)
at
com.xxxxxx.bronzefish2.rmi.BaselineRunner.execute(BaselineRu nner.java:49)
at
com.xxxxxx.bronzefish2.rmi.BronzeFishRMIClient$1.run(BronzeF ishRMIClient.java:89)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
!SUBENTRY 1 org.eclipse.core.runtime 4 1 2006-01-17 18:42:17.155
!MESSAGE Plug-in com.xxxxxx.bronzefish.baseline was unable to load class
com.xxxxxx.bronzefish.baseline.BaselineUpdater.
!STACK 0
java.lang.NoClassDefFoundError:
com/xxxxxx/bronzefish2/BronzeFishBaselineUpdate
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.d efineClass(DefaultClassLoader.java:370)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.defineCl ass(EclipseClassLoader.java:227)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.f indClassImpl(DefaultClassLoader.java:343)
at
org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.f indClass(DefaultClassLoader.java:235)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. findLocalClass(AbstractClassLoader.java:183)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.basicFin dLocalClass(EclipseClassLoader.java:141)
at
org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLoca lClass(EclipseClassLoader.java:122)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:337)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:389)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:350)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:275)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1259)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:152)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:142)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:129)
at
org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 48)
at
com.xxxxxx.bronzefish2.rmi.BaselineRunner.getExecutableExten sion(BaselineRunner.java:73)
at
com.xxxxxx.bronzefish2.rmi.BaselineRunner.execute(BaselineRu nner.java:49)
at
com.xxxxxx.bronzefish2.rmi.BronzeFishRMIClient$1.run(BronzeF ishRMIClient.java:89)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Re: Exposing own extension in plugin fails in runtime [message #297617 is a reply to message #297615] Tue, 17 January 2006 12:53 Go to previous messageGo to next message
Eclipse UserFriend
R. Varttinen wrote:
> Managed to get something to the log, hope it is useful:
>
> //Robert
>
>
> !ENTRY com.xxxxxx.bronzefish2 4 0 2006-01-17 18:42:17.155
> !MESSAGE Unable to execute early startup code for an extension
> !STACK 1
> org.eclipse.core.runtime.CoreException[1]:
> java.lang.NoClassDefFoundError:
> com/xxxxxx/bronzefish2/BronzeFishBaselineUpdate

point="com.xxxxxx.bronzefish2.BronzeFishBaseLineUpdate">

Is there a mismatch somewhere ... your extension point is listed as
BronzeFishBaseLineUpdate (^^^) but you are trying to load
BronzeFishBaselineUpdate ... 2 different classes. For consistency and
peace of mind, you should make sure that BronzeFishBaseLineUpdate is
always spelled with "Line", not "line"

If you are running on windows, it would also explain why it worked in
Eclipse but not after deployment ...

Later,
PW
Re: Exposing own extension in plugin fails in runtime [message #297625 is a reply to message #297617] Tue, 17 January 2006 13:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: robert.varttinen.sonyericsson.com

Paul,
Thanks for your sharp eyes! I managed to find what it was... as you
mention, it was due to a mismatch in naming. It was actually quite hard to
find as is resided "deep down" in an XML-file that did not get re-deployed
as I expected. Therefore it seemed so persistent... anyhow, Thanks for
your time. I really appreciated it! Now I'll go on with the rest...

//Robert

P.S. In the meanwhile I got some logging into the code - so nothing bad
without some good coming out...
Re: Exposing own extension in plugin fails in runtime [message #300161 is a reply to message #297617] Thu, 02 March 2006 18:50 Go to previous messageGo to next message
Eclipse UserFriend
Paul,

sorry to reopen this topic but I have a similar problem.

I have more or less the same situation and the same exception:

Plug-in "plugin2" was unable to instantiate class "xxx.Foo".

java.lang.ClassNotFoundException: zzz.Bar
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:404)
at
org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:93)
at java.lang.ClassLoader.loadClass(Unknown Source)...

Note that the plugin "plugin2" is defining the extension point with
class="xxx.Foo". The class zzz.Bar is a class which is used in the
Constructor of class "xxx.Foo" and which is definitely in the same
plugin "plugin2" (just another source folder).

I am only testing using a runtime workbench.

Maybe special: class zzz.Bar is located as I said in the plugin2 plugin.
It extends another class which is defined in plugin "plugin1" which is
defining the mentioned extension point and instantiating the executable.

But I think this is a common case, isn't it?

Maybe also special: I trigger the instantiation not in the plugin
activator but instead when an action is executed in the workbench
(i.e. a button is pressed in the menu)

Jan
Re: Exposing own extension in plugin fails in runtime (fixed!) [message #300168 is a reply to message #300161] Fri, 03 March 2006 03:40 Go to previous messageGo to next message
Eclipse UserFriend
*Phew* I solved it.

The problem was that I in the Constructore code of xxx.Foo I pass
another class from plugin2 to the super class which is in plugin1.

Inside that super constructor I used Class.forName and did not care
the classloader fo the passed class.

Now it works fine!

> Paul,
>
> sorry to reopen this topic but I have a similar problem.
>
> I have more or less the same situation and the same exception:
>
> Plug-in "plugin2" was unable to instantiate class "xxx.Foo".
>
> java.lang.ClassNotFoundException: zzz.Bar
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:404)
>
> at
> org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader. loadClass(AbstractClassLoader.java:93)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)...
Re: Exposing own extension in plugin fails in runtime (fixed!) [message #300173 is a reply to message #300168] Fri, 03 March 2006 06:46 Go to previous message
Eclipse UserFriend
Originally posted by: paulnews.gmail.com

Jan Mauersberger wrote:
> *Phew* I solved it.

*Phew* :-)

PW
Previous Topic:PropertyDialogAction problem
Next Topic:problems installing plugins with Eclipse 3.1.2 on Linux FC4: core.resources missing
Goto Forum:
  


Current Time: Fri Jun 20 16:16:05 EDT 2025

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

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

Back to the top