Troubleshooting tips

When encountering an error, or when the application is not behaving the way you're expecting it to, you engage in the exercise of hunting the problem down and trying to find its root cause in order to fix it.

The following gives a few tips to help you troubleshoot issues you may encounter during the development and testing of a bundle on an OSGi framework, in general, or on Felix, in specific.

How to get debug logs from the Felix Log Service

Although the OSGi specifications provide a clear definition of how to log messages with a Log Service, it does not set any constraint on how to configure the Log Service filter levels. This is normal, as it is specific to the implementation.

The configuration of the level of logs that's included in a Log Reader Service implementation differs among providers. The Apache Felix Log Service properties are configured in the config.properties file under the config directory of the Felix framework instance. The properties are as follows:

  • org.apache.felix.log.maxSize: Holds the maximum number of log entries to keep in memory at a given time, set to -1 for 'no maximum size'
  • org.apache.felix.log.storeDebug: Is a boolean (true or false) that instructs the service to hold or ignore debug log messages

If you would also like to see debug messages, set the storeDebug property to true.

Note that setting the maxSize to -1 or storeDebug to true may have a counter impact on performance and memory consumption. It should only be done in a restricted time frame, for example, while troubleshooting an issue.

Tip

Have a look at Chapter 10 for more on logging.

How can remote debugging help

Remote debugging allows you to connect to a running remote framework and control its execution flow. By setting breakpoints in the debugger's source code viewer, the execution pauses at specific expressions in the code. It then allows you to step through the execution flow, statement by statement, inspecting the variable values and potentially changing them in some situations.

To set up the JVM running the framework with the previous configuration, the following command-line parameters are included:

java
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
-Xdebug -jar bin/felix.jar

The suspend=n requests that the JVM not wait for the remote debugger to connect before starting the application.

Tip

Refer to Appendix A, Eclipse, Maven, and Felix, for a more detailed, step-by-step set of instructions for using Eclipse as a remote debugging tool, as well as for running Felix, embedded in Eclipse.

Where to get answers online

There's no doubt that the web has the biggest wealth of information. When you encounter a problem, chances are someone else has encountered it already and has posted a question on one of the many available forums. When stuck with an issue, Google it!

You'll find useful material on provider online documentation pages, FAQs, blogs, discussion forums, and so on. If you've searched thoroughly and have not found the answer to your queries, then consider posting questions to relevant forums yourself.

Tip

Discussion forums are a very good source of information. However, be sure to really do your research before posting a message on a forum. As much as forum lurkers want to be helpful and will do their best to assist, it is frustrating to answer questions that can be found through a few online searches.

The following are a few sites, among many others, that are a good source of information:

  • OSGi Alliance site, www.osgi.org, where you can find specifications, white papers, interesting articles, and links to forums and local user groups
  • Apache Felix project site, felix.apache.org, with online documentation and information on its mailing lists
  • Open OSGi Forum and Discussion Central, www.osgiforum.com
  • OSGi Users' Forums, www.orgiusers.org
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.250.203