On Thu, Mar 28, 2019 at 3:38 PM Rémy Maucherat <r...@apache.org> wrote:
> On Wed, Mar 20, 2019 at 4:45 PM Romain Manni-Bucau <rmannibu...@gmail.com> > wrote: > >> Most of the time monitoring is done through a custom exporter in practise >> based on other impl - sigar, library integration like >> hibernate/eclipselinks ones, metrics, microprofile etc... - and JMX is >> not >> then used - not judging it is good, bad, lack of knowledge or not, just >> saying what i see. >> Now I'm happy if JMX is made graal compatible. From what I saw, mainly the >> MBeanServer and Notifier (through the hierarchy it goes until that point >> in >> the JVM in standard mbeans) are blocking the compilation. I'm pretty sure >> these parts of Tomcat can be extracted in a particular class and then >> substrated which would make it graal compatible probably. >> > > Ok, so I had a (quick) look, and this doesn't seem to be something that is > adapted to Tomcat at this time. > > Steps: > - I built the embedded packaging here > https://github.com/apache/tomcat/tree/master/res/tomcat-maven > - It produces a standalone jar in target/tomcat-maven-1.0.jar > - Une the graal tool $GRAALVM/bin/native-image -jar > target/tomcat-maven-1.0.jar > > Produces: > Error: No instances are allowed in the image heap for a class that is > initialized or reinitialized at image runtime: > java.util.logging.SimpleFormatter > Detailed message: > Error: No instances are allowed in the image heap for a class that is > initialized or reinitialized at image runtime: > java.util.logging.SimpleFormatter > Trace: object java.util.logging.ConsoleHandler > object java.lang.Object[] > object java.util.concurrent.CopyOnWriteArrayList > object java.util.logging.LogManager$RootLogger > object java.util.logging.Logger > object org.apache.juli.logging.DirectJDKLog > method > org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleState, > Object, boolean) > Call path from entry point to > org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleState, > Object, boolean): > at > org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:390) > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:193) > at org.apache.catalina.startup.Tomcat.start(Tomcat.java:455) > at org.apache.catalina.startup.Tomcat.main(Tomcat.java:1444) > at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:152) > at > com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0) > > If you want to work on this, you can (git makes it easy) but it looks a > bit daunting at this point (java.util.logging is not supported either ? > this is not documented at > https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md ). > https://www.graalvm.org/docs/release-notes/#10-rc16 finally adds java.util.logging support, so I can resume investigations. ../graalvm-ce-1.0.0-rc16/bin/native-image -jar tomcat-maven-1.0.jar Build on Server(pid: 1452, port: 38003)* [tomcat-maven-1.0:1452] classlist: 2,157.50 ms [tomcat-maven-1.0:1452] (cap): 801.03 ms [tomcat-maven-1.0:1452] setup: 1,746.56 ms [tomcat-maven-1.0:1452] (typeflow): 4,968.17 ms [tomcat-maven-1.0:1452] (objects): 3,425.07 ms [tomcat-maven-1.0:1452] (features): 176.88 ms [tomcat-maven-1.0:1452] analysis: 8,816.22 ms [tomcat-maven-1.0:1452] universe: 289.24 ms Warning: Reflection method java.lang.Class.forName invoked at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:686) Warning: Reflection method java.lang.Class.forName invoked at org.apache.catalina.core.NamingContextListener.constructEnvEntry(NamingContextListener.java:797) Warning: Reflection method java.lang.Class.forName invoked at org.apache.tomcat.util.modeler.ManagedBean.createMBean(ManagedBean.java:303) Warning: Reflection method java.lang.Class.forName invoked at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:821) Warning: Reflection method java.lang.Class.forName invoked at org.apache.catalina.realm.RealmBase.createUsernameRetriever(RealmBase.java:1506) Warning: Reflection method java.lang.Class.forName invoked at org.apache.catalina.startup.Tomcat.createContext(Tomcat.java:964) Warning: Reflection method java.lang.Class.forName invoked at org.apache.tomcat.util.modeler.Registry.getModelerSource(Registry.java:723) Warning: Reflection method java.lang.Class.getMethod invoked at org.apache.tomcat.util.modeler.ManagedBean.getGetter(ManagedBean.java:450) Warning: Reflection method java.lang.Class.getMethod invoked at org.apache.tomcat.util.modeler.ManagedBean.getGetter(ManagedBean.java:443) Warning: Reflection method java.lang.Class.getMethod invoked at org.apache.catalina.deploy.NamingResourcesImpl.cleanUp(NamingResourcesImpl.java:1061) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.realm.RealmBase.createUsernameRetriever(RealmBase.java:1507) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.tomcat.util.modeler.ManagedBean.createMBean(ManagedBean.java:323) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.core.NamingContextListener.constructEnvEntry(NamingContextListener.java:800) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.core.NamingContextListener.constructEnvEntry(NamingContextListener.java:811) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.startup.Tomcat.createContext(Tomcat.java:964) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:821) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:687) Warning: Reflection method java.lang.Class.getConstructor invoked at org.apache.tomcat.util.modeler.Registry.getModelerSource(Registry.java:724) Warning: Reflection method java.lang.ClassLoader.loadClass invoked at org.apache.tomcat.util.modeler.ManagedBean.createMBean(ManagedBean.java:311) Warning: Abort stand-alone image build due to reflection use without configuration. Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception Build on Server(pid: 1452, port: 38003) [tomcat-maven-1.0:1452] classlist: 130.82 ms [tomcat-maven-1.0:1452] (cap): 514.25 ms [tomcat-maven-1.0:1452] setup: 789.01 ms [tomcat-maven-1.0:1452] (typeflow): 1,503.13 ms [tomcat-maven-1.0:1452] (objects): 550.15 ms [tomcat-maven-1.0:1452] (features): 116.25 ms [tomcat-maven-1.0:1452] analysis: 2,211.18 ms [tomcat-maven-1.0:1452] universe: 86.11 ms [tomcat-maven-1.0:1452] (parse): 319.54 ms [tomcat-maven-1.0:1452] (inline): 886.40 ms [tomcat-maven-1.0:1452] (compile): 2,731.85 ms [tomcat-maven-1.0:1452] compile: 4,189.10 ms [tomcat-maven-1.0:1452] image: 238.35 ms [tomcat-maven-1.0:1452] write: 66.38 ms [tomcat-maven-1.0:1452] [total]: 7,756.62 ms Warning: Image 'tomcat-maven-1.0' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation). This generates a 'tomcat-maven-1.0' executable, which runs and works but most likely does nothing really useful at this point. However, it's something and it's no longer unusable. Rémy