btw, I've raised FELIX-358 on this[1].
[1] https://issues.apache.org/jira/browse/FELIX-358
2007/9/7, Yang Paulex <[EMAIL PROTECTED]>:
>
> Hi, All
>
> I saw this topic on felix dev-list today, and interestingly I just tried
> it last week, this is what I found, FYI: (Sorry, I just subscribe the list
> today so I had to create a new thread on this topic)
>
> Basically Felix cannot run on Harmony out-of-box, whatever version of
> Felix/Harmony I'm using (I tried milestone builds, build from trunk....etc
> for Felix/Harmony respectively), or whatever trying to create a new profile
> or just use existing one, and the most sensible message is
> StackOverflowError, which shows that: Felix provides a
> URLStreamHandlerFactory, which tried to delegate URLs with well known
> protocal like "http" to JSE built in handlers, while on Harmony it failed
> and falled back to Felix's factory again, and then the factory asked for the
> builtin handler again, thus results in a loop.
>
> After some tracing, I finally found these two constants in
> framework/src/main/java/org/apache/felix/framework/URLHandlers.java:
> private static final String DEFAULT_STREAM_HANDLER_PACKAGE = "
> sun.net.www.protocol ";
> private static final String DEFAULT_CONTENT_HANDLER_PACKAGE = "
> sun.net.www.content";
>
> IIUC, the two constants are default URLStreamHandler/ContentHandler
> implementation's package prefix in Sun JDK. And changing it to corresponding
> Harmony ones make Felix run on Harmony happily:
>
> private static final String DEFAULT_STREAM_HANDLER_PACKAGE = "
> org.apache.harmony.luni.internal.net.www.protocol";
> private static final String DEFAULT_CONTENT_HANDLER_PACKAGE = "
> org.apache.harmony.luni.internal.net.www.content ";
>
> I tried to provide a simple patch to make it work on both Harmony and Sun
> JDK but failed to find a clue easily so far...the reason is that JSE doesn't
> provide a API to get the default URLStream/ContentHandler implementation, so
> that Felix's URLHandler, which tried to provide a customized
> URLStreamHandlerFactory for "felix" protocal IIUC, must explicitly access
> JSE built in handlers via
> Class.forName(DEFAULT_STREAM_HANDLER_PACKAGE+"blabla").
>
>
> My current thoughts is, is it possible for Felix's URLHandlers.java to
> only handle the Felix interested protocals("Felix://"?), and just ignore
> others (return null in createURLStreamHandler()), and actually
> java.net.URL will try to handle them with builtin URLStreamHandlers. If I
> find some time recently, I'll try if this works. But I'd like to hear from
> Felix guru at first if this has any potential problems, i.e., it may be
> intentional behavior to load JSE built in handlers at first.
>
> Hopefully this makes sense:).
>
>
> --
> Paulex Yang
> China Software Development laboratory
> IBM
--
Paulex Yang
China Software Development Lab
IBM