preview_test_pdf.pdf (1017.7 KB)
Below exception message is thrown while viewing attached pdf using groupdocs viewer for java 24.12
class com.groupdocs.viewer.internal.c.a.pd.internal.l22v.l46n cannot be cast to class com.groupdocs.viewer.internal.c.a.pd.internal.l22v.l36j (com.groupdocs.viewer.internal.c.a.pd.internal.l22v.l46n and com.groupdocs.viewer.internal.c.a.pd.internal.l22v.l36j are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @12a94400)
@Shakeel_Ahmed
Unfortunately, I can’t reproduce this exception. May you please provide a sample application or a code snippet.
The app that I was using: sample-app.zip (948.0 KB)
I see the difference in how the options are set. In our case its like below
private static LoadOptions createLoadOptions(String password, String guid) {
final FileType fileType = FileType.fromFilePath(guid);
final LoadOptions loadOptions = new LoadOptions();
loadOptions.setResourceLoadingTimeout(500);
if(fileType != null) loadOptions.setFileType(fileType);
if (password != null && !Strings.isEmpty(password)) loadOptions.setPassword(password);
return loadOptions;
}
Let me try the way you mentioned.
By the way below app also fails to load this pdf
@Shakeel_Ahmed
Thank you for reporting this issue with the Viewer App. We will analyze it and update you as soon as we have more information. The issue ID is GROUPDOCSAPP-1047.
Please note that the issue you are experiencing may not be related to the Viewer App itself, as the app uses GroupDocs.Viewer for .NET and runs on Linux.
We are using this implementation
Can you please check with it.
@Shakeel_Ahmed
I have created issue in our internal bug-tracker. We’ll try reproducing this exception and update you. The issue ID is VIEWERJAVA-3827.
Hello, @Shakeel_Ahmed
I tested the application with your file, and it works error-free.
I also tested it in a Docker container using the next config (groupdocs/viewer:24.12-java-openjdk18-bullseye-spring
is an official image that is built using this dockerfile)
version: '3.9'
services:
groupdocs-viewer-app:
image: groupdocs/viewer:24.12-java-openjdk18-bullseye-spring
ports:
- "8080:8080"
environment:
LIC_PATH: "/home/groupdocs/app/Licenses/groupdocs-license.lic"
DOWNLOAD_ON: "true"
UPLOAD_ON: "true"
PRINT_ON: "true"
BROWSE_ON: "true"
RIGHTCLICK_ON: "false"
FILES_DIR: "DocumentSamples"
RESULT_DIR: "DocumentSamples"
HOST_ADDRESS: ""
volumes:
- ./DocumentSamples:/home/groupdocs/app/DocumentSamples
- ./Licenses:/home/groupdocs/app/Licenses
container_name: 24.12-java-openjdk18-bullseye-spring-container
and the file was displayed correctly. The only thing is that the file was not displayed in evaluation mode due to trial limitations, but the error was completely different:
Document with guid '/home/groupdocs/app/DocumentSamples/preview_test_pdf.pdf' can't be viewed in evaluation mode as there is a collection with more than 4 elements inside the document.
Also I have added next code to createLoadOptions
method
final FileType fileType = FileType.fromFilePath(documentGuid);
if (fileType != null) {
loadOptions.setFileType(fileType);
}
and tested it locally - no any problems.
Please attempt to reproduce the bug in a Docker container to minimize environmental factors. If the error persists in the Docker container, kindly share all modifications made to the project and the Dockerfile used when the error occurred.
PDF is working fine on the docker and I see internally it is using java 18 and jetty , for us it is java 21 and tomcat 10 so trying to run dokcer on java 21 from your other post Springboot Lazy Loading - #6 by aleksey.permyakov but no success yet
docker-files-inviewer.zip (203.5 KB)
Please find attached docker files with jdk 21 that has reported issue reproduced
Used docker-compose-j21.yml file for compose up that refers to DockerfileJava21V2 (Actually i used your docker from other thread but manually places font packages as it was taking too much time for me)
Thank you for the details.
I have reproduced the bug and will investigate it.