Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:24:40+00:00 2026-05-25T18:24:40+00:00

According to the OSGi documentation, OSGi is designed to help prevent ClassPath problems. For

  • 0

According to the OSGi documentation, OSGi is designed to help prevent ClassPath problems.

For example, from “OSGi in action”:

ClassNotFoundExceptions when starting your application because the
class path wasn’t correct. OSGi can help by ensuring that code
dependencies are satisfied before allowing the code to execute.

However, since we’ve switched our java application to OSGi, I see more ClassNotFoundExceptions and especially NoClassDefFoundErrors than ever. Classes that were previously loading fine are not found anymore by the OSGI classloader, and worse: you get the error at run-time, which means that you can’t easily check for it except by manually testing every corner of your application.

For example, our application was running happily under OSGi, but we received reports from beta testers that they couldn’t export documents to PDF anymore. Indeed, when I looked into it, I found that this functionality caused an exception to be logged:

java.lang.NoClassDefFoundError: org/w3c/dom/Node

So, is OSGi actually creating more classpath problems than it solves?

and more importantly: How can I test that my class-path is consistent, with all necessary Import-Package statements etc. before I read about them in bug reports?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:24:41+00:00Added an answer on May 25, 2026 at 6:24 pm

    An OSGi application will not throw ClassNotFoundExceptions and NoClassDefFoundErrors if your manifest is correct. That is, you need to tell OSGi which packages your bundle uses; if you don’t do this correctly or honestly, then OSGi cannot help you. In other words: GIGO (Garbage In, Garbage Out).

    For example, you use the package org.w3c.dom but you do not list it in your Import-Package statement. Therefore OSGi does not know that you need access to that package, and so when you actually try to load classes from that package, they are not available.

    So, you need to make sure your Import-Package statement is accurate with respect to the packages your bundles actually use. The good news is that the “bnd” tool can do this for you by generating the bundle manifest, using bytecode analysis to find all the statically referenced packages.

    Update:
    Your final question asks how to test that your bundles are consistent before discovering problems at runtime. Bnd has a “verify” feature that does exactly this. Actually if you use Bnd to generate the manifest in the first place, then you will not need the verify feature. However, I don’t know anything about your build process so you might find it difficult to move to a Bnd-based build in the short term… in this case it would be relatively simple to add the verification task as a post-processing step after the build. However I would still recommend trying to use Bnd earlier in the build process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and
According to the feedparser documentation , I can turn an RSS feed into a
According to the Ruby Set class's documentation, == Returns true if two sets are
according to the twitter api documentation http://dev.twitter.com/doc/get/statuses/user_timeline accessing the current logged in users timeline
I'm new to OSGi and am building a first DS-implementation. Everything is coded according
I'm currently facing an interesting problem in my OSGi application. I'm implementing a configuration
According documentation: System.Array.Sort<T> - sorts the elements in an entire System.Array using the System.IComparable
According to the documentation , Zend Lucene is supposed to sort lexicographically. I am
According to the documentation i would like to overwrite predefined formats using this settings:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.