On 1/1/13 06:12, itay hindy wrote:
Ignore my last mail, I figure it out. It was because of activators order.
Another question, I manage now to run the war that used the embedded felix.
I try to execute http requests but fail on the the ProxyServlet. The
DispatcherTracker has not been initialize so this.tracker.getDispatcher()
returns null.
How can I activate it?
Sorry, I don't know what you are talking about.
-> richard
Thanks in advance
On Tue, Jan 1, 2013 at 10:10 AM, itay hindy <[email protected]> wrote:
Thanks Richard, I followed your advice and make it works.
Now I have a new Issue:
I try to use *bundle.update() *and I get next exception:
*Caused by: java.net.MalformedURLException: Unknown protocol: obr
*
When I run felix *not *embedded from tomcat everything works.
I looked into it and the problem seems to be that when running embedded
felix within tomcat the URLHandlersStreamHandlerProxy class is not used.
The next line:
*return new URL(context, "obr:...", handler)*
for embedded felix just tries to create url while for stand alone felix it
uses the URLHandlersStreamHandlerProxy.
Any Idea how to config it?
On Thu, Dec 27, 2012 at 4:08 PM, Richard S. Hall <[email protected]>wrote:
On 12/27/12 07:25, itay hindy wrote:
Hi All,
I have a question about running embedded felix within tomcat.
I had follow the instructions at
http://felix.apache.org/site/**apache-felix-framework-**
launching-and-embedding.html<http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html>
I manage to run felix within tomcat, however I have a problem with class
loaders.
Here is the scenario:
1 - My host application needs to use the RepositoryAdmin service
from org.apache.felix.**bundlerepository-1.6.6.jar bundle
2 - I add the org.apache.felix.**bundlerepository-1.6.6.jar to my class
path
so I can access its interfaces
3 - I install this bundle on my host application activator code
URL url =
this.servletContext.**getResource("/WEB-INF/lib/org.**
apache.felix.bundlerepository-**1.6.6.jar");
Bundle bundle = context.installBundle(url.**toExternalForm());
bundle.start();
4 - I have created ServiceTracker for the RepositoryAdmin service
5 - In the ServiceTracker the next bold line fails with class cast
exception
public Object addingService(ServiceReference reference) {
Object serviceObject = super.addingService(reference)**
;
try {
*repositoryAdmin = (RepositoryAdmin)**
serviceObject*;
} catch (Exception e) {
e.printStackTrace();
}
return repositoryAdmin;
}
The reason seems to be because RepositoryAdmin interface classloader
comes
from org.apache.catalina.loader.**WebappClassLoader and the
actual RepositoryAdminImpl object (the *serviceObject*) is coming from
BundleWiringImpl$**BundleClassLoaderJava5
Yes, of course. The bundle doesn't have access to your outer repository
classes and your host doesn't have access to the bundle's repository
classes.
You will need to try to export the repository packages from your host app
via the system bundle. Of course, this will only work if the repository
bundle properly imports AND exports the repository packages. Even if it
does, it is tricky and might not work if there are any "uses" constraint
issues, but you could try. If that doesn't work, you could look into boot
delegating the packages from your class path, but that is a last resort.
-> richard
Any Idea?
Regards,
Itay Hindy
------------------------------**------------------------------**---------
To unsubscribe, e-mail:
users-unsubscribe@felix.**apache.org<[email protected]>
For additional commands, e-mail: [email protected]
--
Regards,
Itay Hindy
Software Solutions
+972-54-5935042
linkedin: http://www.linkedin.com/in/itayhindy
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]