You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andreas Mucha <si...@gmx.net> on 2009/06/03 12:04:24 UTC

Re: strange class cast exception

hello karl,

sorry for the late response.
finally a solved the problem.

the reason for the class cast exception is
that the same class was loaded more than one time
by different class loaders. 
some look-and-feel implementaions make some strange assumptions
about exsisting class loaders.

i solved the problem by configuring the look-and-feel
packages in the felix - config file in the parameter
org.osgi.framework.system.packages.extra .
then i simply added the lokkandfeel.jar to the normal
classpath. 

i found out, that this is not necessary for all look-and-feels.
for the lipstik lf it was necessary.
but the very cool and simple tonic-lf for instance 
can be used as class bundle .

the jdk6 builtin lfs can be used without any problems
because they are part of the system bundle .

thanks and regards
andreas .

-------- Original-Nachricht --------
> Datum: Fri, 29 May 2009 12:06:39 +0200
> Von: Karl Pauls <ka...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: strange class cast exception

> Can you show us the manifest of your bundle please?
> 
> regards,
> 
> Karl
> 
> On Fri, May 29, 2009 at 12:04 PM, Andreas Mucha <si...@gmx.net> wrote:
> > hello all,
> >
> > i have a little bundle which displays some swing gui.
> > at first i figured out, that the only suitable way
> > to install an own look and feel is
> UIManager.setLookAndFeel("classname").
> > UIManager.setLookAndFeel(new LF()) will not work due to osgi class
> > loading mechanism.
> >
> > so i installed a little look and feel :
> > UIManager.setLookAndFeel("com.lipstikLF.LipstikLookAndFeel");
> > after this i tryed to set a theme to this lf.
> > the lipstick lf provides a static method to do this :
> > LipstikLookAndFeel.setMyCurrentTheme(...) .
> > but this has no effect. (i guess it has also something to do with
> > correct/incorrect class loading)
> >
> > so i tryed to access the lf :
> > ((LipstikLookAndFeel)UIManager.getLookAndFeel()).callSomeMethod
> >
> > now i get this strange exception :
> >
> > java.lang.ClassCastException: com.lipstikLF.LipstikLookAndFeel cannot be
> cast to com.lipstikLF.LipstikLookAndFeel
> >        at ...
> >
> > any ideas about that strange behaviour ??
> >
> > thanks in advance
> > andreas .
> >
> > my setup : winxp, eclipse 3.4.2 jdk1.6.13, felix 1.8.0.
> > to create bundles from jars i used : bnd wrap <jarfile> (no other
> options)
> > --
> > Nur bis 31.05.: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
> > Telefonanschluss nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> 
> 
> 
> -- 
> Karl Pauls
> karlpauls@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

-- 
GMX FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss nur 17,95 Euro/mtl.!
http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a

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