Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JDK 17+ #179

Closed
js-xc opened this issue Jan 3, 2022 · 2 comments · Fixed by #435
Closed

Support for JDK 17+ #179

js-xc opened this issue Jan 3, 2022 · 2 comments · Fixed by #435
Assignees
Milestone

Comments

@js-xc
Copy link
Contributor

js-xc commented Jan 3, 2022

With older Java versions, running XLT test scenarios (in the IDE) caused the following console warning:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.xceptance.xlt.engine.socket.InstrumentedSocketImpl (file:/home/julia/.m2/repository/com/xceptance/xlt/5.7.0/xlt-5.7.0.jar) to constructor java.net.PlainSocketImpl() WARNING: Please consider reporting this to the maintainers of com.xceptance.xlt.engine.socket.InstrumentedSocketImpl WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

This "future release" seems to have been reached with JDK 17, when the warning turns into an error and running tests becomes impossible:
[11:43:11,425] ERROR [TBrowse-0] - Execution step failed (user: 'TBrowse-0', output: '1640083389589'): null java.lang.ExceptionInInitializerError at com.xceptance.xlt.engine.socket.InstrumentedSocketImplFactory.createSocketImpl(InstrumentedSocketImplFactory.java:33) at java.base/java.net.Socket.setImpl(Socket.java:548) at java.base/java.net.Socket.<init>(Socket.java:143) at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:265) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createSocket(SSLConnectionSocketFactory.java:344) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:119) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:193) at com.xceptance.xlt.engine.CachingHttpWebConnection.getResponse(CachingHttpWebConnection.java:376) at com.xceptance.xlt.engine.XltHttpWebConnection.getResponse(XltHttpWebConnection.java:287) at com.xceptance.xlt.engine.CachingHttpWebConnection.getResponse(CachingHttpWebConnection.java:267) at com.xceptance.xlt.engine.XltHttpWebConnection.getResponse(XltHttpWebConnection.java:177) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1581) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1503) at com.xceptance.xlt.engine.XltWebClient.loadWebResponse(XltWebClient.java:973) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:492) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:412) at com.xceptance.xlt.engine.XltWebClient.getPage(XltWebClient.java:499) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:563) at com.xceptance.xlt.api.actions.AbstractHtmlPageAction.loadPage(AbstractHtmlPageAction.java:202) at com.xceptance.xlt.api.actions.AbstractHtmlPageAction.loadPage(AbstractHtmlPageAction.java:238) at com.xceptance.xlt.api.actions.AbstractHtmlPageAction.loadPage(AbstractHtmlPageAction.java:251) at com.xceptance.posters.loadtest.actions.Homepage.execute(Homepage.java:68) at com.xceptance.xlt.api.actions.AbstractAction.run(AbstractAction.java:358) at com.xceptance.xlt.api.actions.AbstractWebAction.run(AbstractWebAction.java:151) at com.xceptance.xlt.api.actions.AbstractHtmlPageAction.run(AbstractHtmlPageAction.java:139) at com.xceptance.posters.loadtest.tests.TBrowse.browsePosterStore(TBrowse.java:49) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at com.xceptance.xlt.engine.util.XltTestRunner$InvokeMethod.evaluate(XltTestRunner.java:228) at com.xceptance.xlt.engine.util.XltTestRunner$RunBefores.evaluate(XltTestRunner.java:203) at com.xceptance.xlt.engine.util.XltTestRunner$RunAfters.evaluate(XltTestRunner.java:267) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at com.xceptance.xlt.engine.util.XltTestRunner$StatementWrapper.evaluate(XltTestRunner.java:77) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210) Caused by: java.lang.RuntimeException: Failed to initialize class at com.xceptance.xlt.engine.socket.InstrumentedSocketImpl.<clinit>(InstrumentedSocketImpl.java:180) ... 63 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make static java.net.SocketImpl java.net.SocketImpl.createPlatformSocketImpl(boolean) accessible: module java.base does not "opens java.net" to unnamed module @eec5a4a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) at com.xceptance.xlt.engine.socket.InstrumentedSocketImpl.<clinit>(InstrumentedSocketImpl.java:98) ... 63 more

@jowerner
Copy link
Contributor

Workaround: Disable socket instrumentation altogether by setting the following property in the test suite configuration, for example in file config/dev.properties:

com.xceptance.xlt.socket.collectNetworkData = false

Should be necessary in dev mode only, i.e. when running test scenarios from your IDE. In load test mode, the necessary JVM switches to suppress this issue are already in place.

@jowerner jowerner self-assigned this Oct 24, 2023
@jowerner
Copy link
Contributor

XLT does no longer throw if the socket layer cannot be instrumented with the used JVM, but logs a warning only.

@jowerner jowerner added this to the 7.3.1 milestone Oct 24, 2023
@jowerner jowerner linked a pull request Oct 24, 2023 that will close this issue
h-arlt pushed a commit that referenced this issue Nov 15, 2023
* XLT does no longer throw if the socket layer cannot be instrumented with the used JVM, but logs a warning only.

* If the socket layer cannot be instrumented with the used JVM, log a warning in dev mode, but throw an exception in load test mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants