1

I'm trying to get the keycloak quick start applications connected to keycloak and learn how the authorization mechanism works.

I'm following this guide: https://www.keycloak.org/docs/latest/authorization_services/#_getting_started_overview

I've done these steps:

  1. Installed Ubuntu 20.
  2. sudo apt install openjdk-8-jre-headless
  3. sudo apt install openjdk-8-jdk-headless
  4. Downloaded and extracted Keycloak-15 on my system.
  5. Downloaded and extracted Wildfly-10 on my system.
  6. ./bin/standalone.sh -Djboss.socket.binding.port-offset=100 for Keycloak so its running at http://localhost:8180
  7. Configured Keycloak adapter for Wildfly instance.
  8. ./bin/standalone.sh for Wildfly so its running at http://localhost:8080
  9. Copied keycloak.json file obtained from keycloack server to keycloak-quickstarts/app-authz-jee-vanilla/config
  10. mvn clean package wildfly:deploy in app-authz-jee-vanilla directory.

Following the guide I mentioned, I'm stuck in the Build, Deploy, and Test Your Application section. I try to build the app-authz-jee-vanilla app but I keep getting this error:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.2.2.Final:deploy (default-cli) on project keycloak-app-authz-jee-vanilla: Execution default-cli of goal org.wildfly.plugins:wildfly-maven-plugin:1.2.2.Final:deploy failed: Plugin org.wildfly.plugins:wildfly-maven-plugin:1.2.2.Final or one of its dependencies could not be resolved: Could not find artifact sun.jdk:jconsole:jar:jdk at specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/../lib/jconsole.jar

Looks like maven cannot deal with some dependency. But I dont know how to solve it!

I would be thankful if anybody can solve this problem.

mmafshari
  • 25
  • 7
  • I would check the wildfly-maven-plugin because it looks it needs something which does not exist anymore ... furthermore check for a newer version of it https://search.maven.org/artifact/org.wildfly.plugins/wildfly-maven-plugin – khmarbaise Nov 08 '21 at 14:54
  • @khmarbaise that would be kind of you. but the rest of the error message says the artifact sun.jdk:jconsole:jar:jdk is missing. Do you still think the problem is still with wildfly-maven-plugin? – mmafshari Nov 08 '21 at 15:11
  • Have you tried to update the plugin? I suppose that `mvn clean package` does not produces issues? – khmarbaise Nov 08 '21 at 16:55
  • 2.1.0.Final is the latest version of the plugin. I'd definitely try updating that first. – James R. Perkins Nov 08 '21 at 17:06
  • @khmaraise I ran ```mvn clean package``` at the _app-authz-jee-vanilla_ directory and voila! The build is successful! But there is nothing deployed on wildfly instance. When I run ```mvn clean package wildfly:deploy``` again, the error appears again and buid is failed! – mmafshari Nov 09 '21 at 07:03
  • @james excuse me being noob in maven, but how can I update this plugin? Isn't it updated when I run ```mvn clean package wildfly:deploy```? – mmafshari Nov 09 '21 at 07:08
  • No. It is defined somewhere in your pom under the `` or ``. – James R. Perkins Nov 09 '21 at 19:38

1 Answers1

1

So finally I've managed to solve the problem. I did some steps according to searching and comments. The steps were:

  1. First of all, I figured out that when I install JDK there is no need to install JRE! So I've uninstalled JRE.
  2. I've changed to wildfly 11.
  3. I've run this command: mvn clean org.wildfly.plugins:wildfly-maven-plugin:2.1.0.Final:deploy

And VOILA! Build is successful and I now have access to the app in my browser.

P. S. Actually I'm not sure if the main problem was with existance of JRE and JDK on my machine at the same time because I didn't test it with JRE installed.

mmafshari
  • 25
  • 7