Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchFieldError: java.awt.image.ColorModel.pData #29704

Closed
dilipdhankecha2530 opened this issue Dec 16, 2022 · 2 comments
Closed

java.lang.NoSuchFieldError: java.awt.image.ColorModel.pData #29704

dilipdhankecha2530 opened this issue Dec 16, 2022 · 2 comments
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid

Comments

@dilipdhankecha2530
Copy link

Dear Spring Team,

We use the below-mentioned code in a simple spring application.

@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args) throws IOException {
		SpringApplication.run(DemoApplication.class, args);
		File openBadgeFile = new File("/home/dilip/Desktop/demo/src/main/resources/test.png");
		PDDocument document = PDDocument.load(new File("/home/dilip/Desktop/demo/src/main/resources/test.pdf"));
		PDFRenderer pdfRenderer = new PDFRenderer(document);
		BufferedImage bImage = pdfRenderer.renderImageWithDPI(0, 300, ImageType.RGB);
		ImageIO.write(bImage, "PNG", openBadgeFile);
		document.close();
	}

}

While creating the native build at that time we face the below-mentioned error.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.0)

2022-12-17T00:42:33.826+05:30  INFO 10967 --- [           main] com.example.demo.DemoApplication         : Starting AOT-processed DemoApplication using Java 17.0.5 with PID 10967 (/home/dilip/Desktop/demo/build/native/nativeCompile/demo started by dilip in /home/dilip/Desktop/demo)
2022-12-17T00:42:33.826+05:30  INFO 10967 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2022-12-17T00:42:33.832+05:30  INFO 10967 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.016 seconds (process running for 0.019)
Exception in thread "main" java.lang.NoSuchFieldError: java.awt.image.ColorModel.pData
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getFieldID(JNIFunctions.java:1271)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetFieldID(JNIFunctions.java:425)
	at [email protected]/java.awt.image.ColorModel.initIDs(ColorModel.java)
	at [email protected]/java.awt.image.ColorModel.<clinit>(ColorModel.java:221)
	at [email protected]/java.awt.image.Raster.<clinit>(Raster.java:172)
	at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:107)
	at com.example.demo.DemoApplication.main(DemoApplication.java:20)

Is there any additional configuration that we need to do while creating the native build.

NOTE:: We are using apache-pdfbox dependency with its latest version.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 16, 2022
@bclozel
Copy link
Member

bclozel commented Dec 16, 2022

Thanks for reaching out and trying our GraalVM Native support.
Unfortunately, I think this one is out of our control. You should reach out to the "apache-pdfbox" and ask them to consider GraalVM Native image support. If the community is not interested in this right now, you can also work on contributing metadata on the community repository. Also see this announcement from the GraalVM team.

The Spring team has contributed metadata for many libraries already, but we are currently focusing on libraries that we provide support for.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2022
@bclozel bclozel added for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 16, 2022
@rishiraj88
Copy link

Thanks for reaching out and trying our GraalVM Native support. Unfortunately, I think this one is out of our control. You should reach out to the "apache-pdfbox" and ask them to consider GraalVM Native image support. If the community is not interested in this right now, you can also work on contributing metadata on the community repository. Also see this announcement from the GraalVM team.

The Spring team has contributed metadata for many libraries already, but we are currently focusing on libraries that we provide support for.

Thank you very much, @bclozel , for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants