Bug 577018 - NoClassDefFoundError: javax/management/MalformedObjectNameException (in osgi)
Summary: NoClassDefFoundError: javax/management/MalformedObjectNameException (in osgi)
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 5.13.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-02 21:29 EDT by junghyun lee CLA
Modified: 2022-08-06 11:59 EDT (History)
3 users (show)

See Also:


Attachments
capture (188.57 KB, image/png)
2021-11-02 21:29 EDT, junghyun lee CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description junghyun lee CLA 2021-11-02 21:29:57 EDT
Created attachment 287430 [details]
capture

The corresponding error occurs when using the pull command of jgit within the osgi bundle.

========================================================================
java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException
 at org.eclipse.jgit.internal.storage.file.WindowCache.publishMBeanIfNeeded(WindowCache.java:485)
...
(check attachment)
========================================================================

As a result of the inspection, it seems that the jgit bundle failed to import the javax.management package.

When I wrote the javax.management package in the jgit's manifest file in import-package, I confirmed that it worked normally.

Please check this bug. thank you
Comment 1 Matthias Sohn CLA 2021-11-03 05:29:19 EDT
Which java version do you use ?
Do you run jgit in an OSGi runtime or using plain Java ?

If you run jgit on Java 9 or later you may need to add a dependency to your application to the javax.management module.
Comment 2 Johan Anas CLA 2022-06-17 06:23:19 EDT
Using OSGi, We also get this problem with jgit version 6.2.0.202206071550-r:

SEVERE [org.openide.util.Exceptions]
java.lang.ClassNotFoundException: javax.management.MalformedObjectNameException not found by org.eclipse.jgit [52]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1585)
	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1970)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Caused: java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException
	at org.eclipse.jgit.internal.storage.file.WindowCache.publishMBeanIfNeeded(WindowCache.java:485)
	at org.eclipse.jgit.internal.storage.file.WindowCache.get(WindowCache.java:386)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.pin(WindowCursor.java:327)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.copy(WindowCursor.java:226)
	at org.eclipse.jgit.internal.storage.file.Pack.readFully(Pack.java:602)
	at org.eclipse.jgit.internal.storage.file.Pack.load(Pack.java:785)
	at org.eclipse.jgit.internal.storage.file.Pack.get(Pack.java:273)
	at org.eclipse.jgit.internal.storage.file.PackDirectory.open(PackDirectory.java:212)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:404)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:368)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObjectWithoutRestoring(ObjectDirectory.java:359)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:344)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:132)
	at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
	at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1086)
	at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.checkObjectExistence(PackedBatchRefUpdate.java:253)
	at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.execute(PackedBatchRefUpdate.java:136)
	at org.eclipse.jgit.lib.BatchRefUpdate.execute(BatchRefUpdate.java:582)
	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:242)
	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:103)
	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1321)
	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:213)
	at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:311)
	at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:182)
Comment 3 Eclipse Genie CLA 2022-06-17 07:50:26 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/194234
Comment 4 Matthias Sohn CLA 2022-06-17 07:51:14 EDT
(In reply to Eclipse Genie from comment #3)
> New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/194234

fix for stable-5.13
Comment 5 Eclipse Genie CLA 2022-06-17 07:52:38 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/194235
Comment 6 Thomas Wolf CLA 2022-06-17 07:55:38 EDT
(In reply to Eclipse Genie from comment #5)
> New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/194235

Abandoned.