Hello,

I have problems to embed a felix (version 1.0)
container in a java web application deployed on a
Tomcat server (version 5.5).
In order to start/stop the container, I use a
ServletContext listener as follow:

public class WebAppListener implements
ServletContextListener {
    private OsgiManager osgiManager = new
FelixManager();

    public void contextInitialized(ServletContextEvent
context) {
        osgiManager.initOsgi();
    }

    public void contextDestroyed(ServletContextEvent
context) {
        osgiManager.destroyOsgi();
    }
}

and the code of the initOsgi method is:

public void initOsgi() {
    Map configMap = new StringMap(false);
   
configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP,
"true");
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
            "org.osgi.framework; version=1.3.0," +
            "org.osgi.service.packageadmin;
version=1.2.0," +
            "org.osgi.service.startlevel;
version=1.0.0," +
            "org.osgi.service.url; version=1.0.0");
configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP,
"cache");
        
try {
    List activators = new ArrayList();
    initActivator = new InitActivator();
    activators.add(initActivator);

    felixContainer = new Felix(configMap, activators);
    felixContainer.start();         
} catch(Exception ex) {
    ex.printStackTrace();
}

I have the following error when the webapp starts:

ERROR: Unable to start system bundle.
(java.lang.Error: factory already defined)
java.lang.Error: factory already defined
        at
java.net.URL.setURLStreamHandlerFactory(URL.java:1076)
        at
org.apache.felix.framework.URLHandlers.<init>(URLHandlers.java:95)
        at
org.apache.felix.framework.URLHandlers.registerInstance(URLHandlers.java:283)
        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:3798)
        at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
        at
org.apache.felix.framework.Felix.start(Felix.java:703)

Is there specific configuration to do in order to
embed Felix in a web application?

Thanks a lot for your help?
Thierry

Take a look at my blog:
http://jroller.com/page/Templth/
(old: http://templth.blogspot.com/)


      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to