问题
Are there any instructions available to run public-client-app-sample in ADAL for Java ? After building the sample jar and library jar files, an attempt to run "java -cp adal4j-0.1.0.jar;public-client-app-sample.jar PublicClient" yields (after entering the credentials) Exception in thread "main" java.lang.NoClassDefFoundError: com/nimbusds/oauth2/s dk/AuthorizationGrant. What would be the appropriate classpath or is there a maven target?
回答1:
I just updated the code to include exec plugin in the sample. Simply use mvn exec:java
to run the sample. I verified that it works
回答2:
The 0.1.0 version of the adal4j maven library is unresolvable neither in com.microsoft.azure, nor in com.microsoft.aad. Here is the search result from maven central to confirm that:
http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22adal4j%22
When changing the adal4j to the latest available version (0.0.3) the following exception is produced:
Caused by: java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(URL.java:585)
at java.net.URL.<init>(URL.java:482)
at java.net.URL.<init>(URL.java:431)
at com.microsoft.aad.adal4j.HttpHelper.openConnection(HttpHelper.java:110)
at com.microsoft.aad.adal4j.HttpHelper.executeHttpGet(HttpHelper.java:43)
at com.microsoft.aad.adal4j.HttpHelper.executeHttpGet(HttpHelper.java:38)
at com.microsoft.aad.adal4j.MexParser.getWsTrustEndpointFromMexEndpoint(MexParser.java:87)
at com.microsoft.aad.adal4j.AuthenticationContext.processPasswordGrant(AuthenticationContext.java:747)
at com.microsoft.aad.adal4j.AuthenticationContext.access$000(AuthenticationContext.java:61)
at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:127)
at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:117)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
来源:https://stackoverflow.com/questions/29380910/adal-for-java-resolving-dependencies-for-java-client-app-sample