CDI deployment failure:WELD-001414 Bean name is ambiguous

前端 未结 3 1499
一整个雨季
一整个雨季 2021-01-12 00:22

I have an application, which has multiple modules and various dependencies. When I deploy the application on Glassfish 4, I am getting error:

org.jboss.weld.         


        
相关标签:
3条回答
  • 2021-01-12 00:53

    Are you by any chance packaging the Jersey specific libraries in your EAR file. I believe glassfish does provide the Jersey libraries and you do not need to package them.

    0 讨论(0)
  • 2021-01-12 01:07

    I think you have two @Named bean class with the same name.

    0 讨论(0)
  • 2021-01-12 01:17

    Glassfish is already having Jerseys libraries packaged for you, so you need add provided scope into your Maven pom.xml as stated in the docs.

    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>
    

    If you are using any Jersey specific feature, you will need to depend on Jersey directly.

    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
        <version>2.4.1</version>
        <scope>provided</scope>
    </dependency>
    
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.4.1</version>
        <scope>provided</scope>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题