I am trying out the Declarative Services functionality from the equinox
3.4 I20071023-0800 build and am running into some class loading problems.
I have a bundle that winds up affecting some Swing classes (menu items).
It produces errors now that I have switched it to use DS instead of the
Service Activator Toolkit. The error is:
UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JMenuItem
...
This has to do with Swing not being able to find the correct UI classes if
you are not using the default LaF. (Just changing it to the System LaF is
enough to produce this.)
My question is this: Why does this happen with DS and not with the SAT?
Is DS ignoring the bundle's DynamicImport-Package: * statement? (This is
the only way I've found to solve these issues.)
I have the same error if I use Java Swing inside bundles. If I start my bundle activator without Spring DM, all work good. But as far as I use Spring DM, I get always this UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel... errors.
But I found a solution on this post: www.eclipse.org/forums/index.php/mv/msg/142233/448472/#msg_448472
On 09.10.2011 3:10, pfxo wrote:
> I have the same error if I use Java Swing inside bundles. If I start my
> bundle activator without Spring DM, all work good. But as far as I use
> Spring DM, I get always this UIDefaults.getUI() failed: no ComponentUI
> class for: javax.swing.JPanel... errors.
>
> But I found a solution on this post:
> www.eclipse.org/forums/index.php/mv/msg/142233/448472/#msg_448472
>
> You need to write UIManager.put("ClassLoader",
> getClass().getClassLoader()); before you use Swing. I don't know why
> this error happen only in coherence with Spring DM.