0

Facing the issue since I have added Hateoas dependency to my Spring boot project and deploying on weblogic server 12c

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-01-09 14:18:53,591 ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter [[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)']


APPLICATION FAILED TO START


Description:

Parameter 0 of method linkDiscoverers in org.springframework.hateoas.config.HateoasConfiguration required a single bean, but 15 were found: - modelBuilderPluginRegistry: defined in null - modelPropertyBuilderPluginRegistry: defined in null - typeNameProviderPluginRegistry: defined in null - documentationPluginRegistry: defined in null - apiListingBuilderPluginRegistry: defined in null - operationBuilderPluginRegistry: defined in null - parameterBuilderPluginRegistry: defined in null - expandedParameterBuilderPluginRegistry: defined in null - resourceGroupingStrategyRegistry: defined in null - operationModelsProviderPluginRegistry: defined in null - defaultsProviderPluginRegistry: defined in null - pathDecoratorRegistry: defined in null - relProviderPluginRegistry: defined by method 'relProviderPluginRegistry' in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class] - linkDiscovererRegistry: defined in null - entityLinksPluginRegistry: defined by method 'entityLinksPluginRegistry' in class path resource [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class]

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

<09-Jan-2020, 2:18:53,633 PM IST> ' available: expected single matching bean but found 15: modelBuilderPluginRegistry,modelPropertyBuilderPluginRegistry,typeNameProviderPluginRegistry,documentationPluginRegistry,apiListingBuilderPluginRegistry,operationBuilderPluginRegistry,parameterBuilderPluginRegistry,expandedParameterBuilderPluginRegistry,resourceGroupingStrategyRegistry,operationModelsProviderPluginRegistry,defaultsProviderPluginRegistry,pathDecoratorRegistry,relProviderPluginRegistry,linkDiscovererRegistry,entityLinksPluginRegistry at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) Truncated. see log file for complete stacktrace Caused By: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.plugin.core.PluginRegistry' available: expected single matching bean but found 15: modelBuilderPluginRegistry,modelPropertyBuilderPluginRegistry,typeNameProviderPluginRegistry,documentationPluginRegistry,apiListingBuilderPluginRegistry,operationBuilderPluginRegistry,parameterBuilderPluginRegistry,expandedParameterBuilderPluginRegistry,resourceGroupingStrategyRegistry,operationModelsProviderPluginRegistry,defaultsProviderPluginRegistry,pathDecoratorRegistry,relProviderPluginRegistry,linkDiscovererRegistry,entityLinksPluginRegistry at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:220) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1265) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:874) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:778) Truncated. see log file for complete stacktrace > <09-Jan-2020, 2:18:53,674 PM IST> <09-Jan-2020, 2:18:53,775 PM IST> <09-Jan-2020, 2:18:53,834 PM IST> <09-Jan-2020, 2:18:53,981 PM IST> <09-Jan-2020, 2:18:53,988 PM IST> <09-Jan-2020, 2:18:53,992 PM IST> <09-Jan-2020, 2:18:54,0 PM IST>

POM.xml file :

 <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.bt</groupId>
    <artifactId>Some project</artifactId>
    <version>1.0</version>
    <packaging>war</packaging>
    <name>some Project</name>
    <description>REST enabled adapter to communicate with tetProject database</description>


    <repositories>
        <repository>
            <id>some Repo</id>
            <name><xyz.some.name></name>
            <url><xyz.some.url></url>
        </repository>
    </repositories>

    <properties>
        <java.version>1.8</java.version>
        <skipTests>true</skipTests>
     </properties>
   <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-websocket</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>commonlibs.com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
    <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.6.1</version>
        </dependency>  
        <dependency>
            <groupId>commonlibs.com.bea.core</groupId>
            <artifactId>com.bea.core.datasource6_1.7.0.0</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>commonlibs.com.bea.core.utils</groupId>
            <artifactId>com.bea.core.utils.wrapper_1.4.0.0</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
       <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-hateoas</artifactId>
        <version>1.2.2.RELEASE</version>
       </dependency>
    </dependencies>



    <build>
        <finalName>Some project</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>
</project>
halfer
  • 19,824
  • 17
  • 99
  • 186
  • Welcome to SO! Please consider to have a look at https://stackoverflow.com/help/minimal-reproducible-example. Certainly it wouldn't hurt to read the entire [tour](https://stackoverflow.com/tour) page as well. – Twonky Jan 09 '20 at 09:44
  • Duplicate of: https://stackoverflow.com/questions/58431876/spring-boot-2-2-0-spring-hateoas-startup-issue ? – Amir Kirsh Jan 09 '20 at 10:52
  • Hi, before to study your problem I have a question for you: why do you deploy a spring-boot app in weblogic if a spring-boot application is a standalone application that create an own JEE container? – Simone Casamassa Jan 13 '20 at 15:56

1 Answers1

0

Spring is telling you the problem

org.springframework.hateoas.config.HateoasConfiguration required a single bean,
    but 15 were found:

Which means that there are 15 methods that return a bean that fits HateoasConfiguration.

Who are those bastards?

Spring continues right after with the list:

        - modelBuilderPluginRegistry: defined in null
        - modelPropertyBuilderPluginRegistry: defined in null
        - typeNameProviderPluginRegistry: defined in null
        - documentationPluginRegistry: defined in null
        - apiListingBuilderPluginRegistry: defined in null
        - operationBuilderPluginRegistry: defined in null
        - parameterBuilderPluginRegistry: defined in null
        - expandedParameterBuilderPluginRegistry: defined in null
        - resourceGroupingStrategyRegistry: defined in null
        - operationModelsProviderPluginRegistry: defined in null
        - defaultsProviderPluginRegistry: defined in null
        - pathDecoratorRegistry: defined in null
        - relProviderPluginRegistry: defined by method 'relProviderPluginRegistry' 
             in class path resource
             [org/springframework/hateoas/config/HateoasConfiguration.class]
        - linkDiscovererRegistry: defined in null
        - entityLinksPluginRegistry: defined by method 'entityLinksPluginRegistry'
             in class path resource
             [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class]

The list might be not so clear or familiar as it might be that some of these methods are defined by the framework.

So what can be done?

Spring is suggesting a solution:

 Action:

    Consider marking one of the beans as @Primary,
    updating the consumer to accept multiple beans,
    or using @Qualifier to identify the bean that should be consumed

Does it mean that I need to reconfigure my @Beans?

Not necessarily. First try to see if someone else faced the same problem.

You may find the solution there.

Amir Kirsh
  • 12,564
  • 41
  • 74