New Project on JMIX 2.0: adding REST API from Marketplace introduces the following error

Removing the REST API add-on removes the error as well.

Thanks in advance for any assistance.

========
2023-07-10T11:55:49.566+02:00 INFO 51001 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-07-10T11:55:49.628+02:00 INFO 51001 — [ main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with ‘debug’ enabled.
2023-07-10T11:55:49.762+02:00 ERROR 51001 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Method authorizationServerSecurityFilterChain in io.jmix.autoconfigure.authserver.AuthServerAutoConfiguration$AuthorizationServerSecurityConfiguration required a bean of type ‘org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository’ that could not be found.

Action:

Consider defining a bean of type ‘org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository’ in your configuration.

Task :bootRun FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:bootRun’.

Process ‘command ‘/Users/mariussnyman/Library/Java/JavaVirtualMachines/corretto-17.0.7/Contents/Home/bin/java’’ finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 39s
7 actionable tasks: 5 executed, 2 up-to-date
11:55:50: Execution finished ‘bootRun’.

1 Like

Hi,

You need to register the client in application.properties as described in the documentation.

1 Like

Wll this always be required? Or will it become as simple as it was in version 1.x of JMIX?

As far as I’m concerned, the error should contain something about client in application.properties.
May be better to create randomly generated client and other necessary properties.

It looks like really error because Jmix Studio add next lines to duild.gradle:

    implementation 'io.jmix.rest:jmix-rest-starter'
    implementation 'io.jmix.authserver:jmix-authserver-starter'

not those specified in the documentation:

implementation 'io.jmix.authserver:jmix-authserver-starter'
implementation 'io.jmix.security:jmix-security-starter'

Hi,

The error that appears when no client is registered is an error thrown by the Spring Authorization Server library that is used by Jmix. In their manual they state that some beans must be defined in the application. Application properties is just a one way of registered these client registration related beans.

I agree that in Jmix we can simplify this somehow. I’ve created an issue for Studio to think about adding these application properties when REST API add-on is added.

As for documentation and required dependencies, Studio adds correct dependencies and there was an error in the documentation. We’ve fixed it. Thanks for pointing out.