graalvm / native-build-tools

Native-image plugins for various build tools
https://graalvm.github.io/native-build-tools/
Other
366 stars 57 forks source link

add non-minimize-version #459

Closed damnms closed 1 year ago

damnms commented 1 year ago

Is your feature request related to a problem? Please describe. When i create a native-image, it creates a ~40mb file. Thats nice. But it does not run. I get:

Exception in thread "main" jakarta.xml.bind.JAXBException: Can't find bundle for base name org.eclipse.persistence.internal.localization.i18n.EclipseLinkLocalizationResource, locale de_DE
 - with linked exception:
[java.util.MissingResourceException: Can't find bundle for base name org.eclipse.persistence.internal.localization.i18n.EclipseLinkLocalizationResource, locale de_DE]
        at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1173)
        at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:208)
        at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:167)
        at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:154)
        at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:114)
        at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:104)
        at org.gitlab.jsfdl.ports.dto.SfdlToBusinessObjectConverter.convert(SfdlToBusinessObjectConverter.java:25)
        at org.gitlab.jsfdl.ports.dto.SfdlToBusinessObjectConverter.convert(SfdlToBusinessObjectConverter.java:15)
        at org.gitlab.jsfdl.Application.loadSfdl(Application.java:36)
        at org.gitlab.jsfdl.adapters.Console.main(Console.java:24)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org.eclipse.persistence.internal.localization.i18n.EclipseLinkLocalizationResource, locale de_DE
        at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2045)
        at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1683)
        at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1586)
        at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1549)
        at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:932)
        at org.eclipse.persistence.internal.localization.EclipseLinkLocalization.buildMessage(EclipseLinkLocalization.java:64)
        at org.eclipse.persistence.internal.localization.EclipseLinkLocalization.buildMessage(EclipseLinkLocalization.java:36)
        at org.eclipse.persistence.internal.localization.JAXBLocalization.buildMessage(JAXBLocalization.java:19)
        at org.eclipse.persistence.jaxb.compiler.MappingsGenerator.logMappingGeneration(MappingsGenerator.java:3523)
        at org.eclipse.persistence.jaxb.compiler.MappingsGenerator.generateMappings(MappingsGenerator.java:2518)
        at org.eclipse.persistence.jaxb.compiler.MappingsGenerator.generateProject(MappingsGenerator.java:265)
        at org.eclipse.persistence.jaxb.compiler.Generator.generateProject(Generator.java:182)
        at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1178)
        at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1170)
        ... 9 more

the same error i get when i use minimize() in shadowJar So i assume, native-image calls that too. Please provide an option to disable that!

Describe the solution you'd like Add an option to disable minimize(), so i can run that native-image

Describe alternatives you've considered use the shadowJar

Additional context

vjovanov commented 1 year ago

You are likely missing metadata for that bundle:

https://www.graalvm.org/22.2/reference-manual/native-image/metadata/

damnms commented 1 year ago

i had the metadata repo in my build.gradle

vjovanov commented 1 year ago

Right, I still don't quite understand the request in this bug. What is minimize, how is it used, in which library?

damnms commented 1 year ago

minimize() is part of shadowJar, its a setting that can be used to minimize the produced jar my assumption(!) is, that graalvm also uses this in some sort (remove stuff that is required) because it was the same error. but its just a guess!

melix commented 1 year ago

I don't understand this bug report either. shadow may have a minimize function, but it's unrelated to this plugin. The GraalVM plugin may require additional metadata to run properly, such as reflection metadata or resources definition. Make sure to follow the information about autodectecting resources here for example.

damnms commented 1 year ago

this bug report should be clear. i had the metadata repo added and it DID NOT WORK. this is the bug. period.

my ASSUMPTION is that this plugin uses some "optimize/minimize" code functions that lead to this error which are more or less the same as in shadowjar's minimize, because i get the same error in shadowjar when i use minimize(). but again, its just a guess(!). i am not a developer of graalvm, so i cant know what code is used in the "optimize" functions. i am also not a shadowjar developer, so i also dont know what sort of "minimize()" logic they use in their plugin.

anyway, i give up. its frustrating and annoying to argue about bugs and then talk about stuff that is absolutely unrelated, but come to my mind or might be somehow related. i switched to jlink/jpackage. that works.

melix commented 1 year ago

Adding the metadata repository will not make your application work if the metadata repository doesn't contain enough information about the libraries you are using. Its goal is to provide metadata for common dependencies, but if the issue comes from your application code, for example, it won't help. Similarly if the module that you are using is not providing metadata.

damnms commented 1 year ago

i tested it with 2 different jaxb implementations, both did not work. this was moxy and the glassfish jaxb impl.