Bug 54791 - No TLD files were found in tools.jar when tools.jar is explicitly added to $CLASSPATH
No TLD files were found in tools.jar when tools.jar is explicitly added to $C...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
7.0.39
PC Windows XP
: P2 minor (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2013-04-02 20:08 UTC by Konstantin Kolinko
Modified: 2013-04-24 20:17 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2013-04-02 20:08:28 UTC
Since r1448831 (7.0.39) tools.jar is no longer mentioned in jarsToSkip

Steps to reproduce
1. Use Eclipse IDE, version for JavaEE developers.
I am using 3.7.2 (Indigo SR2) here.

2. Configure it to use a JDK.

3. Configure a new Server from Tomcat 7.0.39
In Java EE perspective, go to Servers view, right-click, choose "New -> Server" from context menu.

4. Examine launch configuration of the server.
In Servers view click on the server instance. A new page opens in Editor area. Click on "Open launch configuration" link there. Go to "Classpath" tab.

Note that the following JARs are in the classpath:
* bootstrap.jar
* tomcat-juli.jar
* tools.jar

5. Deploy a web application on this server and start it.
If you have configured logging (with -Djava.util.logging.config.file in the same launch configuration dialog), you may see complaints that there are no TLDs in tools.jar.


02-Apr-2013 18:24:39.637 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/7.0.39
(...)
02-Apr-2013 23:08:54.355 FINE [tc-http-2] org.apache.jasper.compiler.TldLocationsCache.tldScanJar No TLD files were found in [file:/C:/Program%20Files/Java/jdk1.6.0_43/lib/tools.jar]. Consider adding the JAR to the tomcat.util.scan.DefaultJarScanner.jarsToSkip or org.apache.catalina.startup.TldConfig.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.



There are two ways to fix this
a) add "tools.jar" to jarsToSkip property
b) do not scan jars in classpath.


In r1448831 in StandardJarScanner.java this b) would be
replace
  stopLoader = ClassLoader.getSystemClassLoader().getParent();
with
  stopLoader = ClassLoader.getSystemClassLoader();

I see a problem with such a change, though.

I think that there is no need to scan SystemClassLoader's classpath when Tomcat is launched via Bootstrap class.

I think that we have to scan SystemClassLoader's classpath when launched in embedded mode via Tomcat class. Is is because it does not set up classloaders hierarchy like it is done by Bootstrap.
Comment 1 Mark Thomas 2013-04-16 22:19:29 UTC
Why is tools.jar on the classpath in the first place?
Comment 2 Mark Thomas 2013-04-24 20:08:02 UTC
I'm very tempted to say that if Eclipse wants to add tools.jar to the classpath then Eclipse should be adding tools.jar to jarsToSkip as well and resolve this as INVALID.

That said, Eclipse is widely enough used that adding tools.jar back to the default jarsToSkip is probably the better option.
Comment 3 Konstantin Kolinko 2013-04-24 20:16:43 UTC
(In reply to comment #1)
> Why is tools.jar on the classpath in the first place?

I guess they are following some old docs.
(Or is there anyone who actually uses JDK compiler with Jasper?)

In our Tomcat 8 documentation "tools.jar" is mentioned on two pages, 
jasper-howto.html
windows-service-howto.html

(The later one should probably be corrected).

> That said, Eclipse is widely enough used that adding tools.jar back to the
> default jarsToSkip is probably the better option.

Agreed.
Comment 4 Mark Thomas 2013-04-24 20:17:24 UTC
Fixed in trunk and 7.0.x and will be included in 7.0.40 onwards.