[GitHub] [tomcat] ziyan901 closed pull request #231: init tomcat config
ziyan901 closed pull request #231: init tomcat config URL: https://github.com/apache/tomcat/pull/231 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated (50dacc5 -> 54cc6ac)
This is an automated email from the ASF dual-hosted git repository. isapir pushed a change to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 50dacc5 Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=64023 new d9d502d BZ-63691 Skip all jar scanning if wildcard pattern is used new 54cc6ac BZ-63691 Added changelog entry The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/tomcat/util/scan/StandardJarScanFilter.java | 7 +++ java/org/apache/tomcat/util/scan/StandardJarScanner.java| 11 +++ webapps/docs/changelog.xml | 5 + 3 files changed, 23 insertions(+) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/02: BZ-63691 Added changelog entry
This is an automated email from the ASF dual-hosted git repository. isapir pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 54cc6acb925fac8620c300c50513ec9f805ad102 Author: Igal Sapir AuthorDate: Tue Dec 24 20:42:00 2019 -0800 BZ-63691 Added changelog entry --- webapps/docs/changelog.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 845562c..810c7ff 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -87,6 +87,11 @@ 64023: Skip null-valued session attributes when deserializing sessions. (schultz) + +63691: Skip all jar and directory scanning when the wildcard +pattern * or *.jar is set or added to +tomcat.util.scan.StandardJarScanFilter.jarsToSkip. (isapir) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: BZ-63691 Skip all jar scanning if wildcard pattern is used
This is an automated email from the ASF dual-hosted git repository. isapir pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d9d502d3ec0d47ae0db8917a833c4300aa0a3925 Author: Igal Sapir AuthorDate: Tue Dec 24 20:40:16 2019 -0800 BZ-63691 Skip all jar scanning if wildcard pattern is used --- java/org/apache/tomcat/util/scan/StandardJarScanFilter.java | 7 +++ java/org/apache/tomcat/util/scan/StandardJarScanner.java| 11 +++ 2 files changed, 18 insertions(+) diff --git a/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java b/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java index 84d3725..65389d9 100644 --- a/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java +++ b/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java @@ -36,11 +36,13 @@ public class StandardJarScanFilter implements JarScanFilter { private static final String defaultScan; private static final Set defaultSkipSet = new HashSet<>(); private static final Set defaultScanSet = new HashSet<>(); +private static final boolean defaultSkipAll; static { // Initialize defaults. There are no setter methods for them. defaultSkip = System.getProperty(Constants.SKIP_JARS_PROPERTY); populateSetFromAttribute(defaultSkip, defaultSkipSet); +defaultSkipAll = defaultSkipSet.contains("*") || defaultSkipSet.contains("*.jar"); defaultScan = System.getProperty(Constants.SCAN_JARS_PROPERTY); populateSetFromAttribute(defaultScan, defaultScanSet); } @@ -132,6 +134,11 @@ public class StandardJarScanFilter implements JarScanFilter { } +public boolean isSkipAll() { +return defaultSkipAll; +} + + public boolean isDefaultTldScan() { return defaultTldScan; } diff --git a/java/org/apache/tomcat/util/scan/StandardJarScanner.java b/java/org/apache/tomcat/util/scan/StandardJarScanner.java index 9b12ce9..402870d 100644 --- a/java/org/apache/tomcat/util/scan/StandardJarScanner.java +++ b/java/org/apache/tomcat/util/scan/StandardJarScanner.java @@ -171,6 +171,11 @@ public class StandardJarScanner implements JarScanner { log.trace(sm.getString("jarScan.webinflibStart")); } +if (jarScanFilter instanceof StandardJarScanFilter) { +if (((StandardJarScanFilter) jarScanFilter).isSkipAll()) +return; +} + Set processedURLs = new HashSet<>(); // Scan WEB-INF/lib @@ -282,6 +287,12 @@ public class StandardJarScanner implements JarScanner { protected void processURLs(JarScanType scanType, JarScannerCallback callback, Set processedURLs, boolean isWebapp, Deque classPathUrlsToProcess) { + +if (jarScanFilter instanceof StandardJarScanFilter) { +if (((StandardJarScanFilter) jarScanFilter).isSkipAll()) +return; +} + while (!classPathUrlsToProcess.isEmpty()) { URL url = classPathUrlsToProcess.pop(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/03: BZ-63691 Skip all jar scanning if wildcard pattern is used
This is an automated email from the ASF dual-hosted git repository. isapir pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 21d08e1952d6612da9a712a173c81174958f4b8b Author: Igal Sapir AuthorDate: Tue Dec 24 16:41:29 2019 -0800 BZ-63691 Skip all jar scanning if wildcard pattern is used --- java/org/apache/tomcat/JarScanFilter.java | 9 + java/org/apache/tomcat/util/scan/StandardJarScanFilter.java | 8 java/org/apache/tomcat/util/scan/StandardJarScanner.java| 9 + 3 files changed, 26 insertions(+) diff --git a/java/org/apache/tomcat/JarScanFilter.java b/java/org/apache/tomcat/JarScanFilter.java index d7f6738..d3aeb45 100644 --- a/java/org/apache/tomcat/JarScanFilter.java +++ b/java/org/apache/tomcat/JarScanFilter.java @@ -28,4 +28,13 @@ public interface JarScanFilter { * false if it should be excluded */ boolean check(JarScanType jarScanType, String jarName); + +/** + * + * @return true if all of the scans should be skipped which + * can improve startup performance. The default is false. + */ +default boolean isSkipAll() { +return false; +} } diff --git a/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java b/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java index 84d3725..6e942a2 100644 --- a/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java +++ b/java/org/apache/tomcat/util/scan/StandardJarScanFilter.java @@ -36,11 +36,13 @@ public class StandardJarScanFilter implements JarScanFilter { private static final String defaultScan; private static final Set defaultSkipSet = new HashSet<>(); private static final Set defaultScanSet = new HashSet<>(); +private static final boolean defaultSkipAll; static { // Initialize defaults. There are no setter methods for them. defaultSkip = System.getProperty(Constants.SKIP_JARS_PROPERTY); populateSetFromAttribute(defaultSkip, defaultSkipSet); +defaultSkipAll = defaultSkipSet.contains("*") || defaultSkipSet.contains("*.jar"); defaultScan = System.getProperty(Constants.SCAN_JARS_PROPERTY); populateSetFromAttribute(defaultScan, defaultScanSet); } @@ -132,6 +134,12 @@ public class StandardJarScanFilter implements JarScanFilter { } +@Override +public boolean isSkipAll() { +return defaultSkipAll; +} + + public boolean isDefaultTldScan() { return defaultTldScan; } diff --git a/java/org/apache/tomcat/util/scan/StandardJarScanner.java b/java/org/apache/tomcat/util/scan/StandardJarScanner.java index 9b12ce9..16a2396 100644 --- a/java/org/apache/tomcat/util/scan/StandardJarScanner.java +++ b/java/org/apache/tomcat/util/scan/StandardJarScanner.java @@ -171,6 +171,10 @@ public class StandardJarScanner implements JarScanner { log.trace(sm.getString("jarScan.webinflibStart")); } +if (jarScanFilter.isSkipAll()) { +return; +} + Set processedURLs = new HashSet<>(); // Scan WEB-INF/lib @@ -282,6 +286,11 @@ public class StandardJarScanner implements JarScanner { protected void processURLs(JarScanType scanType, JarScannerCallback callback, Set processedURLs, boolean isWebapp, Deque classPathUrlsToProcess) { + +if (jarScanFilter.isSkipAll()) { +return; +} + while (!classPathUrlsToProcess.isEmpty()) { URL url = classPathUrlsToProcess.pop(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated (d9f243a -> 81e7215)
This is an automated email from the ASF dual-hosted git repository. isapir pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git. from d9f243a Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=64023 new 21d08e1BZ-63691 Skip all jar scanning if wildcard pattern is used new 317644c BZ-63691 Added changelog entry new 81e7215 BZ-63691 Improved changelog entry The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: java/org/apache/tomcat/JarScanFilter.java | 9 + java/org/apache/tomcat/util/scan/StandardJarScanFilter.java | 8 java/org/apache/tomcat/util/scan/StandardJarScanner.java| 9 + webapps/docs/changelog.xml | 5 + 4 files changed, 31 insertions(+) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 03/03: BZ-63691 Improved changelog entry
This is an automated email from the ASF dual-hosted git repository. isapir pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 81e721526d4125e68e591dddf14dbb460f02f43b Author: Igal Sapir AuthorDate: Tue Dec 24 17:13:52 2019 -0800 BZ-63691 Improved changelog entry --- webapps/docs/changelog.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c97b9f5..f8f1894 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -80,8 +80,8 @@ sessions. (schultz) -63691: Skip all jars and directories scanning when a wildcard -pattern * or *.jar is set or added to +63691: Skip all jar and directory scanning when the wildcard +pattern * or *.jar is set or added to tomcat.util.scan.StandardJarScanFilter.jarsToSkip. (isapir) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 02/03: BZ-63691 Added changelog entry
This is an automated email from the ASF dual-hosted git repository. isapir pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 317644c7faca4fd47e6e561b2f121bd78732b33a Author: Igal Sapir AuthorDate: Tue Dec 24 16:58:56 2019 -0800 BZ-63691 Added changelog entry --- webapps/docs/changelog.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 7fb5f6b..c97b9f5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -79,6 +79,11 @@ 64023: Skip null-valued session attributes when deserializing sessions. (schultz) + +63691: Skip all jars and directories scanning when a wildcard +pattern * or *.jar is set or added to +tomcat.util.scan.StandardJarScanFilter.jarsToSkip. (isapir) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: javax -> jakarta rename
On 12/21/2019 11:49 AM, Mark Thomas wrote: On 21/12/2019 17:45, Adam Rauch wrote: Yes, I see that 9.x javax.* will be supported for a long time and I'm all in favor of killing off deprecated EE libraries. I want to encourage our users to migrate to Tomcat 10.x and future releases as quickly as possible, but I'm concerned that 9.x to 10.x will be a very difficult transition for those who deploy webapps like the one we develop. With the current plan, I don't see a scenario where our users can upgrade to the next release of Tomcat, test that change, and then upgrade our webapp. Because of the package rename, they will need to be upgraded in lockstep, which has never been the case before. I see the value of a short-term "transition" release that helps ease this burden by supporting webapps using either package, but if others don't, then never mind. I think the ideal migration strategy is going to vary for different users. Personally, I think an approach that largely mirrors what the Jakarta projects are going (i.e. just the package rename, nothing else) and doing that for the container and the app at the same time is the way to go in the majority of cases but I appreciate that that is just my view. Maybe I've misunderstood the migration tool, but it looks like a great tool for developers like me, not a tool that will directly help non-developers who deploy pre-built Tomcat webapps. The idea is that anyone can take a Java EE 8 app that runs on Tomcat 9, run it through this migration tool and then run the migrated app on Tomcat 10. We aren't there yet (I've only tested a JSTL API and implementation) but my intention is to use apps like Jira to test it. As for Romain's question about doing the transformations in the classloader, I started with a classloader approach (my classloader responded to requests for "javax.servlet.*" classes with their "jakarta.servlet.*" counterparts). I backed away because these classes then needed to be manipulated so they'd match the javax interfaces' expectations, but I haven't used ASM before. This is one of the approaches considered in previous discussions. It is, essentially, what the migration tool does. I think it is better to do this conversion in advance rather than take the performance hit in a running application. It is actually fairly simple to do as you only need to modify the String constants. And this part of the problem (my webapp requesting javax classes that no longer exist in Tomcat) was easily solved by simply including those classes in my jar. The more interesting problem was adapting the objects passed in the hand-offs between jakarta-only Tomcat and javax-only webapp (e.g., Filter, Servlet, FilterChain); I'm not sure a classloader would help there. But if someone can come up with a simpler classloader (or dynamic proxy, et al)-based approach, then I'm all for it. I spent a bit of time thinking about this but didn't get as far as coding it. I came to the conclusion it could get very messy once you start wrapping requests and dispatching them and decided to focus on the migration tool instead. Overall, I think it is good that there are a range of tools supporting a range of approaches. As users start the migration progress, hopefully we'll get some feedback and we can refine the tools and/or the approaches. I'd encourage you to put your code somewhere where others can look at it (GitHub being the obvious choice these days) and I'd ask you to consider using the Apache License v2 as that makes it very easy to integrate into Tomcat at some point in the future if that turns out to be the best thing to do. Mark - To unsubscribe, e-mail:dev-unsubscr...@tomcat.apache.org For additional commands, e-mail:dev-h...@tomcat.apache.org Mark, Thanks very much for your response. I agree the ideal migration strategy will vary and a build-based (or post-build) tool should work for most developers. But if there's sufficient demand for a run-time migration layer, I believe the implementation would be fairly straightforward and the result reasonably efficient. All of my proof-of-concept code is available on Github: https://github.com/labkey-adam/jakarta-javax Most of the code carries the Apache 2.0 license already (e.g., the javax.servlet and javax.el classes copied from Tomcat sources), but I'll add a top-level license file to clarify that the entire repo is Apache 2.0. FilterChainAdapter illustrates the simple approach: https://github.com/labkey-adam/jakarta-javax/blob/master/src/javax/servlet/FilterChainAdapter.java Objects are wrapped, but the Adapters helper class unwraps known wrappers to minimize object creation. If we were to move forward with this approach, I'd want to restructure the code, moving the new classes out of javax.servlet into their own package. And, of course, adding the rest of javax.servlet and wiring up other adapters as needed. Adam
Jasper throws an NPE when running in IntelliJ IDEA
I have set up Tomcat in IntelliJ using the ant task, `ant ide-intellij`. I added the PATH variables for ANT_HOME and TOMCAT_BUILD_LIBS, and marked the directory webapps/examples/WEB-INF/classes as a Source Folder. If I call the URI for /tomcat.gif, for example, it works as expected and I get the image, but if I try to run /index.jsp I get the NPE below [1]. Further, when I check the IDE for implementations of the abstract class org.apache.jasper.runtime.HttpJspBase I can't find any, which is very puzzling to me. What am I doing wrong? Thanks, Igal [1] org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:639) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:515) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) *Root Cause* java.lang.NullPointerException org.apache.jsp.index_jsp._jspService(index_jsp.java:431) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) javax.servlet.http.HttpServlet.service(HttpServlet.java:741)