NoClassDefFoundError error on a Netbeans application using OSGi #7601
Replies: 4 comments 16 replies
-
@ebarboni, @mbien sorry for tagging you (I don't know who else to annoy 😝) but I'd like to know if it's sound like a bug (and then I'm happy to work on it) or if it's a bad practice on my side. Would you have a quick look and share your thoughts please ? |
Beta Was this translation helpful? Give feedback.
-
Please provide a minimal sample. Guessing does not help. |
Beta Was this translation helpful? Give feedback.
-
There is one attached in the initial message |
Beta Was this translation helpful? Give feedback.
-
It sounds like a NB issue rather than a bad design so I created the pull request #7624 |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm facing exceptions at the startup of a Netbeans application based on Maven and using OSGi.
This is a sample project to reproduce the issue I'm facing : my-application.zip
nbm-application
with OSGi enabledA
B extends A
A
ModuleInstall
where we inject an instance ofB
to the singleton aboveThe project is failing in the application unit test do to the issue but it's easier to run it in debug to troubleshot.
At startup, manifests are read and it looks like the OSGi export packages are correctly initialised in the
org.netbeans.ModuleData
as I can see them inprovides
Then we go through the
org.netbeans.ModuleManager.doEnable()
and it looks like we don't have the same process for OSGi modules and for Netbeans ones.Netbeans modules are looking for their public packages and register them in the
ProxyClassPackages
OSGi modules are doing something quite similar but don't register their export packages in the
ProxyClassPackages
As a result, when my NBM module is starting, it tries to load the class
A
defined in my OSGi module.As export packages were not registered, we don't find them in the
ProxyClassPackages
and the exception is thrown.From my understanding it looks like there is an issue in the way we are managing OSGi modules but I'm opening this discussion to validate that I got it right.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions