You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Elvy <lu...@fr.thalesgroup.com> on 2011/07/07 11:39:26 UTC

"SynthLookAndFeel" NoClassDefFound

this is a kind of follow-up to 
http://old.nabble.com/Look-And-Feel-tt16896587.html this thread ...

The following situation happened when I switched from maven-bundle-plugin
1.4.0 to 2.3.4.


I'm using the  http://www.jidesoft.com Jide Product  and they have a jar
with their Synthetica UI delegates. As far as packages are concerned, this
jar contains these two:
 - com.jidesoft.plat.synthetica
 - javax.swing.plat.synth


Those familiar with Synthetica noticed that the package
"javax.swing.plat.synth" is already part of the JDK (in rt.jar). There is
only one class in their package. They say that until JDK7 they need to do
this because they need access to certain methods not yet visible.

I added this jar to my pom.xml dependencies (runtime scope) and when I
started felix (v3.0.8), I got a NoClassDefFound on the class
SynthLookAndFeel. 


java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:1042)
        at
javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1326)
        {...}
Caused by: java.lang.NoClassDefFoundError:
javax/swing/plaf/synth/SynthLookAndFeel
        at com.jidesoft.plaf.basic.BasicJideButtonUI.updateMargin(Unknown
Source)
        at com.jidesoft.plaf.basic.BasicJideButtonUI.installDefaults(Unknown
Source)
        at com.jidesoft.plaf.basic.BasicJideButtonUI.installUI(Unknown
Source)
        at javax.swing.JComponent.setUI(JComponent.java:662)
        at com.jidesoft.swing.JideButton.updateUI(Unknown Source)
        at
com.jidesoft.plaf.basic.BasicCommandBarTitleBarUI$a_.updateUI(Unknown
Source)
        at javax.swing.AbstractButton.init(AbstractButton.java:2149)
        at javax.swing.JButton.<init>(JButton.java:118)
        at javax.swing.JButton.<init>(JButton.java:73)
        at com.jidesoft.swing.JideButton.<init>(Unknown Source)
        at com.jidesoft.swing.JideButton.<init>(Unknown Source)
        at
com.jidesoft.plaf.basic.BasicCommandBarTitleBarUI$a_.<init>(Unknown Source)
        at
com.jidesoft.plaf.basic.BasicCommandBarTitleBarUI.installComponents(Unknown
Source)
        at
com.jidesoft.plaf.basic.BasicCommandBarTitleBarUI.installUI(Unknown Source)
        at javax.swing.JComponent.setUI(JComponent.java:662)
        at javax.swing.JMenuBar.setUI(JMenuBar.java:118)
        at com.jidesoft.action.CommandBarTitleBar.setUI(Unknown Source)
        at com.jidesoft.action.CommandBarTitleBar.updateUI(Unknown Source)
        at javax.swing.JMenuBar.<init>(JMenuBar.java:95)
        at com.jidesoft.action.CommandBarTitleBar.<init>(Unknown Source)
        at
com.jidesoft.plaf.basic.BasicCommandBarUI.installComponents(Unknown Source)
        at com.jidesoft.plaf.basic.BasicCommandBarUI.installUI(Unknown
Source)
        at javax.swing.JComponent.setUI(JComponent.java:662)
        at com.jidesoft.action.CommandBar.updateUI(Unknown Source)
        at javax.swing.JMenuBar.<init>(JMenuBar.java:95)
        at com.jidesoft.action.DockableBar.<init>(Unknown Source)
        at com.jidesoft.action.CommandBar.<init>(Unknown Source)
        at com.jidesoft.action.CommandBar.<init>(Unknown Source)
        at com.jidesoft.action.CommandMenuBar.<init>(Unknown Source)
        {...}
Caused by: java.lang.ClassNotFoundException:
javax.swing.plaf.synth.SynthLookAndFeel not found by myBundle [13]
        at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
        at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
        at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 51 more



For my felix to start, I now need to set the boot delegation (in
config.properties) as:
org.osgi.framework.bootdelegation=javax.swing.plaf.*,sun.*,com.sun.*


Here's my maven-bundle-plugin configuration (if relevent):

<plugin>
   <groupId>org.apache.felix</groupId>
   <artifactId>maven-bundle-plugin</artifactId>
   <extensions>true</extensions>
   <configuration>
      <instructions>
         <Bundle-Name>...</Bundle-Name>
         <Bundle-Version>${project.version}</Bundle-Version>
         <Private-Package>mypackage.osgi</Private-Package>
         <_exportcontents>
                            com.jidesoft.*,
                            net.miginfocom.*,
                            org.apache.commons.logging.*,
                            org.apache.poi.*
         </_exportcontents>
         <Import-Package>*;resolution:=optional</Import-Package>
        
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
         <Embed-Transitive>true</Embed-Transitive>
        
<Service-Component>OSGI-INF/service-component.xml</Service-Component>
         <Include-Resource>{maven-resources}</Include-Resource>
         <Bundle-NativeCode> ... </Bundle-NativeCode>
        
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
         <Implementation-Vendor>...</Implementation-Vendor>
         <Implementation-Version>${project.version}</Implementation-Version>
      </instructions>
   </configuration>
</plugin>



I don't fully understand neither the problem nor the solution. Shouldn't
class loaders "communicate" until the desired class is found?

Is this the correct solution? 

Just so you know, in the bundle activator, I set the Swing classloader to my
OSGi classloader with         UIManager.put("ClassLoader",
bundleContext.getClass().getClassLoader());


Regards

-----
Tell me something you don't know!
-- 
View this message in context: http://old.nabble.com/%22SynthLookAndFeel%22-NoClassDefFound-tp32011741p32011741.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org