Garreth McDaid
Garreth McDaid

Reputation: 2623

Case sensitivity issue in Spring application

I have been given a Java Spring application to containerize. I am using a Tomcat8/Java8 base image. When it boots, it fails to deploy with the following error:

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'controller3P' for bean class [com.******.******.brand3P.controller.Controller3P] conflicts with existing, non-compatible bean definition of same name and class [com.******.******.Brand3P.controller.Controller3P]

The problem here seems to that Spring is finding 2 conflicting classes, differentiated by "brand3P" and "Brand3P".

However, in the source code, I can find no reference to a class "Brand3P", only a class "brand3P".

Can anyone explain what Spring is doing here?

(Be nice, I'm Ops, not Dev)

Upvotes: 0

Views: 1028

Answers (2)

Garreth McDaid
Garreth McDaid

Reputation: 2623

Turns out it was an issue with the build in Jenkins. The code had changed (Brand3P -> brand3P) but the older class name was hanging around in the Jenkins workspace, and being bundled into the Docker image.

We deleted the workspace, re-ran the build, and all was fine.

Upvotes: 0

Jaiwo99
Jaiwo99

Reputation: 10017

  1. Package name should be all lower cased, checkout here oracle doc

  2. Package name is not included in spring definition name.

  3. My guess is someone changed the package name in Git, because git is by default case insensitive, so you will run into this situation, if it is this case, remove the file and create it again will fix this problem.

  4. Hi Ops, please work with Devs together ;)

Upvotes: 1

Related Questions