arquillian-cube icon indicating copy to clipboard operation
arquillian-cube copied to clipboard

[Integration Tests] - Replace use of tomcat:7.0.75-jre8 in tests with higher version which can work on JDK 11

Open gaol opened this issue 1 year ago • 1 comments

Issue Overview

We have enforced JDK 11 now, and tomcat:7.0.75-jre8 is widely used in Dockerfile in integration tests. The container starts with JDK8 but will try to load the tests servlets compiled in JDK 11 which will lead to container error:

[🎩 lgao@lins-p1 arquillian-cube]$ curl -i http://localhost:8081/hello/HelloWorld
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 3307
Date: Tue, 16 Apr 2024 04:08:42 GMT
Connection: close

<html><head><title>Apache Tomcat/7.0.75 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org/arquillian/cube/servlet/HelloWorldServlet has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class org.arquillian.cube.servlet.HelloWorldServlet)</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org/arquillian/cube/servlet/HelloWorldServlet has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class org.arquillian.cube.servlet.HelloWorldServlet)</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.UnsupportedClassVersionError: org/arquillian/cube/servlet/HelloWorldServlet has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (unable to load class org.arquillian.cube.servlet.HelloWorldServlet)
	org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
	org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:495)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2473)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:745)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.75 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.75</h3></body></html>

So we need to

Expected Behaviour

No test failures

Current Behaviour

Test fail with exceptions:

[INFO] Running org.arquillian.cube.servlet.HelloWorldServletIT
[ERROR] Tests run: 8, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 1.020 s <<< FAILURE! -- in org.arquillian.cube.servlet.HelloWorldServletIT
[ERROR] org.arquillian.cube.servlet.HelloWorldServletIT.should_parse_and_load_configuration_file -- Time elapsed: 0.037 s <<< ERROR!
java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8081/hello/HelloWorld
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1924)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at org.arquillian.cube.servlet.HelloWorldServletIT.should_parse_and_load_configuration_file(HelloWorldServletIT.java:54)

Steps To Reproduce
cd arquillian-cube/docker/ftest-docker-compose
mvn clean install -Dfailsafe.groups=org.arquillian.cube.docker.impl.requirement.RequiresDocker
Additional Information
JDK: 11
main branch

gaol avatar Apr 19 '24 06:04 gaol

I see a https://github.com/arquillian/arquillian-container-tomcat/tree/main/tomcat-managed-10 from the coming rquillian-container-tomcat:1.2.1 , maybe we can consider of migrating to use tomcat 10 in Dockerfile for integration tests.

gaol avatar Apr 19 '24 06:04 gaol

Should be fixed in #1317

fabiobrz avatar Oct 07 '24 15:10 fabiobrz

Hi @gaol - similar to #1303 and the related #1306 - this issue could be fixed already by #1317, which takes into account latest changes, and also brings fixes and updates which are all relevant to resume proper Docker integration tests. I took inspiration from your comments and assigned myself to the issues as well.

fabiobrz avatar Oct 07 '24 15:10 fabiobrz

@fabiobrz great job :+1:

gaol avatar Oct 08 '24 01:10 gaol