felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From itay hindy <itay.hi...@gmail.com>
Subject Re: Configuration for multiple tomcat wars each with embedded felix
Date Wed, 02 Jan 2013 16:03:38 GMT
Thanks Karl,

I upgraded from 4.0.2 to 4.0.3

Now I have an exception for the second war: *java.lang.Error: factory
already defined *and the bundle *does not start*.

Probably because in URLHandlers

*try*
* {*
*     URL.setURLStreamHandlerFactory(currentFactory);*
*  }*
*  catch (Exception ex)*
*  {*
*      // Ignore, this is a best effort (maybe log it or something)*
*  }*

and in *URL.setURLStreamHandlerFactory*
if (factory != null) {
throw new Error("factory already defined");
}

So I can not have 2 wars both with *felix.service.urlhandlers*=true?

On Wed, Jan 2, 2013 at 5:48 PM, Karl Pauls <karlpauls@gmail.com> wrote:

> did you try with the latest felix trunk? That should at least fix your
> urlhandlers issue...
>
> regards,
>
> Karl
>
>
> On Wed, Jan 2, 2013 at 4:41 PM, itay hindy <itay.hindy@gmail.com> wrote:
>
> > Hi,
> >
> > I have tomcat war with embedded felix and it works great. I took it from
> > the
> > instructions at
> >
> >
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
> >
> > I am trying to run now multiple wars each with felix embedded. I am
> having
> > some problems:
> >
> > 1 - I configure *felix.cache.rootdir* for each war to be different. Is it
> > correct?
> > 2 - what should be the  *felix.service.urlhandlers* property? When I put
> it
> > *true *the first war works great and the second one fails with *Unknown
> > protocol: obr*. This is because inside *URLHandlers *class the
> > *m_streamHandlerFactory
> > *field is different between the first and second war. So should *
> > felix.service.urlhandlers* be *false*? in that case what should be the j*
> > ava.protocol.handler.pkgs*?
> > 3 - The next lines:
> > *        url =
> >
> >
>  this.servletContext.getResource("/WEB-INF/lib/org.apache.felix.http.bridge-2.2.0.jar");
> > *
> > *     bundle = context.installBundle(url.toExternalForm());*
> > *     bundle.start(); *
> > works for the first war but for the second I get:
> > ERROR: Bundle org.apache.felix.http.bridge [2] Error starting
> >
> jndi:/localhost/itay/qa/WEB-INF/lib/org.apache.felix.http.bridge-2.2.0.jar
> > (org.osgi.framework.BundleException: Activator start error in bundle
> > org.apache.felix.http.bridge [2].)
> > java.lang.LinkageError: loader constraint violation: when resolving
> > overridden method
> >
> >
> "org.apache.felix.http.base.internal.listener.AbstractListenerManager.addingService(Lorg/osgi/framework/ServiceReference;)Ljava/lang/Object;"
> > the class lo
> > ader (instance of
> > org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of
> the
> > current class,
> > org/apache/felix/http/base/internal/listener/AbstractListenerManager, and
> > its superclass loader (instance of org/apache/catalina/loa
> > der/WebappClassLoader), have different Class objects for the type
> > org/osgi/framework/ServiceReference used in the signature
> >         at
> >
> >
> org.apache.felix.http.base.internal.HttpServiceController.<init>(HttpServiceController.java:76)
> >
> >
> > Does anyone have an example for multiple wars each with felix embedded?
> >
> > Thanks in advance.
> >
> > --
> > Regards,
> >
> > Itay Hindy
> > Software Solutions
> > +972-54-5935042
> > linkedin: http://www.linkedin.com/in/itayhindy
> >
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
> http://twitter.com/karlpauls
> http://www.linkedin.com/in/karlpauls
> https://profiles.google.com/karlpauls
>



-- 
Regards,

Itay Hindy
Software Solutions
+972-54-5935042
linkedin: http://www.linkedin.com/in/itayhindy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message