问题
I am new to Azure and OpenIDConnect. To start with, I cloned the sample git Application and tried to test it. It's giving me the below error. The War has the oauth2 jar and I can see the class files present there.
Git URL: https://github.com/Azure-Samples/active-directory-java-webapp-openidconnect
SEVERE: Exception starting filter BasicFilter
java.lang.NoClassDefFoundError: com/nimbusds/openid/connect/sdk/AuthenticationSuccessResponse
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
at java.lang.Class.getDeclaredMethods(Class.java:1860)
at org.apache.catalina.core.DefaultInstanceManager.processAnnotations(DefaultInstanceManager.java:335)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:252)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4584)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5257)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.nimbusds.openid.connect.sdk.AuthenticationSuccessResponse
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 16 more
回答1:
According to your error information, it seems that the oauth2-oidc-sdk dependency defined in the pom.xml file of the sample project had not been installed.
- Try to command
mvn install
to download the dependency for the project. - Try to check the environment variable
M2_HOME
whether be defined for your environment or your IDE.
Hope it helps.
回答2:
By adding the oauth-oidc-sdk.jar and gson.jar in the tomcat lib. The application is working.
来源:https://stackoverflow.com/questions/45006441/integrating-azure-ad-into-a-java-web-application