Re: Issues of Ahead of Time compilation support

2023-12-15 Thread Jun Suzuki
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.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?
> >>
> >> Well, there's no error there, so it's fine. The process is to generate
> >> reflection metadata for your webapp depending on what it needs, so you
> >> need to write a script that exercises all your 

Re: Issues of Ahead of Time compilation support

2023-12-15 Thread 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.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?


Well, there's no error there, so it's fine. The process is to generate
reflection metadata for your webapp depending on what it needs, so you
need to write a script that exercises all your paths in your webapp
[that would use reflection]. It's kind of like using your webapp
testsuite there. Once that is done, you should shutdown Tomcat as
usual, the metadata has been generated by the agent.
That is explained here:
https://tomcat.apache.org/tomcat-9.0-doc/graal.html#Native_image_configuration

Then you can move on to
https://tomcat.apache.org/tomcat-9.0-doc/graal.html#Building_the_native_image

Rémy

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Thank you  Rémy for your detailed explanation.
So from your explanation, I understand following 

Re: Issues of Ahead of Time compilation support

2023-12-15 Thread Jun Suzuki
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
> > ["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?
>
> Well, there's no error there, so it's fine. The process is to generate
> reflection metadata for your webapp depending on what it needs, so you
> need to write a script that exercises all your paths in your webapp
> [that would use reflection]. It's kind of like using your webapp
> testsuite there. Once that is done, you should shutdown Tomcat as
> usual, the metadata has been generated by the agent.
> That is explained here:
> 

Re: Issues of Ahead of Time compilation support

2023-12-15 Thread 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
> ["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?

Well, there's no error there, so it's fine. The process is to generate
reflection metadata for your webapp depending on what it needs, so you
need to write a script that exercises all your paths in your webapp
[that would use reflection]. It's kind of like using your webapp
testsuite there. Once that is done, you should shutdown Tomcat as
usual, the metadata has been generated by the agent.
That is explained here:
https://tomcat.apache.org/tomcat-9.0-doc/graal.html#Native_image_configuration

Then you can move on to
https://tomcat.apache.org/tomcat-9.0-doc/graal.html#Building_the_native_image

Rémy

-
To unsubscribe, e-mail: 

Re: Issues of Ahead of Time compilation support

2023-12-15 Thread Jun Suzuki
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



Re: Issues of Ahead of Time compilation support

2023-12-15 Thread Rémy Maucherat
On Fri, Dec 15, 2023 at 4:18 AM Jun Suzuki  wrote:
>
> 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?

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.

> (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

> (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?

Yes, if you take the path to stuffed that is mentioned in the docs, it
will be from the "main" Tomcat branch, which means Java 21 (it got
updated since). The module exists on the "10.1.x" branch as well,
where it is Java 11 instead, matching Tomcat 10.1. Don't be afraid to
change the release target and Tomcat version used in the pom.
I'll update the graal.html to at least point to the 10.1.x branch.

Rémy

> 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
>

-
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

2023-12-14 Thread Jun Suzuki
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