No classes have been predefined during the image build to load from bytecodes at runtime
By reference to the AOT support guide, https://tomcat.apache.org/tomcat-9.0-doc/graal.html, I built a spring framework 6.x based web application into a native image. I'm using GraalVM for JDK17. When finally ran the native image, it gave following error message: INFO: Initializing Spring root WebApplicationContext Feb 23, 2024 4:04:24 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener] com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime. at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92) at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76) at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130) at java.base@17.0.10 /java.lang.ClassLoader.defineClass(ClassLoader.java:294) The web application is running well in terms of WAR on Tomcat10.x, and tomcat-stuffed-1.0.jar also running well. Could you please confirm whether a spring framework 6.x web application is also applicable to the AOT support approach? And I would appreciate your insights on above native image runtime errors. Best regards, Jun
How to deal with beans.xml during process of GraalVM native image build?
Within a spring framework application, it uses beanx.xml to define a bean names "GreetingService": And this bean is being called as below: === ApplicationContext context = new ClassPathXmlApplicationContext("config/beans.xml"); GreetingService greetingService = (GreetingService)context.getBean("greetingService"); PrintWriter out = resp.getWriter(); out.println(greetingService.getGreetingMessage()); === Above code runs perfectly as a war file on Tomcat. But when I try to transform the war file into native image by following the guidelines(https://tomcat.apache.org/tomcat-11.0-doc/graal.html), maven build gave following errors: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project tomcat-stuffed: Compilation failure [ERROR] /home/opc/project/test/tomcat-native/stuffed/src/main/java/com/example/servlet/GreetServlet.java:[55,36] cannot find symbol [ERROR] symbol: method getGreetingMessage() [ERROR] location: variable greetingService of type com.example.service.GreetingService Beans.xml is under the "src/main/resources" folder. To which directory should I copy the beans.xml under the stuffed folder? ("conf" folder or "src" folder?) By the way, when using Java configuration to configure the bean instead of using beans.xml, everything goes perfectly without errors. May I confirm, whether XML-based bean configuration within a spring framework application is also applicable to the process of AOT/GraalVM support? Jun - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Run Tomcat as native image
2023年12月20日(水) 19:55 Rémy Maucherat : > > On Wed, Dec 20, 2023 at 5:33 AM Jun Suzuki wrote: > > > > 2023年12月19日(火) 16:11 Jun Suzuki : > > > > > > 2023年12月19日(火) 1:18 Rémy Maucherat : > > > > > > > > On Mon, Dec 18, 2023 at 1:28 PM Jun Suzuki > > > > wrote: > > > > > > > > > > Hello all, > > > > > > > > > > I'm now following the guide of > > > > > https://tomcat.apache.org/tomcat-11.0-doc/graal.html to build Tomcat > > > > > into native image. > > > > > The original thread I posted before has become too long to be easily > > > > > understood, so please let me raise a new thread to clarify. > > > > > I break down the contents from the guide into a step-by-step > > > > > procedure, and I would appreciate it if you can verify the steps and > > > > > check for the issues. > > > > > > > > > > [Environment]: Tomcat 10.0.27, Ant 1.10.14, Maven 3.6.3, GraalVM EE > > > > > 21.x+Java17 > > > > > [Steps]: > > > > > 1. Download the stuffed folder according to the guide. > > > > > 2. Edit the original pom to align with the Tomcat and JDK version: > > > > > > > > > > > > > > > UTF-8 > > > > > org.apache.catalina.startup.Tomcat > > > > > 10.0.27 > > > > > > > > > > .. > > > > > > > > > > org.apache.maven.plugins > > > > > maven-compiler-plugin > > > > > 3.11.0 > > > > > > > > > > 11 > > > > > > > > > > > > > > > 3. Copy conf and webapps folders from Tomcat to the stuffed folder. > > > > > 4. Edit the logging properties(Deleted all Juli-related statements to > > > > > avoid runtime error) > > > > > handlers = java.util.logging.ConsoleHandler > > > > > .handlers = java.util.logging.ConsoleHandler > > > > > . > > > > > java.util.logging.ConsoleHandler.level = FINE > > > > > # java.util.logging.ConsoleHandler.formatter = > > > > > org.apache.juli.OneLineFormatter > > > > > java.util.logging.ConsoleHandler.encoding = UTF-8 > > > > > 5. Build and packaging. > > > > > mvn package > > > > > ant -Dwebapp.name=ROOT -f webapp-jspc.ant.xml > > > > > ant -Dwebapp.name=manager -f webapp-jspc.ant.xml > > > > > ant -Dwebapp.name=examples -f webapp-jspc.ant.xml > > > > > > > > > > Until here everything was running fine without error. And when I > > > > > executed the next command, error message displayed as below: > > > > > mvn package > > > > > .. > > > > > [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ > > > > > tomcat-stuffed --- > > > > > [INFO] Changes detected - recompiling the module! :source > > > > > [INFO] Compiling 130 source files with javac [debug release 17] to > > > > > target/classes > > > > > [INFO] > > > > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > > > > Some input files use unchecked or unsafe operations. > > > > > [INFO] > > > > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > > > > Recompile with -Xlint:unchecked for details. > > > > > [INFO] Some messages have been simplified; recompile with > > > > > -Xdiags:verbose to get full output > > > > > [INFO] - > > > > > [ERROR] COMPILATION ERROR : > > > > > [INFO] - > > > > > [ERROR] > > > > > /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[162,210] > > > > > cannot access javax.servlet.jsp.tagext.TagSupport > > > > > class file for javax.
Re: Run Tomcat as native image
2023年12月19日(火) 16:11 Jun Suzuki : > > 2023年12月19日(火) 1:18 Rémy Maucherat : > > > > On Mon, Dec 18, 2023 at 1:28 PM Jun Suzuki wrote: > > > > > > Hello all, > > > > > > I'm now following the guide of > > > https://tomcat.apache.org/tomcat-11.0-doc/graal.html to build Tomcat > > > into native image. > > > The original thread I posted before has become too long to be easily > > > understood, so please let me raise a new thread to clarify. > > > I break down the contents from the guide into a step-by-step > > > procedure, and I would appreciate it if you can verify the steps and > > > check for the issues. > > > > > > [Environment]: Tomcat 10.0.27, Ant 1.10.14, Maven 3.6.3, GraalVM EE > > > 21.x+Java17 > > > [Steps]: > > > 1. Download the stuffed folder according to the guide. > > > 2. Edit the original pom to align with the Tomcat and JDK version: > > > > > > UTF-8 > > > org.apache.catalina.startup.Tomcat > > > 10.0.27 > > > > > > .. > > > > > > org.apache.maven.plugins > > > maven-compiler-plugin > > > 3.11.0 > > > > > > 11 > > > > > > > > > 3. Copy conf and webapps folders from Tomcat to the stuffed folder. > > > 4. Edit the logging properties(Deleted all Juli-related statements to > > > avoid runtime error) > > > handlers = java.util.logging.ConsoleHandler > > > .handlers = java.util.logging.ConsoleHandler > > > . > > > java.util.logging.ConsoleHandler.level = FINE > > > # java.util.logging.ConsoleHandler.formatter = > > > org.apache.juli.OneLineFormatter > > > java.util.logging.ConsoleHandler.encoding = UTF-8 > > > 5. Build and packaging. > > > mvn package > > > ant -Dwebapp.name=ROOT -f webapp-jspc.ant.xml > > > ant -Dwebapp.name=manager -f webapp-jspc.ant.xml > > > ant -Dwebapp.name=examples -f webapp-jspc.ant.xml > > > > > > Until here everything was running fine without error. And when I > > > executed the next command, error message displayed as below: > > > mvn package > > > .. > > > [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ > > > tomcat-stuffed --- > > > [INFO] Changes detected - recompiling the module! :source > > > [INFO] Compiling 130 source files with javac [debug release 17] to > > > target/classes > > > [INFO] > > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > > Some input files use unchecked or unsafe operations. > > > [INFO] > > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > > Recompile with -Xlint:unchecked for details. > > > [INFO] Some messages have been simplified; recompile with > > > -Xdiags:verbose to get full output > > > [INFO] - > > > [ERROR] COMPILATION ERROR : > > > [INFO] - > > > [ERROR] > > > /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[162,210] > > > cannot access javax.servlet.jsp.tagext.TagSupport > > > class file for javax.servlet.jsp.tagext.TagSupport not found > > > [ERROR] > > > /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[165,35] > > > cannot access javax.servlet.jsp.tagext.Tag > > > class file for javax.servlet.jsp.tagext.Tag not found > > > .. > > > > > > Could you please help to indicate what I have missed from the above steps? > > > And I would really appreciate it if you could offer some kind of > > > step-by-step hands-on examples about how to practice to run Tomcat as > > > native image. > > > > This seems unrelated, you are apparently trying to run an EE8 webapp > > (the examples from Tomcat 9) on a EE10 container. The package name
Re: Run Tomcat as native image
2023年12月19日(火) 1:18 Rémy Maucherat : > > On Mon, Dec 18, 2023 at 1:28 PM Jun Suzuki wrote: > > > > Hello all, > > > > I'm now following the guide of > > https://tomcat.apache.org/tomcat-11.0-doc/graal.html to build Tomcat > > into native image. > > The original thread I posted before has become too long to be easily > > understood, so please let me raise a new thread to clarify. > > I break down the contents from the guide into a step-by-step > > procedure, and I would appreciate it if you can verify the steps and > > check for the issues. > > > > [Environment]: Tomcat 10.0.27, Ant 1.10.14, Maven 3.6.3, GraalVM EE > > 21.x+Java17 > > [Steps]: > > 1. Download the stuffed folder according to the guide. > > 2. Edit the original pom to align with the Tomcat and JDK version: > > > > UTF-8 > > org.apache.catalina.startup.Tomcat > > 10.0.27 > > > > .. > > > > org.apache.maven.plugins > > maven-compiler-plugin > > 3.11.0 > > > > 11 > > > > > > 3. Copy conf and webapps folders from Tomcat to the stuffed folder. > > 4. Edit the logging properties(Deleted all Juli-related statements to > > avoid runtime error) > > handlers = java.util.logging.ConsoleHandler > > .handlers = java.util.logging.ConsoleHandler > > . > > java.util.logging.ConsoleHandler.level = FINE > > # java.util.logging.ConsoleHandler.formatter = > > org.apache.juli.OneLineFormatter > > java.util.logging.ConsoleHandler.encoding = UTF-8 > > 5. Build and packaging. > > mvn package > > ant -Dwebapp.name=ROOT -f webapp-jspc.ant.xml > > ant -Dwebapp.name=manager -f webapp-jspc.ant.xml > > ant -Dwebapp.name=examples -f webapp-jspc.ant.xml > > > > Until here everything was running fine without error. And when I > > executed the next command, error message displayed as below: > > mvn package > > .. > > [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ > > tomcat-stuffed --- > > [INFO] Changes detected - recompiling the module! :source > > [INFO] Compiling 130 source files with javac [debug release 17] to > > target/classes > > [INFO] > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > Some input files use unchecked or unsafe operations. > > [INFO] > > /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: > > Recompile with -Xlint:unchecked for details. > > [INFO] Some messages have been simplified; recompile with > > -Xdiags:verbose to get full output > > [INFO] - > > [ERROR] COMPILATION ERROR : > > [INFO] - > > [ERROR] > > /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[162,210] > > cannot access javax.servlet.jsp.tagext.TagSupport > > class file for javax.servlet.jsp.tagext.TagSupport not found > > [ERROR] > > /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[165,35] > > cannot access javax.servlet.jsp.tagext.Tag > > class file for javax.servlet.jsp.tagext.Tag not found > > .. > > > > Could you please help to indicate what I have missed from the above steps? > > And I would really appreciate it if you could offer some kind of > > step-by-step hands-on examples about how to practice to run Tomcat as > > native image. > > This seems unrelated, you are apparently trying to run an EE8 webapp > (the examples from Tomcat 9) on a EE10 container. The package names > for the APIs changed to jakarta.*. > > Rémy > Thank you for the comments. To avoid excessive trial and error, is it possible to provide a combination of tested versions that ensure default Tomcat examples running in native image without error? Could you please indicate the version of Tomcat, GraalVM(EE or CE), JDK, maven, ant? I want to use these specific versions you pointed to make sure default Tomcat examples will run normally in term of native image without additional customization. Thank you in advance. Jun - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Run Tomcat as native image
Hello all, I'm now following the guide of https://tomcat.apache.org/tomcat-11.0-doc/graal.html to build Tomcat into native image. The original thread I posted before has become too long to be easily understood, so please let me raise a new thread to clarify. I break down the contents from the guide into a step-by-step procedure, and I would appreciate it if you can verify the steps and check for the issues. [Environment]: Tomcat 10.0.27, Ant 1.10.14, Maven 3.6.3, GraalVM EE 21.x+Java17 [Steps]: 1. Download the stuffed folder according to the guide. 2. Edit the original pom to align with the Tomcat and JDK version: UTF-8 org.apache.catalina.startup.Tomcat 10.0.27 .. org.apache.maven.plugins maven-compiler-plugin 3.11.0 11 3. Copy conf and webapps folders from Tomcat to the stuffed folder. 4. Edit the logging properties(Deleted all Juli-related statements to avoid runtime error) handlers = java.util.logging.ConsoleHandler .handlers = java.util.logging.ConsoleHandler . java.util.logging.ConsoleHandler.level = FINE # java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter java.util.logging.ConsoleHandler.encoding = UTF-8 5. Build and packaging. mvn package ant -Dwebapp.name=ROOT -f webapp-jspc.ant.xml ant -Dwebapp.name=manager -f webapp-jspc.ant.xml ant -Dwebapp.name=examples -f webapp-jspc.ant.xml Until here everything was running fine without error. And when I executed the next command, error message displayed as below: mvn package .. [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ tomcat-stuffed --- [INFO] Changes detected - recompiling the module! :source [INFO] Compiling 130 source files with javac [debug release 17] to target/classes [INFO] /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: Some input files use unchecked or unsafe operations. [INFO] /home/opc/project/tomcat-native/stuffed/src/main/java/manager/org/apache/jsp/WEB_002dINF/jsp/sessionsList_jsp.java: Recompile with -Xlint:unchecked for details. [INFO] Some messages have been simplified; recompile with -Xdiags:verbose to get full output [INFO] - [ERROR] COMPILATION ERROR : [INFO] - [ERROR] /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[162,210] cannot access javax.servlet.jsp.tagext.TagSupport class file for javax.servlet.jsp.tagext.TagSupport not found [ERROR] /home/opc/project/tomcat-native/stuffed/src/main/java/examples/org/apache/jsp/jsp/tagplugin/choose_jsp.java:[165,35] cannot access javax.servlet.jsp.tagext.Tag class file for javax.servlet.jsp.tagext.Tag not found .. Could you please help to indicate what I have missed from the above steps? And I would really appreciate it if you could offer some kind of step-by-step hands-on examples about how to practice to run Tomcat as native image. Thank you Jun - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Issues of Ahead of Time compilation support
Christopher, 2023年12月16日(土) 3:41 Christopher Schultz : > > Jun, > > On 12/15/23 08:56, Jun Suzuki wrote: > > 2023年12月15日(金) 20:37 Rémy Maucherat : > >> > >> On Fri, Dec 15, 2023 at 11:54 AM Jun Suzuki > >> wrote: > >>> > >>> Rémy > >>> Thank you so much for your support. > >>> May I confirm a little bit further regarding your reply. > >>> > >>> 2023年12月15日(金) 17:08 Rémy Maucherat : > >>>> > >>>> On Fri, Dec 15, 2023 at 4:18 AM Jun Suzuki > >>>> wrote: > >>> > >>>>> (1) Guidance is not so clear about following points: > >>>>> Should I copy the deployed application(with or without war file?) from > >>>>> existing Tomcat server webapps directory, to webapps directory of > >>>>> $TOMCAT_STUFFED? > >>>>> Should I copy all the files from conf directory of existing Tomcat > >>>>> server, to conf directory of $TOMCAT_STUFFED? > >>>> > >>>> Yes. > >>>> When building your image, you have to compile all the classes into it. > >>>> So that means all the classes of the webapp as well. So if you don't > >>>> copy your webapp for the script to compile, no webapp classes ... Also > >>>> all the webapp Java classes and JARs will have to be included in the > >>>> image as well for annotation scanning. > >>> > >>> Is it correct that following source from existing Tomcat Server needed > >>> to be copied into $TOMCAT_STUFFED? > >>> A. All files under conf folder (including war file) > >>> B. All files under webapps folder > >>> C. How about lib folder? Should it also be copied? > >>> D. How about java source code(which are not deployed on Tomcat) > >> > >> The doc is correct, so just use that: > >> - Copy config files from conf (obvious) > >> - Webapps go in webapps (unless the host appBase is something else) > >> And that's it. > >> > >>>> > >>>>> (2) On the step of execution of "$JAVA_HOME/bin/java -Dcatalina.base=. > >>>>> -Djava.util.logging.config.file=conf/logging.properties -jar > >>>>> target/tomcat-stuffed-1.0.jar --catalina -generateCode src/main/java", > >>>>> errors messages show as below: > >>>>> ... > >>>>> Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler" > >>>>> java.lang.ClassNotFoundException: > >>>>> 1catalina.org.apache.juli.AsyncFileHandler > >>>>> java.lang.ClassNotFoundException: > >>>>> 1catalina.org.apache.juli.AsyncFileHandler > >>>>> at > >>>>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) > >>>>> at > >>>>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) > >>>>> at > >>>>> java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) > >>>>> ... > >>>> > >>>> Yes, avoid the juli file handlers. There's a jul file handler I think: > >>>> java.util.logging.FileHandler > >>> > >>> I revised the source code by deleting "import java.util.*", and I > >>> recompiled the java source and copied the war file into > >>> $TOMCAT_STUFFED. > >>> However, the error message remains: > >>> Can't load log handler "1localhost.org.apache.juli.AsyncFileHandler" > >>> java.lang.ClassNotFoundException: > >>> 1localhost.org.apache.juli.AsyncFileHandler > >>> ... > >>> Can't load log handler "2localhost.org.apache.juli.AsyncFileHandler" > >>> java.lang.ClassNotFoundException: > >>> 2localhost.org.apache.juli.AsyncFileHandler > >> > >> Use stuff from java.util.logging instead if juli doesn't work for you. > >> Or change the pom to add it. Juli makes things more complex with > >> Graal, so the pom doesn't have it. > >> As explained in the doc, the pom needs to be edited for needed > >> dependencies. > >> > >>> ... > >>> 15-Dec-2023 10:35:47.580 INFO [main] > >>> org.apache.cata
Re: Issues of Ahead of Time compilation support
2023年12月15日(金) 20:37 Rémy Maucherat : > > On Fri, Dec 15, 2023 at 11:54 AM Jun Suzuki wrote: > > > > Rémy > > Thank you so much for your support. > > May I confirm a little bit further regarding your reply. > > > > 2023年12月15日(金) 17:08 Rémy Maucherat : > > > > > > On Fri, Dec 15, 2023 at 4:18 AM Jun Suzuki > > > wrote: > > > > > > (1) Guidance is not so clear about following points: > > > > Should I copy the deployed application(with or without war file?) from > > > > existing Tomcat server webapps directory, to webapps directory of > > > > $TOMCAT_STUFFED? > > > > Should I copy all the files from conf directory of existing Tomcat > > > > server, to conf directory of $TOMCAT_STUFFED? > > > > > > Yes. > > > When building your image, you have to compile all the classes into it. > > > So that means all the classes of the webapp as well. So if you don't > > > copy your webapp for the script to compile, no webapp classes ... Also > > > all the webapp Java classes and JARs will have to be included in the > > > image as well for annotation scanning. > > > > Is it correct that following source from existing Tomcat Server needed > > to be copied into $TOMCAT_STUFFED? > > A. All files under conf folder (including war file) > > B. All files under webapps folder > > C. How about lib folder? Should it also be copied? > > D. How about java source code(which are not deployed on Tomcat) > > The doc is correct, so just use that: > - Copy config files from conf (obvious) > - Webapps go in webapps (unless the host appBase is something else) > And that's it. > > > > > > > > (2) On the step of execution of "$JAVA_HOME/bin/java -Dcatalina.base=. > > > > -Djava.util.logging.config.file=conf/logging.properties -jar > > > > target/tomcat-stuffed-1.0.jar --catalina -generateCode src/main/java", > > > > errors messages show as below: > > > > ... > > > > Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler" > > > > java.lang.ClassNotFoundException: > > > > 1catalina.org.apache.juli.AsyncFileHandler > > > > java.lang.ClassNotFoundException: > > > > 1catalina.org.apache.juli.AsyncFileHandler > > > > at > > > > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) > > > > at > > > > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) > > > > at > > > > java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) > > > > ... > > > > > > Yes, avoid the juli file handlers. There's a jul file handler I think: > > > java.util.logging.FileHandler > > > > I revised the source code by deleting "import java.util.*", and I > > recompiled the java source and copied the war file into > > $TOMCAT_STUFFED. > > However, the error message remains: > > Can't load log handler "1localhost.org.apache.juli.AsyncFileHandler" > > java.lang.ClassNotFoundException: > > 1localhost.org.apache.juli.AsyncFileHandler > > ... > > Can't load log handler "2localhost.org.apache.juli.AsyncFileHandler" > > java.lang.ClassNotFoundException: > > 2localhost.org.apache.juli.AsyncFileHandler > > Use stuff from java.util.logging instead if juli doesn't work for you. > Or change the pom to add it. Juli makes things more complex with > Graal, so the pom doesn't have it. > As explained in the doc, the pom needs to be edited for needed dependencies. > > > ... > > 15-Dec-2023 10:35:47.580 INFO [main] > > org.apache.catalina.startup.HostConfig.deployDirectory Deployment of > > web application directory > > [/home/opc/project/tomcat-native/stuffed/webapps/ROOT] has finished in > > [215] ms > > 15-Dec-2023 10:35:47.580 INFO [main] > > org.apache.catalina.startup.HostConfig.deployDirectory Deployment of > > web application directory > > [/home/opc/project/tomcat-native/stuffed/webapps/ROOT] has finished in > > [215] ms > > 15-Dec-2023 10:35:47.583 INFO [main] > > org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler > > ["http-nio-8080"] > > 15-Dec-2023 10:35:47.583 INFO [main] > > org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler > >
Re: Issues of Ahead of Time compilation support
Rémy Thank you so much for your support. May I confirm a little bit further regarding your reply. 2023年12月15日(金) 17:08 Rémy Maucherat : > > On Fri, Dec 15, 2023 at 4:18 AM Jun Suzuki wrote: > > (1) Guidance is not so clear about following points: > > Should I copy the deployed application(with or without war file?) from > > existing Tomcat server webapps directory, to webapps directory of > > $TOMCAT_STUFFED? > > Should I copy all the files from conf directory of existing Tomcat > > server, to conf directory of $TOMCAT_STUFFED? > > Yes. > When building your image, you have to compile all the classes into it. > So that means all the classes of the webapp as well. So if you don't > copy your webapp for the script to compile, no webapp classes ... Also > all the webapp Java classes and JARs will have to be included in the > image as well for annotation scanning. Is it correct that following source from existing Tomcat Server needed to be copied into $TOMCAT_STUFFED? A. All files under conf folder (including war file) B. All files under webapps folder C. How about lib folder? Should it also be copied? D. How about java source code(which are not deployed on Tomcat) > > > (2) On the step of execution of "$JAVA_HOME/bin/java -Dcatalina.base=. > > -Djava.util.logging.config.file=conf/logging.properties -jar > > target/tomcat-stuffed-1.0.jar --catalina -generateCode src/main/java", > > errors messages show as below: > > ... > > Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler" > > java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler > > java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler > > at > > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) > > at > > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) > > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) > > ... > > Yes, avoid the juli file handlers. There's a jul file handler I think: > java.util.logging.FileHandler I revised the source code by deleting "import java.util.*", and I recompiled the java source and copied the war file into $TOMCAT_STUFFED. However, the error message remains: Can't load log handler "1localhost.org.apache.juli.AsyncFileHandler" java.lang.ClassNotFoundException: 1localhost.org.apache.juli.AsyncFileHandler ... Can't load log handler "2localhost.org.apache.juli.AsyncFileHandler" java.lang.ClassNotFoundException: 2localhost.org.apache.juli.AsyncFileHandler ... 15-Dec-2023 10:35:47.580 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/opc/project/tomcat-native/stuffed/webapps/ROOT] has finished in [215] ms 15-Dec-2023 10:35:47.580 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/opc/project/tomcat-native/stuffed/webapps/ROOT] has finished in [215] ms 15-Dec-2023 10:35:47.583 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 15-Dec-2023 10:35:47.583 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] Since the error messages are showing as above and the process is hanging on there, I could not proceed with the step of the next "maven package" unless I open another terminal to run maven command. Do you have any idea about how to fix this error? Thank you - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Issues of Ahead of Time compilation support
Hello all, Does anyone have experience of implementation of AOT/GraalVM by following official documentation as below? https://tomcat.apache.org/tomcat-9.0-doc/graal.html I created a simple spring framework application(deployed as a war file) which is working well under Tomcat10.x, GraalVM21 with JDK21. Then I'm trying to transform the application into native image based on the documentation. I download the Tomcat Stuffed module and started to do packaging and building. However, I encountered some issues by following the steps from the documentation. (1) Guidance is not so clear about following points: Should I copy the deployed application(with or without war file?) from existing Tomcat server webapps directory, to webapps directory of $TOMCAT_STUFFED? Should I copy all the files from conf directory of existing Tomcat server, to conf directory of $TOMCAT_STUFFED? (2) On the step of execution of "$JAVA_HOME/bin/java -Dcatalina.base=. -Djava.util.logging.config.file=conf/logging.properties -jar target/tomcat-stuffed-1.0.jar --catalina -generateCode src/main/java", errors messages show as below: ... Can't load log handler "1catalina.org.apache.juli.AsyncFileHandler" java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler java.lang.ClassNotFoundException: 1catalina.org.apache.juli.AsyncFileHandler at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ... (3) When using JDK17, the first step of maven build failed with following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project tomcat-stuffed: Fatal error compiling: error: release version 21 not supported. After I switched to JDK21, build completed successfully. Is the approach only support JDK21? Please kindly provide any insights on this. Thank you Jun - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org