Tomcat Openjdk

 

Tomcat 9.0.26 on Java 13 from AdoptOpenJDK on macOS Mojave without a problem. No more JRE †, just JDK Oracle no longer intends for end-users to be installing a JRE or a JDK.

  1. Bundled Tomcat and Java versions This page lists the specific versions of Apache Tomcat and Adopt OpenJDK that we bundle with Confluence. This information is useful if you want to check whether your Confluence version might be using a Tomcat or Java version that's affected by a specific issue, vulnerability, or bug.
  2. What are the known issues with the OpenJDK? There have been reports that java.util.logging does not work properly in OpenJDK 1.7.0.9 and OpenJDK6 1.6.032. The symptom is 'java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler' errors when you start Tomcat.
  3. The place to collaborate on an open-source implementation of the Java Platform, Standard Edition, and related projects.
  4. The place to collaborate on an open-source implementation of the Java Platform, Standard Edition, and related projects.
Skip to end of metadataGo to start of metadata

Permalink to this page: https://cwiki.apache.org/confluence/x/DColBg

Openjdk

Questions

Answers

What are the known issues in any given Tomcat version?

To determine the known issues for any given Tomcat version, you'll need to review the following:

  • The currently open bugs and enhancement requests in Bugzilla
  • The latest (from svn) change log entries for all newer versions

See chapter Looking for known issues on Tomcat web site.

What are the known issues with the Oracle JRE?

  • jps.exe and jvisualvm.exe cannot detect tomcat using jdk1.6.0_23 onwards — Fixed in Java 1.6.0_25.

What are the known issues with the OpenJDK?

  • There have been reports that java.util.logging does not work properly in OpenJDK 1.7.0.9 and OpenJDK6 1.6.0_32. The symptom is 'java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler' errors when you start Tomcat. See these threads from March 2013 and July 2013. This issue was absent in earlier versions and should be fixed in a later version of those JDKs.

Tomcat Openjdk Jre

I'm using the Java ImageIO to dynamically serve images and get strange Exceptions from time to time. Is this a bug in Tomcat?

Version

Imagine you have a servlet which dynamically generates images and serves them via javax.imageio.ImageIO. To write the image to the OutputStream, perhaps you are doing something like this:

Now, although there shouldn't be any Exception logged (because the IOException which occurs when the client aborted the connection is ignored), you see strange Exceptions in Tomcat's log which may belong to other Servlets/JSP (at least with Sun/Oracle JVM on Windows), saying that the response has already been committed, although you didn't write anything to it at that time. For example:

or maybe you use the ISAPI Redirector for IIS on Windows, and get these logs:

Is this a bug in Tomcat?

Tomcat Openjdk

Actually, it's a bug (or at least a strange behavior) in the Java ImageIO. When the ImageIO writes to an OutputStream and gets an IOException during writing, it could happen that some later time, when the ImageWriter is garbage-collected, the flush() method is called on that OutputStream. Tomcat recycles OutputStream objects to save resources, so it could be that when flush() is called from the ImageIO, the particular OutputStream object already belongs to another Response, which can produce the above errors, when the Servlet tries to get a Session for example, or can generally lead to broken responses.

See also here or this Bug report.

Openjdk 17

Tomcat Openjdk

So how to resolve the errors?

To resolve this, I'm using an OutputStream decorator class which decorates Tomcat's OutputStream and prevents any flush() calls. Additionally, when close() is called on that Stream, it nulls-out the reference to Tomcat's OutputStream and prevents any other operations:

Now you just have to use this Decorater class instead of using Tomcat's OutputStream directly:

and the errors should be gone away.

I might be coming a bit late to this thread, but I will mention that I had no problem running Tomcat 9 with Adopt OpenJDK 11 and its Hotspot choice...

An alternative would be to write the Image contents to a ByteArrayOutputStream, and using its writeTo() method to write the contents to the Servlet's Response. However that would require some additional memory, as the contents have to be buffered.

Are there any other corresponding cases of this bug?

Tomcat Openjdk 11 Windows

The third party PDF generating software module PD4ML has had a corresponding problem when calling the render() methods in class org.zefer.pd4ml.PD4ML with response.getOutputStream() as argument. That causes the response stream to be closed from a finalizer() method of a class called PD4Device. When using an Apache/Tomcat connector, this unexpected stream close from the finalizer thread has occationally caused responses to be sent to wrong requestor (request/response mix up). The workarounds described above for ImageIO works perfectly in this case too.

Java - Verbose Logging With -verbose:class Not Working ...

A general way to protect the response output streams from misbehaving web applications is to set the system property org.apache.catalina.connector.RECYCLE_FACADES=true, since that makes Tomcat create new stream instances for each request (of course at the cost of performance).

Tomcat 11

PD4ML has fixed this bug in their latest releases, but sites using older versions of the library can still be affected. PD4ML version 3.2.3 definitely has this flaw, but the currently latest version 3.8.0 is fixed. The release notes document gives no clues where in between the problem was fixed, and the vendor was not able to tell either in this bug report.


See Full List On Hub.docker.com