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

Different behavior on building a substrate from commandline or via maven #68

Closed
fipro78 opened this issue Sep 22, 2022 · 2 comments
Closed

Comments

@fipro78
Copy link
Contributor

fipro78 commented Sep 22, 2022

I am trying to create a Graal Substrate for deployment in a Docker container. As the result matches the host system, I suppose I have to create the substrate in a container with the target OS. So I would like to create the substrate image via command line. If I build via commandline with the same instuction as with the maven plugin, starting the application shows the following error:

java.lang.NullPointerException
        at org.eclipse.osgi.internal.url.MultiplexingFactory.<clinit>(MultiplexingFactory.java:69)
        at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findAddURLMethod(FrameworkExtensionInstaller.java:62)
        at org.eclipse.osgi.storage.FrameworkExtensionInstaller.<clinit>(FrameworkExtensionInstaller.java:55)
        at org.eclipse.osgi.storage.Storage.<init>(Storage.java:222)
        at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:184)
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:108)
        at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:53)
        at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:35)
        at org.apache.felix.atomos.impl.base.AtomosBase.newFramework(AtomosBase.java:442)
        at org.apache.felix.atomos.Atomos.main(Atomos.java:236)
g! Warning: NLS missing message: EVENT_ASYNC_THREAD_NAME in: org.eclipse.equinox.internal.event.ExternalMessages
Warning: NLS missing message: EVENT_NULL_EVENT in: org.eclipse.equinox.internal.event.ExternalMessages
Warning: NLS missing message: EVENT_NO_TOPICPERMISSION_PUBLISH in: org.eclipse.equinox.internal.event.ExternalMessages
Warning: NLS missing message: EVENT_DISPATCH_HANDLER_EXCEPTION in: org.eclipse.equinox.internal.event.ExternalMessages
Warning: NLS missing message: EVENT_INVALID_HANDLER_FILTER in: org.eclipse.equinox.internal.event.ExternalMessages
Warning: NLS missing message: EVENT_INVALID_HANDLER_TOPICS in: org.eclipse.equinox.internal.event.ExternalMessages

Apart from that everything seems to work.

Building with the maven plugin like the substrate.lib example, this error does not show up.
Do you know by any chance what needs to be added to the build to get rid of this error on commandline build?

@tjwatson
Copy link
Member

That line withthe NPE is:

			byte[] bytes = StorageUtil.getBytes(MultiplexingFactory.class.getResource("SetAccessible.bytes").openStream(), -1, 4000); //$NON-NLS-1$

It appears the SetAccessible.bytes resource isn't included. The org.eclipse.osgi JAR should have a file META-INF/native-image/resource-config.json. This file {"pattern":"org/eclipse/osgi/internal/url/SetAccessible.bytes"} which should cause the resource to be included. Regardless, IIRC URL handlers in substrate are not supportable because they do not let any other protocols be enabled besides what they build into the executable. So this error is benign. It is a print stacktrace from where we catch all exceptions in MultiplexingFactory.<clinit>

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 27, 2022

Thanks for the response. It seems that is an issue in native-image. I tried to run the command with the module-path, but --add-modules ALL-MODULE-PATH does not work as expected. And actually the only variant that really worked as expected was using the --class-path option and listing all jars explicitly. All other options like using the directory that contains all jars fail.

I opened a ticket at GraalVM graalvm/container#64

Therefore I close this ticket, as it seems to be not related to Atomos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants