-
Notifications
You must be signed in to change notification settings - Fork 1
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
Error generating reports with barcodes on native image #156
Comments
Also, I don't know if it's related, but is this warning normal?
It happens in both dev and native mode |
Also, I tried generating this report (as it's included in an integration test as shown by @melloware) but only an empty PDF is generated. Update: I noticed that the test report is empty only when a datasource is passed to |
Weird I get the above PDF? I think i know what the bBarcode4J issue is PF uses BC4J "light" and Jasper uses BC4J full two different JARS and coordinates let me investigate this but I am not having any issues generating barcodes. Can you create the smallest possible Quarkus reproducer? Or update my Integrations tests here to show the failure? |
try excluding |
the only thing I see different than my integration is this...
|
Another update: the test report in native mode gives the same errors I stated in the first post. In dev mode it was generated just fine. @melloware I'm gonna try the suggested exclusion, soon I'll report results here. If possible I'll create a reproducer too |
Actually I tried with the test report, which does not contains these properties, and the same happened. I'm waiting for the native build to finish after the exclusions you mentioned to report new results. |
Update: nope, warnings about split package disappeared but the same error happens |
Can this issue be related somehow? May I be missing something? |
Looks like the same error but then why can't i reproduce locally or in CI/CD GitHub Native build? Also how are you building the native are you running this in the when its done run |
I have only tried the .jrxml file, I didn't try to run the integration tests in my environment. I'm trying it now and waiting for the build to finish. Also, I'm only using |
@melloware compiled the integration tests, though not as a Docker container but only native, and got the exact same error:
|
@melloware just tried the Docker build and it works fine. It only fails when compiled as |
yep because that Docker image is the BARE MINIMUM image with proper font library installation for AWT and Fonts. That is why its documented here: https://github.com/quarkiverse/quarkus-jasperreports?tab=readme-ov-file#docker |
So it sounds like your native image running bare metal doesn't have stuff AWT needs to reach. |
Are you including the Quarkus AWT extension? |
yep Quarkus AWT definitely there as Jasper does everything with AWT rendering. |
I think it should work even if it's a transitive dependency, but maybe good to double-check. |
what is even weirder is our Native Integration Tests pass on CI/CD and its doing the same.
|
I don't know how much this can affect this whole question, but I was building under WSL. I'm now trying under a real Linux environment. Soon I'll post the results. |
oh so another note on WSL i always copy the files locally when building native image and not ru nfrom for example
|
OK, I tried moving the files to the internal WSL storage, same error happened but mentioning a different class:
|
ok its like AWT is not available in your WSL is what it looks like. |
NOTE: I am also switching PrimeFaces to use the same Barcode4J as Jasper so we don't run into this again: quarkiverse/quarkus-primefaces#275 |
I tried compiling under a Linux VM and at least the integration tests worked fine. I'm gonna try with my app. So this has something to do with WSL then? Do you think of anything I could do to make it work? UPDATE: My app worked fine compiling under the Linux VM. I'm gonna try with another WSL distro, preferably the same I used in the VM. |
i use Ubuntu in my WSL distro. What do you use? |
I was using Ubuntu too, now I tried with Rocky Linux. It worked on the Rocky VM but also failed under Rocky WSL... the Rocky WSL enviroment is brand new, the only difference to the VM is that the WSL image is a minimal one, whereas the VM one is full with GUI. |
Another update: I tried running the same executable I produced under WSL on the VM and it worked fine. Then I tried copying the executable I built on the VM to WSL and got the error again. So:
Maybe WSL is really missing something, but what? JAVA_HOME points to Mandrel (same as GRAALVM_HOME) in both environments. |
Maybe the error is somehow misleading and there's a basic dependency missing (like |
Maybe that is the case. I just tried running the executable under WSL with the flag
I also tried running an X server on the host computer and setting DISPLAY to its IP just to see what would happen. The application does try to open the X display, though the error happens anyway. |
Passing |
Well, I tried adding it to the native image build args, but I still have to pass it to the executable when running it. Does anyone know if it is possible to set this parameter to always apply by default in the image? I already tried with |
@redddcyclone it might be good to ask this on Zulip channel because this is interesting. I always build to the ubi-minimal Docker Image as you have seen and never had an issue but this is weird? |
Ok, I'm gonna ask about this on the chat. Thanks a lot @melloware and @dmlloyd! |
OK submitted fix... @BuildStep
SystemPropertyBuildItem sysPropHeadless(NativeConfig nativeConfig) {
if (nativeConfig.enabled()) {
// see https://github.com/quarkiverse/quarkus-jasperreports/issues/156
return new SystemPropertyBuildItem("java.awt.headless", "true");
}
return null;
} lets see if CI/CD pipeline doesn't complain |
@melloware should the latest code in the main branch work without specifying this parameter? I tried the integration test and it didn't work without setting |
hmmm according to everyone it should i mean its pretty clear what its doing... |
I'm gonna do another try just in case |
@melloware sorry, it worked just fine, it was my mistake. Thanks a lot! |
@all-contributors add @dmlloyd for question |
I've put up a pull request to add @dmlloyd! 🎉 |
Hello all,
I'm getting the following errors when generating reports containing barcodes (Barcode4J) on a native image application:
The AWT related error happens on the first try only. Then the CursorManager related one happens every time I try to generate a report with barcodes.
These are the elements in the .jrxml files:
Thanks in advance!
The text was updated successfully, but these errors were encountered: