issue with unsatisfiedDependencyException org.springframework.beans.factory

Viewed 2301

Microsoft Windows [Version 10.0.18362.1016] (c) 2019 Microsoft Corporation. All rights reserved.

             G:\mymobile\app>jhipster info
             INFO! Using JHipster version installed locally in current project's node_modules
             INFO! Executing jhipster:info
             INFO! Options: from-cli: true
             Welcome to the JHipster Information Sub-Generator

              ##### **JHipster Version(s)**
             oauth-2@0.0.1-SNAPSHOT G:\mymobile\app
             `-- generator-jhipster@6.4.1

         ##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**


       <details>
       <summary>.yo-rc.json file</summary>
       <pre>
        {
         "generator-jhipster": {
            "databaseType": "sql",
            "devDatabaseType": "h2Disk",
            "enableHibernateCache": true,
            "enableSwaggerCodegen": false,
            "enableTranslation": true,
            "jhiPrefix": "jhi",
            "languages": ["en", "fr"],
            "messageBroker": false,
            "nativeLanguage": "en",
            "packageName": "com.mycompany.myapp",
            "packageFolder": "com/mycompany/myapp",
            "prodDatabaseType": "mysql",
            "searchEngine": false,
            "serviceDiscoveryType": false,
            "skipClient": false,
           "skipServer": false,
            "testFrameworks": ["protractor"],
            "websocket": false,
            "baseName": "oauth2",
           "authenticationType": "oauth2",
           "buildTool": "gradle",
           "jhipsterVersion": "6.4.1",
            "skipUserManagement": true,
           "clientPackageManager": "npm",
           "applicationType": "monolith",
           "cacheProvider": "ehcache",
           "clientFramework": "angularX",
           "clientTheme": "none",
           "clientThemeVariant": "",
           "serverPort": "8080",
           "useSass": true,
           "embeddableLaunchScript": false,
            "entitySuffix": "",
            "dtoSuffix": "DTO",
            "otherModules": [],
            "blueprints": []
                                },
              "entities": []
                                 }

              </pre>
           </details>


           ##### **JDL for the Entity configuration(s) `entityName.json` files generated in the        `.jhipster` directory**

           <details>
          <summary>JDL entity definitions</summary>

           <pre>
           entity Album {
            title String required,
            description TextBlob,
            created Instant
           }
            entity Photo {
                 title String required,
                 description TextBlob,
                 image ImageBlob required,
                  taken Instant
                   }
            entity Tag {
                   name String required minlength(2)
                        }
             relationship ManyToOne {
              Album{user(login)} to User,
              Photo{album(title)} to Album
                }
              relationship ManyToMany {
              Photo{tag(name)} to Tag{photo}
                }

               paginate Album with pagination
               paginate Photo, Tag with infinite-scroll

              </pre>
             </details>
              

             ##### **Environment and Tools**

            openjdk version "11.0.8" 2020-07-14
            OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
            OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

            node: v12.18.3

             npm: 6.14.6

             yeoman: 3.1.1

             Docker version 19.03.1, build 74b1e89e8a

            docker-compose version 1.24.1, build 4667896b

           INFO! Congratulations, JHipster execution is complete!

           G:\mymobile\app>docker-compose -f src/main/docker/keycloak.yml up -d
           docker_keycloak_1 is up-to-date

---stack trace developed ------ Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration' defined in file [G:\mymobile\app\build\classes\java\main\com\mycompany\myapp\config\SecurityConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.zalando.problem.spring.web.advice.security.SecurityProblemSupport': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve the OpenID Configuration with the provided Issuer of "http://localhost:9080/auth/realms/jhipster"

1 Answers

It looks like you have not started keycloak (jhipster brings ready to use keycloak config). The app tries to reach keycloak at localhost:9080.

If you have docker and docker-compose installed you can use the provided docker-compose configuration and start keycloak via docker-compose -f src/main/docker/keycloak.yml up

If you want to start it manually you need to make sure to setup the jhipster realm in your keycloak instance.

Related