Hi Saminda,

Maybe this will inspire you:
https://scm.ops4j.org/repos/ops4j/projects/pax/runner/pax-runner-handler/src/main/java/org/ops4j/pax/runner/handler/internal/

I do not know your time frame about starting Felix from a servlet, but
we have have plans to support this in Pax Runner:
http://issues.ops4j.org/jira/browse/PAXRUNNER-91
Yet I did not do that since there was not to much interest in it.

Cheers,
Alin

On Tue, Mar 4, 2008 at 1:35 AM, Saminda Abeyruwan <[EMAIL PROTECTED]> wrote:
> Hi Devs,
>
>  I've a use case where, embed Felix instance needed to be started from a
>  servlet. I wrote the the code  and tried to initialize embed Felix  from the
>  servelt using load-on-startup. I happen to receive the following exception,
>
>  java.lang.Error: factory already defined
>         at java.net.URL.setURLStreamHandlerFactory(URL.java:1074)
>         at org.apache.felix.framework.URLHandlers.<init>(URLHandlers.java
>  :95)
>         at org.apache.felix.framework.URLHandlers.registerInstance(
>  URLHandlers.java:299)
>         at org.apache.felix.framework.URLHandlersActivator.start(
>  URLHandlersActivator.java:60)
>         at org.apache.felix.framework.util.SecureAction.startActivator(
>  SecureAction.java:589)
>         at org.apache.felix.framework.Felix$SystemBundleActivator.start(
>  Felix.java:3771)
>         at org.apache.felix.framework.util.SecureAction.startActivator(
>  SecureAction.java:589)
>
>
>  Thus, the problem lies with URLHandlers.java:95, where it does the
>  URL.setURLStreamHandlerFactory(this);
>
>  When my servlet engine started (Tomcat), it also set the "factory" (which is
>  beyond my control) in
>  java.net.URLConnection.
>
>  Thus, calling URL.setURLStreamHandlerFactory(this) ; from URLHandlers.java:95
>  caused "the factory already defined" error.
>
>  Is there a workaround to solve this problem from Felix.
>
>  Thank you
>
>  Saminda
>   --
>  Saminda Abeyruwan
>
>  Senior Software Engineer
>  WSO2 Inc. - www.wso2.org
>

Reply via email to