Running
Tomcat
setenv.[sh|bat]
Set the following system properties
- -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
context.xml
Make the following changes:
<Context crossContext="true" resourceOnlyServlets="jsp">
...
</Context>
server.xml
Enable h2c on port 8080, and add some trailer headers
<Connector ... allowedTrailerHeaders="myTrailer, myTrailer2" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
</Connector>
Enable TLS on port 8443
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true">
<SSLHostConfig protocols="TLSv1.2" truststoreFile="conf/cacerts.jks">
<Certificate certificateKeystoreFile="conf/clientcert.jks"
certificateKeystorePassword="changeit"
type="RSA" />
</SSLHostConfig>
</Connector>
Note: Set protocols="TLSv1.2" to disable TLSv1.3 since the TCK requires post-handshake authentication and the Java 11 client does not support that.
tomcat-users.xml
Make the following changes:
<user username="CN=CTS, OU=Java Software, O=Sun Microsystems Inc., L=Burlington, ST=MA, C=US" roles="Administrator"/>
<user username="j2ee" password="j2ee" roles="Administrator,Employee" />
<user username="javajoe" password="javajoe" roles="VP,Manager" />
web.xml
Remove the sections setting the default character encoding for requests and responses to UTF-8.
And add the following:
<locale-encoding-mapping-list>
<locale-encoding-mapping>
<locale>ja</locale>
<encoding>Shift_JIS</encoding>
</locale-encoding-mapping>
</locale-encoding-mapping-list>
modules
The signature test needs to have servlet-api.jar and annotations-api.jar in the modules subdirectory.
Test Suite
Download the Jakarta Servlet 6.0.1 TCK
https://download.eclipse.org/jakartaee/servlet/6.0/jakarta-servlet-tck-6.0.1.zip
Extract to SERVLET_TCK_HOME
cd $SERVLET_TCK_HOME/bin/certificates
Convert cts_cert to a truststore doing: "keytool -import -alias cts -file cts_cert -storetype JKS -keystore cacerts.jks" password should be "changeit"
Add $SERVLET_TCK_HOME/bin/certificates/cacerts.jks and $SERVLET_TCK_HOME/bin/certificates/clientcert.jks in the Tomcat conf folder
Edit $SERVLET_TCK_HOME/bin/ts.jte
You'll need to set the following properties (adjust the paths and values for your environment)
web.home=/path/to/tomcat
servlet.classes=${web.home}/lib/servlet-api.jar:${web.home}/lib/annotations-api.jar
webServerHost=localhost
webServerPort=8080
securedWebServicePort=8443
command.testExecute += -Djavax.net.ssl.trustStore=${ts.home}/bin/certificates/cacerts.jks
command.textExecute -= -Djava.endorsed.dirs=${endorsedlib.dir} (Java 11 only)
set JAVA_HOME
cd $SERVLET_TCK_HOME/bin
ant gui
Accept the defaults and then run the tests
Expected results
A default 10.1.x build with the above configuration and the 6.0.1 TCK triggers those expected faliures:
Expected failures
- 1 x default context path test as Tomcat configuration always overrides this.
- (com/sun/ts/tests/servlet/spec/defaultcontextpath/URLClient.java#getDefaultContextPathTest)