0

Currently refactoring an old tomcat deployed Spring JSP .war application to a Docker SpringBoot app. I am using the spring-boot maven plugin to build docker images.

While running the image locally, on startup there is a warning:

    Resource for web application [] at path [/spring-cloud-bindings-1.11.0.jar] was not
    loaded as the canonical path [cks_spring-boot/spring-cloud-bindings/spring-cloud-
    bindings-1.11.0.jar] did not match. Use of symlinks is one possible cause.

Inside the image within the lib directory we can see there is a symlink: enter image description here

From what I have read, this issue is likely due to character encoding inconsistencies. Looking for advice on how to fix this.

Aside from a fix, I would like to know why symlinks are created and why there is a reference to the packeto-buildpacks in the final build.

1 Answers1

0

The easy answer here is to set BP_SPRING_CLOUD_BINDINGS_DISABLED=false. It should be an environment variable passed through to the build. Add to the env block. See for Gradle and for Maven.

This will tell the buildpack when it runs to not add Spring Cloud Bindings which is safe if you do not require it.

Spring Cloud Bindings is a library that will do some automatic mapping of common service bindings to the expected Spring Boot properties. For example, if you pass through a database binding it would see that and set spring.datasource.url. Service Bindings are volume mounted into your container when it runs.


If you require Spring Cloud Bindings, that's probably more than I can answer here, and I'd suggest opening an issue here.

What I can say is that the apache-tomcat buildpack does use symlinks as part of the way it sets up Tomcat in the generated container image. This has to do with the way that it generates layers. It puts Tomcat in a separate layer from the application files, which change more frequently.

Since using symlinks is expected in this scenario you may also be able to just ignore that message. If it is causing issues, I would encourage you to reach out and open a Github issue. We can look into it more.

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28