You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rainer Jung <ra...@kippdata.de> on 2017/09/27 13:20:31 UTC

Java 9 and endorsed in TC 7+8.0 [Was: Tomcat and Java 9]

Am 29.08.2017 um 14:09 schrieb Mark Thomas:
> On 28/08/17 15:10, Christopher Schultz wrote:
>> All,
>>
>> According to this post[1] over at SO, Tomcat 7 doesn't work with Java
>> 9 out of the box. This is because of the use of -Djava.endorsed.dirs,
>> which also appears in Tomcat 8. I suspect that feature is used in
>> prior versions of Tomcat startup scripts as well.
> 
> There may be other, less immediately obvious problems as well.
> 
>> Tomcat's "Which Version" page claims that Tomcat X works with Java "Y
>> and later", which is not strictly true at this point because Tomcat's
>> startup scripts will cause Java 9 to fail[2] due to the removal of the
>> endorsed overrides mechanism.
>>
>> I'm wondering if we should modify the startup scripts to stop
>> specifying -Djava.endorsed.dirs unless the environment variable
>> actually contains a value. The current catalina.sh in Tomcat 8
>> supplies this option unconditionally, therefore Java 9 will fail.
>>
>> The only place I can see where JAVA_ENDORSED_DIRS is actually *set* in
>> catalina.sh is when the user is running cygwin, but that is only to
>> convert the path separator from \ to / for UNIX-style paths.
>>
>> Any objections?

I drafted a patch available at

http://home.apache.org/~rjung/patches/tc8-java-9-noendorsed.patch

for TC 8.0.x. I can't really test on Windows.

Basic ingredients:

- For bat and sh do not try to remove the flag from the Java command, 
and instead use a non existing system property ignore.endorsed.dirs 
instead of java.endorsed.dirs if the user has not supplied a non-empty 
JAVA_ENDORSED_DIRS and the endorsed sub directory of CATALINA_HOME does 
not exist. I also did not replace the full flag including the value with 
a variable to reduce chances of getting whitespace issues. It sounded 
easiest to simply make the property name variable.

- I refrained from Java version checking in the scripts. I think it is 
better to not set endorsed if the user has not demanded it and the 
directory wasn't created. And if the user demands it or the dir exists, 
set it and fail on Java 9 so that it is clear that people have to clean 
their installation up.

- Removed the endorsed flag from the commandline that the NSI installer 
registers for the service. This is mostly because I don't know enough 
about how to add logic to the NSI.

I have not directly committed it, because script file changes always 
carry some potential of breaking stuff and I want to wait until the next 
release is done.

It would be great if people could do some testing on their platforms.

Regards,

Rainer

>> Tomcat 8.5/9.0 have removed the JAVA_ENDORSED_DIRS environment
>> variable from their scripts, so there should not be any problems,
>> there, of course.
>>
>> -chris
>>
>> [1]https://stackoverflow.com/questions/45917401/tomcat-7-0-73-doesnt-wor
>> k-with-java-9
>> [2]
>> https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-2C896CA8-927
>> C-4381-A737-B1D81D964B7B

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


Re: Java 9 and endorsed in TC 7+8.0 [Was: Tomcat and Java 9]

Posted by Rainer Jung <ra...@kippdata.de>.
Am 27.09.2017 um 22:50 schrieb Mark Thomas:
> On 27/09/17 14:20, Rainer Jung wrote:
> 
>> I drafted a patch available at
>>
>> http://home.apache.org/~rjung/patches/tc8-java-9-noendorsed.patch
>>
>> for TC 8.0.x. I can't really test on Windows.
>>
>> Basic ingredients:
>>
>> - For bat and sh do not try to remove the flag from the Java command,
>> and instead use a non existing system property ignore.endorsed.dirs
>> instead of java.endorsed.dirs if the user has not supplied a non-empty
>> JAVA_ENDORSED_DIRS and the endorsed sub directory of CATALINA_HOME does
>> not exist. I also did not replace the full flag including the value with
>> a variable to reduce chances of getting whitespace issues. It sounded
>> easiest to simply make the property name variable.
>>
>> - I refrained from Java version checking in the scripts. I think it is
>> better to not set endorsed if the user has not demanded it and the
>> directory wasn't created. And if the user demands it or the dir exists,
>> set it and fail on Java 9 so that it is clear that people have to clean
>> their installation up.
>>
>> - Removed the endorsed flag from the commandline that the NSI installer
>> registers for the service. This is mostly because I don't know enough
>> about how to add logic to the NSI.
>>
>> I have not directly committed it, because script file changes always
>> carry some potential of breaking stuff and I want to wait until the next
>> release is done.
>>
>> It would be great if people could do some testing on their platforms.
> 
> I like the approach. It is better that what I did in trunk which was to
> simply remove it entirely.
> 
> I'll port your patch to 9.0.x and test it.

I provided a patch candidate at

http://home.apache.org/~rjung/patches/tc9-java-9-noendorsed.patch

It is mostly reverting r1653475 and then applying my TC 8 patch.

Regards,

Rainer


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


Re: Java 9 and endorsed in TC 7+8.0 [Was: Tomcat and Java 9]

Posted by Mark Thomas <ma...@apache.org>.
On 27/09/17 14:20, Rainer Jung wrote:

> I drafted a patch available at
> 
> http://home.apache.org/~rjung/patches/tc8-java-9-noendorsed.patch
> 
> for TC 8.0.x. I can't really test on Windows.
> 
> Basic ingredients:
> 
> - For bat and sh do not try to remove the flag from the Java command,
> and instead use a non existing system property ignore.endorsed.dirs
> instead of java.endorsed.dirs if the user has not supplied a non-empty
> JAVA_ENDORSED_DIRS and the endorsed sub directory of CATALINA_HOME does
> not exist. I also did not replace the full flag including the value with
> a variable to reduce chances of getting whitespace issues. It sounded
> easiest to simply make the property name variable.
> 
> - I refrained from Java version checking in the scripts. I think it is
> better to not set endorsed if the user has not demanded it and the
> directory wasn't created. And if the user demands it or the dir exists,
> set it and fail on Java 9 so that it is clear that people have to clean
> their installation up.
> 
> - Removed the endorsed flag from the commandline that the NSI installer
> registers for the service. This is mostly because I don't know enough
> about how to add logic to the NSI.
> 
> I have not directly committed it, because script file changes always
> carry some potential of breaking stuff and I want to wait until the next
> release is done.
> 
> It would be great if people could do some testing on their platforms.

I like the approach. It is better that what I did in trunk which was to
simply remove it entirely.

I'll port your patch to 9.0.x and test it.

Cheers,

Mark

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