On 7 Jul 2011, at 14:42, Richard S. Hall wrote:

> On 7/7/11 5:39, Elvy wrote:
>> 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.
> 
> Are you saying that if you go back to 1.4.0 then it starts to work? If so, 
> can't you compare the two manifests to see what's different between the two 
> and see if you can make the second like the first?

also check what's actually in the bundle (ie. use "unzip -l" or "jar tvf" on 
it) because 2.3.4 sees the complete transitive dependency list whereas 1.4.0 
didn't, so you could be embedding more now:

   
http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html#ApacheFelixBundlePluginFAQ-WhydoIseemoreclassesinmybundleafterupgradingtomavenbundleplugin2.0.0%253F
 

> -> richard
> 
>> 
>> 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!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to