JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

Apache Felix Framework Frequently Asked Questions

Topic :
Feedback Request New QnA Print Email

When I update my bundle, why are my bundle's old classes still being used?

See the answer in the OSGi FAQ.

Why do I get an "Unknown protocol: http" exception when I run Felix on a non-Sun JRE?

Felix installs the URL Handlers service by default. If you do not want this service you can disable it, by setting the felix.service.urlhandlers property to false in the file. It is not recommended to disable this, but the main reason for doing so it because the URL Handlers implementation invokes methods to set the singleton factories for URL stream and content handler factories. Assuming that you want to use URL Handlers service, you must configure it if you aren't running on the standard Sun JRE.

The URL Handlers service extends the standard Java URL stream and content handler mechanism to work in an OSGi environment. The way that built-in URL protocol and content handlers are discovered is by probing packages for the appropriate classes to handle the protocol/content. For example, the default package for Sun protocol handlers is:

If someone tries to create a URL for the "http" protocol, then the class to handle the protocol will be:

A similar process is followed for content handlers, whose default package is:

If you are running on a VM that is different than Sun's, then you must determine what are the default packages used for its protocol and content handlers. Once you know this information, then you can configure Felix to use those packages instead of the default one. You can configure Felix by setting the following system properties:




The value of these properties is a list of "|" delimited package names to be searched for protocol and content handlers, respectively. See the Java documentation for stream and content handlers for more information.

There are two ways to set these system properties. The first way is using the standard -D<property>=<value> syntax when executing java or if you are using Felix' standard launcher, you can put the system properties into the conf/ file so that they get set automatically each time you execute Felix.

What is the daemon status of framework created threads?

The framework creates a few threads for handling specific tasks, such as event delivery or handling start level change requests. All framework threads are explicitly started as daemon threads except the event dispatcher thread. The logic behind this is that the event dispatcher thread should exit when it is done delivering events. However, if an application is hosting an instance of the framework, it is possible to make the event dispatcher thread a daemon by starting your framework instance from a daemon thread, in which case the event dispatcher thread will inherit this setting.

For bundle developers, it is probably best to explicitly define any created threads as daemon or non-daemon to avoid any ambiguity.

Topic :
Feedback Request New QnA Print Email

All api java java 6.0 java 7.0 jdbc jsp servlet ejb jndi jms ejb 3.0 j2ee jee 5.0 jee 6.0 jsf struts spring Hibernate ajax JBoss Seam netbeans eclipse ant xml maven dojo junit javafx j2me log4j ESB JBoss Apache Quartz scjp mysql oracle gwt openjpa jmx yui google-guice android JBoss scwcd 5.0 scjp 1.5 scjp 1.6 scja scbcd 5.0

javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat