1

I am trying to integrate Azure AD for my web-app using OpenIDConnect approach. When I try to deploy the built ear file on weblogic I get NoClassDefFound for

com.nimbusds.openid.connect.sdk.AuthenticationSuccessResponse

. I have included oauth2-oidc-sdk-5.24.1.jar in the web-inf/lib folder, also verified that it is actually present within the ear file yet the application deployment fails complaining it is not able to find this class.

I found similar issue here. So I tried deploying both oauth2-oidc-sdk-5.24.1.jar and gson jar file as a library along with my java web app, but that did not help as well.

Much appreciated if I can get any pointers or suggestions to overcome this error.

The full stacktrace during deployment:

Caused By: java.lang.NoClassDefFoundError: com/nimbusds/openid/connect/sdk/AuthenticationSuccessResponse
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
        at java.lang.Class.getDeclaredMethods(Class.java:1793)
        at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.getMethods(BaseJ2eeAnnotationProcessor.java:1055)
        at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.getMethods(BaseJ2eeAnnotationProcessor.java:1043)
        at weblogic.j2ee.dd.xml.BaseJ2eeAnnotationProcessor.processJ2eeAnnotations(BaseJ2eeAnnotationProcessor.java:99)
        at weblogic.j2ee.dd.xml.J2eeAnnotationProcessor.processJ2eeAnnotations(J2eeAnnotationProcessor.java:37)
        at weblogic.servlet.internal.WebAnnotationProcessorImpl.processFilters(WebAnnotationProcessorImpl.java:239)
        at weblogic.servlet.internal.WebAnnotationProcessorImpl.processJ2eeAnnotations(WebAnnotationProcessorImpl.java:210)
        at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:105)
        at weblogic.servlet.internal.WebAppServletContext.processAnnotations(WebAppServletContext.java:1370)
        at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:450)
        at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:494)
        at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:418)
        at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:976)
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:384)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
        at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:648)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
        at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:59)
        at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:208)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
        at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)

#####################################

Update 2021/06/02

To resolve the version compatibility issue, I had to opt below specific versions of dependencies to get it not throw the error for JDK1.6, and microsoft adal4j had to recompiled in JDK6 (adal4j jar is supported on jdk1.7 and above)

    <groupId>com.nimbusds</groupId>
    <artifactId>nimbus-jose-jwt</artifactId>
    <classifier>jdk16</classifier>
    <version>5.9</version>
    

    <groupId>com.nimbusds</groupId>
    <artifactId>oauth2-oidc-sdk</artifactId>
    <classifier>jdk16</classifier>
    <version>5.24.1</version>
    </dependency>

If the JDK is 1.7, below is the specific versions that worked for me:

        <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>adal4j</artifactId>
        <version>1.6.0</version>
        </dependency>
    
        <dependency>
        <groupId>com.nimbusds</groupId>
        <artifactId>oauth2-oidc-sdk</artifactId>
        <version>5.24.1</version>
        </dependency>
        
        <dependency>
        <groupId>com.nimbusds</groupId>
        <artifactId>nimbus-jose-jwt</artifactId>
        <version>7.8</version>
        </dependency>

Hope this helps someone facing similar error on JDK1.6 and JDK1.7

vick_4444
  • 303
  • 1
  • 5
  • 19

1 Answers1

1

This is usually caused by incompatible versions. You can try different versions of oauth2-oidc-sdk until you find a compatible package.

Or you can also change the version of spring to achieve the purpose of version compatibility as mentioned in the comments.

Frank Borzage
  • 6,292
  • 1
  • 6
  • 19