GraalVM native image for embedded Tomcat

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GraalVM native image for embedded Tomcat

Martin Grigorov
Hi,

I am trying to create a GraalVM native image for an application that uses
tomcat-embed-core but it fails with the following error:

[INFO] --- native-image-maven-plugin:20.2.0:native-image (default) @
tomcat-embedded ---
[INFO] ImageClasspath Entry:
org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.39:compile
(file:///home/martin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar)
[INFO] ImageClasspath Entry:
org.apache.tomcat:tomcat-annotations-api:jar:9.0.39:compile
(file:///home/martin/.m2/repository/org/apache/tomcat/tomcat-annotations-api/9.0.39/tomcat-annotations-api-9.0.39.jar)
[INFO] ImageClasspath Entry:
info.mgsolutions:tomcat-embedded:jar:1.0-SNAPSHOT
(file:///home/martin/git/http2-server-perf-tests/java/tomcat/target/tomcat-embedded-1.0-SNAPSHOT.jar)
[INFO] Executing:
/home/martin/devel/graalvm-ce-java11-20.2.0/bin/native-image -cp
/home/martin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar:/home/martin/.m2/repository/org/apache/tomcat/tomcat-annotations-api/9.0.39/tomcat-annotations-api-9.0.39.jar:/home/martin/git/http2-server-perf-tests/java/tomcat/target/tomcat-embedded-1.0-SNAPSHOT.jar
-H:Class=info.mgsolutions.tomcat.TomcatEmbedded
[info.mgsolutions.tomcat.tomcatembedded:568255]    classlist:   2,047.64
ms,  0.96 GB
[info.mgsolutions.tomcat.tomcatembedded:568255]        (cap):     852.60
ms,  0.96 GB
[info.mgsolutions.tomcat.tomcatembedded:568255]        setup:   2,323.40
ms,  0.96 GB
Fatal error:java.util.MissingResourceException: Can't find bundle for base
name org.apache.tomcat.util.descriptor.tld.LocalStrings, locale en_US
at
java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
at
java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
at
java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:1284)
at
com.oracle.svm.util.ModuleSupport.getResourceBundleFallback(ModuleSupport.java:81)
at
com.oracle.svm.util.ModuleSupport.getResourceBundle(ModuleSupport.java:62)
at
com.oracle.svm.core.jdk.LocalizationFeature.addBundleToCache(LocalizationFeature.java:266)
at
com.oracle.svm.hosted.ResourcesFeature$ResourcesRegistryImpl.addResourceBundles(ResourcesFeature.java:92)
at
com.oracle.svm.core.configure.ResourceConfigurationParser.parseEntry(ResourceConfigurationParser.java:90)
at
com.oracle.svm.core.configure.ResourceConfigurationParser.parseTopLevelObject(ResourceConfigurationParser.java:71)
at
com.oracle.svm.core.configure.ResourceConfigurationParser.parseAndRegister(ResourceConfigurationParser.java:47)
at
com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:132)
at
com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$3(ConfigurationParserUtils.java:119)
at
java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212)
at
com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:108)
at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326)
at
java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at
java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
at
java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at
java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
at
java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:491)
at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:449)
at
com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:125)
at
com.oracle.svm.hosted.ResourcesFeature.beforeAnalysis(ResourcesFeature.java:105)
at
com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:693)
at
com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
at
com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:693)
at
com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
at
com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
at
java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1


The problem comes from
tomcat-embed-core.jar#/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json
that lists many LocalStrings entries some of which are not really part of
this jar file.

Bug ?

Regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: GraalVM native image for embedded Tomcat

Martin Grigorov
On Fri, Oct 16, 2020 at 3:43 PM Martin Grigorov <[hidden email]>
wrote:

> Hi,
>
> I am trying to create a GraalVM native image for an application that uses
> tomcat-embed-core but it fails with the following error:
>
> [INFO] --- native-image-maven-plugin:20.2.0:native-image (default) @
> tomcat-embedded ---
> [INFO] ImageClasspath Entry:
> org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.39:compile
> (file:///home/martin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar)
> [INFO] ImageClasspath Entry:
> org.apache.tomcat:tomcat-annotations-api:jar:9.0.39:compile
> (file:///home/martin/.m2/repository/org/apache/tomcat/tomcat-annotations-api/9.0.39/tomcat-annotations-api-9.0.39.jar)
> [INFO] ImageClasspath Entry:
> info.mgsolutions:tomcat-embedded:jar:1.0-SNAPSHOT
> (file:///home/martin/git/http2-server-perf-tests/java/tomcat/target/tomcat-embedded-1.0-SNAPSHOT.jar)
> [INFO] Executing:
> /home/martin/devel/graalvm-ce-java11-20.2.0/bin/native-image -cp
> /home/martin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.39/tomcat-embed-core-9.0.39.jar:/home/martin/.m2/repository/org/apache/tomcat/tomcat-annotations-api/9.0.39/tomcat-annotations-api-9.0.39.jar:/home/martin/git/http2-server-perf-tests/java/tomcat/target/tomcat-embedded-1.0-SNAPSHOT.jar
> -H:Class=info.mgsolutions.tomcat.TomcatEmbedded
> [info.mgsolutions.tomcat.tomcatembedded:568255]    classlist:   2,047.64
> ms,  0.96 GB
> [info.mgsolutions.tomcat.tomcatembedded:568255]        (cap):     852.60
> ms,  0.96 GB
> [info.mgsolutions.tomcat.tomcatembedded:568255]        setup:   2,323.40
> ms,  0.96 GB
> Fatal error:java.util.MissingResourceException: Can't find bundle for base
> name org.apache.tomcat.util.descriptor.tld.LocalStrings, locale en_US
> at
> java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055)
> at
> java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689)
> at
> java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593)
> at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:1284)
> at
> com.oracle.svm.util.ModuleSupport.getResourceBundleFallback(ModuleSupport.java:81)
> at
> com.oracle.svm.util.ModuleSupport.getResourceBundle(ModuleSupport.java:62)
> at
> com.oracle.svm.core.jdk.LocalizationFeature.addBundleToCache(LocalizationFeature.java:266)
> at
> com.oracle.svm.hosted.ResourcesFeature$ResourcesRegistryImpl.addResourceBundles(ResourcesFeature.java:92)
> at
> com.oracle.svm.core.configure.ResourceConfigurationParser.parseEntry(ResourceConfigurationParser.java:90)
> at
> com.oracle.svm.core.configure.ResourceConfigurationParser.parseTopLevelObject(ResourceConfigurationParser.java:71)
> at
> com.oracle.svm.core.configure.ResourceConfigurationParser.parseAndRegister(ResourceConfigurationParser.java:47)
> at
> com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:132)
> at
> com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$3(ConfigurationParserUtils.java:119)
> at
> java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212)
> at
> com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:108)
> at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326)
> at
> java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
> at
> java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
> at
> java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
> at
> java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
> at
> java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> at
> java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
> at
> java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
> at
> java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
> at
> java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> at
> java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
> at
> java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:491)
> at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:449)
> at
> com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:125)
> at
> com.oracle.svm.hosted.ResourcesFeature.beforeAnalysis(ResourcesFeature.java:105)
> at
> com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:693)
> at
> com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
> at
> com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:693)
> at
> com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
> at
> com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
> at
> java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
> at
> java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
> at
> java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
> at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
> at
> java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
> at
> java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
> Error: Image build request failed with exit status 1
>
>
> The problem comes from
> tomcat-embed-core.jar#/META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json
> that lists many LocalStrings entries some of which are not really part of
> this jar file.
>

Actually it seems just org.apache.tomcat.util.descriptor.tld.LocalStrings
is not part of the jar. Removing the entry for it resolved the problem!


>
> Bug ?
>
> Regards,
> Martin
>