Hello All
I have followed below articles
https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html .
Please review attached files:
I'm trying to integrate microsoft GraphAPI with AEM. I'm using the below dependency:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>5.42.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.14.2</version>
<scope>provided</scope>
</dependency>
However, I keep getting following error:
java.lang.NoClassDefFoundError: Could not initialize class com.azure.identity.ClientSecretCredentialBuilder at com.fidelity.mygps.core.service.impl.GraphApiServiceImpl.activate(GraphApiServiceImpl.java:80) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:242) at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:678) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:524) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:318) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:308) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:342) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:984) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:957) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:757) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:667) at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.run(AbstractComponentManager.java:457) at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:113) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @608c1585 (instance of org.apache.felix.framework.BundleWiringImpl$BundleClassLoader, child of org.apache.sling.launchpad.base.shared.LauncherClassLoader @77b52d12 org.apache.sling.launchpad.base.shared.LauncherClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @4fb559c5 (instance of org.apache.felix.framework.BundleWiringImpl$BundleClassLoader, child of org.apache.sling.launchpad.base.shared.LauncherClassLoader @77b52d12 org.apache.sling.launchpad.base.shared.LauncherClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature [in thread "OsgiInstallerImpl"] at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357) at com.azure.core.util.logging.ClientLogger.getLogger(ClientLogger.java:119) at com.azure.core.util.logging.ClientLogger.(ClientLogger.java:115) at com.azure.core.util.logging.ClientLogger.(ClientLogger.java:80) at com.azure.core.util.logging.ClientLogger.(ClientLogger.java:70) at com.azure.identity.CredentialBuilderBase.(CredentialBuilderBase.java:32) at com.fidelity.mygps.core.service.impl.GraphApiServiceImpl.activate(GraphApiServiceImpl.java:80) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:242) at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:678) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:524) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:318) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:308) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:342) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:984) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:957) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:757) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:667) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:433) at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:666) at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:353) at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:553) at org.apache.felix.scr.impl.Activator.access$200(Activator.java:69) at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:424) at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4817) at org.apache.felix.framework.Felix.startBundle(Felix.java:2336) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) at org.apache.sling.installer.core.impl.tasks.BundleStartTask.execute(BundleStartTask.java:97) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.doExecuteTasks(OsgiInstallerImpl.java:914) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:749) at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:298) ... 1 more
serviceId
Views
Replies
Total Likes
Hi,
The error java.lang.NoClassDefFoundError: Could not initialize class com.azure.identity.ClientSecretCredentialBuilder
means that the class ClientSecretCredentialBuilder
is not being found at runtime. This is often due to missing dependencies or an incorrect classpath setup.
I think you need to remove the "provided" scope and use one of the links you already share to ship these dependencies with your bundle. Please check this article: https://www.linkedin.com/pulse/how-add-third-party-bundle-you-aem-package-veena-vikraman/
Hope this helps
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies