This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 44fbe2c  More Graal tweaks and docs
44fbe2c is described below

commit 44fbe2c47b43232d47e43134faf56084e3217408
Author: remm <r...@apache.org>
AuthorDate: Mon May 13 10:18:04 2019 +0200

    More Graal tweaks and docs
    
    There's still a lot I need to test, fix and verify ...
---
 java/org/apache/catalina/loader/WebappClassLoaderBase.java | 10 ++++++----
 res/tomcat-maven/README.md                                 | 11 +++++++----
 res/tomcat-maven/tomcat-reflection.json                    |  1 +
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java 
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 1ee573b..7418744 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -1614,19 +1614,21 @@ public abstract class WebappClassLoaderBase extends 
URLClassLoader
             }
         }
 
-        // De-register any remaining JDBC drivers
-        clearReferencesJdbc();
+        if (!JreCompat.isGraalAvailable()) {
+            // De-register any remaining JDBC drivers
+            clearReferencesJdbc();
+        }
 
         // Stop any threads the web application started
         clearReferencesThreads();
 
         // Clear any references retained in the serialization caches
-        if (clearReferencesObjectStreamClassCaches) {
+        if (clearReferencesObjectStreamClassCaches && 
!JreCompat.isGraalAvailable()) {
             clearReferencesObjectStreamClassCaches();
         }
 
         // Check for leaks triggered by ThreadLocals loaded by this class 
loader
-        if (clearReferencesThreadLocals) {
+        if (clearReferencesThreadLocals && !JreCompat.isGraalAvailable()) {
             checkThreadLocalsForLeaks();
         }
 
diff --git a/res/tomcat-maven/README.md b/res/tomcat-maven/README.md
index 2afbf36..170939a 100644
--- a/res/tomcat-maven/README.md
+++ b/res/tomcat-maven/README.md
@@ -80,8 +80,6 @@ oc policy add-role-to-user view system:serviceaccount:$(oc 
project -q):default -
 
 ## Native Image
 
-Note: Graal support in Tomcat is not functional yet.
-
 Download Graal native-image and tools.
 ```
 export JAVA_HOME=/absolute...path...to/graalvm-ce-19.0.0
@@ -89,16 +87,21 @@ export TOMCAT_MAVEN=/absolute...path...to/tomcat-maven
 cd $JAVA_HOME/bin
 ./gu install native-image
 ```
+As Graal does not support dynamic class loading, all Servlets and support 
classes of the webapp, which would traditionally be placed
+in `/WEB-INF/classes` and `/WEB-INF/lib`, must be included as part of the 
tomcat-maven build process, so they are packaged into the
+`target/tomcat-maven-1.0.jar`.
+
 Run Tomcat with the agent in full trace mode.
 ```
 cd $TOMCAT_MAVEN
 $JAVA_HOME/bin/java 
-agentlib:native-image-agent=trace-output=$TOMCAT_MAVEN/target/trace-file.json 
-jar target/tomcat-maven-1.0.jar
 ```
-Then exercise necessary paths of your service with the Tomcat configuration. 
Do not try to run any JSPs.
+Then exercise necessary paths of your service with the Tomcat configuration. 
Any changes to the Tomcat configuration requires running
+the substrate VM with the agent again.
 
 Generate the final json files using native-image-configuration then use native 
image using the generated reflection metadata:
 ```
 $JAVA_HOME/bin/native-image-configure generate 
--trace-input=$TOMCAT_MAVEN/target/trace-file.json 
--output-dir=$TOMCAT_MAVEN/target
-$JAVA_HOME/bin/native-image --allow-incomplete-classpath 
-H:+ReportUnsupportedElementsAtRuntime 
-H:ConfigurationFileDirectories=$TOMCAT_MAVEN/target/ 
-H:ReflectionConfigurationFiles=$TOMCAT_MAVEN/tomcat-reflection.json 
-H:ResourceConfigurationFiles=$TOMCAT_MAVEN/tomcat-resource.json 
-H:ResourceConfigurationFiles=$TOMCAT_MAVEN/tomcat-resource.json -jar 
$TOMCAT_MAVEN/target/tomcat-maven-1.0.jar
+$JAVA_HOME/bin/native-image --allow-incomplete-classpath 
-H:+ReportUnsupportedElementsAtRuntime -H:EnableURLProtocols=jar 
-H:ConfigurationFileDirectories=$TOMCAT_MAVEN/target/ 
-H:ReflectionConfigurationFiles=$TOMCAT_MAVEN/tomcat-reflection.json 
-H:ResourceConfigurationFiles=$TOMCAT_MAVEN/tomcat-resource.json 
-H:ResourceConfigurationFiles=$TOMCAT_MAVEN/tomcat-resource.json -jar 
$TOMCAT_MAVEN/target/tomcat-maven-1.0.jar
 ./tomcat-maven-1.0 -Dcatalina.base=. 
-Djava.util.logging.config.file=conf/logging.properties 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
 ```
diff --git a/res/tomcat-maven/tomcat-reflection.json 
b/res/tomcat-maven/tomcat-reflection.json
index d1bbf79..9d799d3 100644
--- a/res/tomcat-maven/tomcat-reflection.json
+++ b/res/tomcat-maven/tomcat-reflection.json
@@ -11,6 +11,7 @@
   "name" : "org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl",
   "methods" : [{"name": "<init>","parameterTypes":[] }]
 },
+{ "name":"java.lang.Object" },
 { "name":"javax.servlet.http.HttpServlet" },
 { "name":"org.apache.catalina.AccessLog" },
 { "name":"org.apache.catalina.AsyncDispatcher" },


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

Reply via email to