RE: class-loading and java.endorsed.dirs
This is a JVM thing, not a tomcat thing. You're not normally allowed to override built-in Java classes locally (for security reasons). In JDK 1.4, the XML/XSLT classes are built in. The endorsed standards override mechanism was added to 1.4 because of the fact that some people might need or want to use an alternate XML parser or transformer. So the JAVA_ENDORSED_DIRS thing tells the JVM that it's OK to override Xalan with libraries from the specified directories. So I don't think there's any way to specify on a per-webapp basis which impl to use. It's all or nothing at the VM instance level. Also see http://java.sun.com/j2se/1.4/docs/guide/standards/ for more info. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -Original Message- From: Voytenko, Dimitry [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 12:30 AM To: '[EMAIL PROTECTED]' Subject: class-loading and java.endorsed.dirs Hi, Here's what happend. It looks pretty strange. I couldn't find explanation to this neither in Tomcat docs, Servlet specs or Mailing List. I have a servlet, with doGet implemented as: System.err.println(XALAN VERSION = + org.apache.xalan.Version.getVersion()); In the application's WEB_INF/lib directory I have xalan.jar of version 2.4.1, which I thought should have been used. But instead, as the result of execution of the servlet, I got XALAN VERSION = Xalan Java 2.2 D11 This is the Xalan version included to JDK 1.4. Isn't application's JAR should be used (as stated in SRV.9.7.2 of the Servlet 2.3 specification)? Then, I changed setclasspath.bat JAVA_ENDORSED_DIRS env. variable to include my WEB_INF/lib directory (application wasn't packed into WAR). This variable is then passed as the value of java.endorsed.dirs java startup parameter. As the result, I got XALAN VERSION = Xalan Java 2.4.1 which I expected in the first place. Does this mean that libraries in the endorsed dir have bigger priority? It's a little confusing why this change whould make such a difference. Is there a way to specify forcefully that application should only use local libraries if they're specified? Thanks, Dimitry E Voytenko - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: class-loading and java.endorsed.dirs
Hi Tim, Thanks for an answer. It makes sense. In this case, it looks like the only way users can take advantage of all Xalan's features (including extension mechanism) is to store Xalan's jars into shared\lib directory and add this directory to java.endorsed.dirs, since normally most users deploy their applications using WAR. If this is true: 1. Could I request adding this info to FAQ? 2. Could I request adding shared\lib to java.endorsed.dirs in setclasspath.bat(sh)? Thanks, Dimitry -Original Message- From: Tim Moore [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 08:15 To: Tomcat Developers List Subject: RE: class-loading and java.endorsed.dirs This is a JVM thing, not a tomcat thing. You're not normally allowed to override built-in Java classes locally (for security reasons). In JDK 1.4, the XML/XSLT classes are built in. The endorsed standards override mechanism was added to 1.4 because of the fact that some people might need or want to use an alternate XML parser or transformer. So the JAVA_ENDORSED_DIRS thing tells the JVM that it's OK to override Xalan with libraries from the specified directories. So I don't think there's any way to specify on a per-webapp basis which impl to use. It's all or nothing at the VM instance level. Also see http://java.sun.com/j2se/1.4/docs/guide/standards/ for more info. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -Original Message- From: Voytenko, Dimitry [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 12:30 AM To: '[EMAIL PROTECTED]' Subject: class-loading and java.endorsed.dirs Hi, Here's what happend. It looks pretty strange. I couldn't find explanation to this neither in Tomcat docs, Servlet specs or Mailing List. I have a servlet, with doGet implemented as: System.err.println(XALAN VERSION = + org.apache.xalan.Version.getVersion()); In the application's WEB_INF/lib directory I have xalan.jar of version 2.4.1, which I thought should have been used. But instead, as the result of execution of the servlet, I got XALAN VERSION = Xalan Java 2.2 D11 This is the Xalan version included to JDK 1.4. Isn't application's JAR should be used (as stated in SRV.9.7.2 of the Servlet 2.3 specification)? Then, I changed setclasspath.bat JAVA_ENDORSED_DIRS env. variable to include my WEB_INF/lib directory (application wasn't packed into WAR). This variable is then passed as the value of java.endorsed.dirs java startup parameter. As the result, I got XALAN VERSION = Xalan Java 2.4.1 which I expected in the first place. Does this mean that libraries in the endorsed dir have bigger priority? It's a little confusing why this change whould make such a difference. Is there a way to specify forcefully that application should only use local libraries if they're specified? Thanks, Dimitry E Voytenko - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: class-loading and java.endorsed.dirs
There already is a java.endorsed.dirs set up it is common.lib/endorsed (atleast in the 4.1.x) and is documented AFAIK John -Original Message- From: Voytenko, Dimitry [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 1:35 PM To: 'Tomcat Developers List' Subject: RE: class-loading and java.endorsed.dirs Hi Tim, Thanks for an answer. It makes sense. In this case, it looks like the only way users can take advantage of all Xalan's features (including extension mechanism) is to store Xalan's jars into shared\lib directory and add this directory to java.endorsed.dirs, since normally most users deploy their applications using WAR. If this is true: 1. Could I request adding this info to FAQ? 2. Could I request adding shared\lib to java.endorsed.dirs in setclasspath.bat(sh)? Thanks, Dimitry -Original Message- From: Tim Moore [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 08:15 To: Tomcat Developers List Subject: RE: class-loading and java.endorsed.dirs This is a JVM thing, not a tomcat thing. You're not normally allowed to override built-in Java classes locally (for security reasons). In JDK 1.4, the XML/XSLT classes are built in. The endorsed standards override mechanism was added to 1.4 because of the fact that some people might need or want to use an alternate XML parser or transformer. So the JAVA_ENDORSED_DIRS thing tells the JVM that it's OK to override Xalan with libraries from the specified directories. So I don't think there's any way to specify on a per-webapp basis which impl to use. It's all or nothing at the VM instance level. Also see http://java.sun.com/j2se/1.4/docs/guide/standards/ for more info. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -Original Message- From: Voytenko, Dimitry [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 12:30 AM To: '[EMAIL PROTECTED]' Subject: class-loading and java.endorsed.dirs Hi, Here's what happend. It looks pretty strange. I couldn't find explanation to this neither in Tomcat docs, Servlet specs or Mailing List. I have a servlet, with doGet implemented as: System.err.println(XALAN VERSION = + org.apache.xalan.Version.getVersion()); In the application's WEB_INF/lib directory I have xalan.jar of version 2.4.1, which I thought should have been used. But instead, as the result of execution of the servlet, I got XALAN VERSION = Xalan Java 2.2 D11 This is the Xalan version included to JDK 1.4. Isn't application's JAR should be used (as stated in SRV.9.7.2 of the Servlet 2.3 specification)? Then, I changed setclasspath.bat JAVA_ENDORSED_DIRS env. variable to include my WEB_INF/lib directory (application wasn't packed into WAR). This variable is then passed as the value of java.endorsed.dirs java startup parameter. As the result, I got XALAN VERSION = Xalan Java 2.4.1 which I expected in the first place. Does this mean that libraries in the endorsed dir have bigger priority? It's a little confusing why this change whould make such a difference. Is there a way to specify forcefully that application should only use local libraries if they're specified? Thanks, Dimitry E Voytenko - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]