native-build-tools icon indicating copy to clipboard operation
native-build-tools copied to clipboard

Improve plugins documentation

Open dnestoro opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. There are missing explanations in the documentation.

Describe the solution you'd like Read the whole docs and see what is missing. Examples:

  • how to pass command line arguments

dnestoro avatar Jun 13 '23 08:06 dnestoro

just stumbled upon the same problem... i'd like to add --initalize-at-build-time=org.eclipse.persistence.exceptions.i18n.JAXBExceptionResource, but no idea where to put that in my build.gradle. i tried

graalvmNative {
    toolchainDetection = true
    binaries {
        main {
            buildArgs.add("--initalize-at-build-time=org.eclipse.persistence.exceptions.i18n.JAXBExceptionResource")
            buildArgs.add("--verbose")
        }
    }
}

because thats what i would have guessed, but it does not work. i can build a native image but when i run it, i get:

Exception in thread "main" jakarta.xml.bind.JAXBException: Can't find bundle for base name org.eclipse.persistence.exceptions.i18n.JAXBExceptionResource, locale de_DE
 - with linked exception:
[java.util.MissingResourceException: Can't find bundle for base name org.eclipse.persistence.exceptions.i18n.JAXBExceptionResource, 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.exceptions.i18n.JAXBExceptionResource, locale de_DE
	at [email protected]/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2045)
	at [email protected]/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1683)
	at [email protected]/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1586)
	at [email protected]/java.util.ResourceBundle.getBundle(ResourceBundle.java:1280)
	at org.eclipse.persistence.exceptions.i18n.ExceptionMessageGenerator.buildMessage(ExceptionMessageGenerator.java:71)
	at org.eclipse.persistence.exceptions.JAXBException.factoryMethodOrConstructorRequired(JAXBException.java:150)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:961)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:309)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:154)
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1169)
	... 9 more

thats why i thought i might fix it with that option

damnms avatar Jun 26 '23 07:06 damnms

Hey @damnms the issue you are mentioning in your comment is not related to the Native Build Tools (especially not related to the documentation).

The issue in your case is that you didn't specify org.eclipse.persistence.exceptions.i18n.JAXBExceptionResource resource bundle with the de_DE locale in the resource-config.json (or in reachability-metadata.json if you are using newer versions of the GraalVM). Therefore, you are getting MissingResourceException.

To fix this, you should add entry in the config file:

  • if you are using latest GraalVM: https://www.graalvm.org/latest/reference-manual/native-image/metadata/#specifying-metadata-with-json
  • if you are using some older version: https://www.graalvm.org/jdk21/reference-manual/native-image/metadata/#resource-metadata-in-json

dnestoro avatar Nov 07 '24 15:11 dnestoro

PR: https://github.com/graalvm/native-build-tools/pull/645

dnestoro avatar Feb 13 '25 10:02 dnestoro