Skip to content

Getting java.lang.UnsatisfiedLinkError /layers/paketo-buildpacks_microsoft-openjdk/jdk/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory #262

@amardev06

Description

@amardev06

Expected Behavior

Should not get initialization error.

Current Behavior

We are currently migrating our spring boot application to AKS and using paketo buildpacks to create container image. For openjdk, we are using gcr.io/paketo-buildpacks/microsoft-openjdk. Our Azure DevOps pipeline creates container image using spring boot command “mvn spring-boot:build-image”.

Here is the “spring-boot-maven-plugin” config:

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<configuration>
		<image>
			<buildpacks>
				<buildpack>gcr.io/paketo-buildpacks/ca-certificates:${paketo-bp-ca-cert.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/microsoft-openjdk:${paketo-bp-ms-openjdk.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/syft:${paketo-bp-syft.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/executable-jar:${paketo-bp-exe-jar.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/dist-zip:${paketo-bp-dist-zip.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/spring-boot:${paketo-bp-spring-boot.version}</buildpack>
				<buildpack>gcr.io/paketo-buildpacks/azure-application-insights:${paketo-bp-az-app-insights.version}</buildpack>
			</buildpacks>
			<createdDate>now</createdDate>
			<bindings>
				<binding>
					${project.basedir}/appinsights:/platform/bindings/application-insights
				</binding>
			</bindings>
		</image>
	</configuration>
</plugin>

This spring-boot application uses jasper reports to create pdfs and during creation we are hitting below error:

[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager] with root cause
java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /layers/paketo-buildpacks_microsoft-openjdk/jdk/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory [in thread "http-nio-8080-exec-6"]
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)

Steps to Reproduce

Our build process runs with Java 17, Spring boot 3.2 on Ubuntu Linux and we use “mvn spring-boot:build-image” command to create the image. See above the definition of 'spring-boot-maven-plugin'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions