felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Moloney <t.molo...@verizon.net>
Subject Re: How do I avoid ClassCastExceptions with a split package?
Date Mon, 14 Jul 2008 17:51:56 GMT
Tim Moloney wrote:
> I'm trying to get cometd working with Felix.  I believe that I have it 
> mostly working but I'm getting a ClassCastException on cometd 
> requests, specifically "can not cast 
> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation to 
> org.mortbay.util.ajax.Continuation" (this is from memory so it may be 
> a bit off).  I think that this is a classloader issue since the 
> RetryContinuation class implements the Continuation interface.  I know 
> that split packages can cause ClassCastExceptions due to different 
> classloaders but I'm not sure this is the problem.
> I'm using the following bundles:
> - org.apache.felix:org.apache.felix.http.jetty:0.9.0-SNAPSHOT 
> (modified to use jetty 6.1.11)
> - org.mortbay.jetty:jetty:6.1.11
> - org.mortbay.jetty:jetty-util:6.1.11
> - org.mortbay.jetty:servlet-api-2.5:6.1.11
> - a custom comet bundle that
>  - inlines org.mortbay.jetty:cometd-api:0.9.20080221and 
> org.mortbay.jetty:cometd-bayeux:6.1.11
>  - maps org.mortbay.cometd.continuation.ContinuationCometdServlet to 
> /cometd
> jetty-util exports org.mortbay.util but cometd-bayeux has 
> org.mortbay.util.ArrayQueue.  I managed to get my custom comet bundle 
> to compile by making org.mortbay.util a private package.  However, 
> this duplicates all of org.mortbay.util in my bundle which I think is 
> causing the ClassCastException.
> What is the best way to handle the split package and avoid 
> ClassCastExceptions?
> Tim

I found the split-package command in the bnd documentation.  I tried 
both merge-first and merge-last but I still got the 
ClassCastExceptions.  I think this is because the org.mortbay.util 
package was still being duplicated in my bundle.  I then tried first 
which only copied org.mortbay.util.ArrayQueue into my bundle but then 
the rest of org.mortbay.util couldn't be found.  I finally tried using 
the following but I'm still getting the original ClassCastExceptions.



I'm out of ideas.  Does anyone have any suggestions?


View raw message