Unable to launch AUT with OpenJDK17 [message #1848174] |
Tue, 23 November 2021 08:10  |
Eclipse User |
|
|
|
Hi,
I am testing a Swing-application and have run into a problem. A couple a weeks ago we changed java version from Java 8 to OpenJDK17 and now I can't start our AUT anymore. I get an exception when starting the AUT. Se exception from client.log below. As you can see in the log I tried to add parameter --illegal-access=permit but that was ignored. It seems as XStream serialization uses reflection which is not allowed anymore.
Is there any simple work-around to fix the problem? Does Jubula have to be updated since reflection is blocked in OpenJDK17?
Are you working on such an update? When can such an update be ready for release?
Kind regards,
Martin
__________________________
Setup
* Swing application
* Jubula version 8.8.0.034
* OpenJDK17
__________________________
2021-11-23 13:46:19.175 [Connection.ReaderThread:Socket[addr=localhost/127.0.0.1,port=60001,localport=60034]] ERROR o.e.j.c.i.c.StartAUTServerStateCommand - AUTServer could not start: Unknown AUTServer exit code: 31.
Picked up _JAVA_OPTIONS: "-javaagent:C:\dev\tools\jubula\jubula_8.8.0.034\ite\plugins\org.eclipse.jubula.rc.common.agent_8.0.3.202007131040.jar"
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0
WARNING: A command line option has enabled the Security Manager
WARNING: The Security Manager is deprecated and will be removed in a future release
java.lang.reflect.InvocationTargetException
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.eclipse.jubula.rc.common.AutServerLauncher.main(AutServerLauncher.java:97)
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.eclipse.jubula.rc.common.agent.RCAgent.premain(RCAgent.java:108)
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 java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Caused by: java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties
at com.thoughtworks.xstream.converters.collections.PropertiesConverter.<clinit>(PropertiesConverter.java:46)
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:647)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:445)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:385)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:352)
at org.eclipse.jubula.tools.internal.serialisation.XStreamXmlSerializer.<init>(XStreamXmlSerializer.java:47)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.eclipse.jubula.tools.internal.serialisation.IXmlSerializer$Factory.create(IXmlSerializer.java:47)
at org.eclipse.jubula.communication.internal.parser.MessageSerializer.<init>(MessageSerializer.java:41)
at org.eclipse.jubula.communication.internal.Communicator.init(Communicator.java:272)
at org.eclipse.jubula.communication.internal.Communicator.<init>(Communicator.java:204)
at org.eclipse.jubula.rc.common.AUTServer.initAutAgentCommunicator(AUTServer.java:827)
at org.eclipse.jubula.rc.common.registration.AgentRegisterAut.register(AgentRegisterAut.java:128)
at org.eclipse.jubula.rc.common.AUTServer.registerAutinAgent(AUTServer.java:548)
at org.eclipse.jubula.rc.common.AUTServer.start(AUTServer.java:511)
at org.eclipse.jubula.rc.common.AUTServer.main(AUTServer.java:385)
... 16 more
|
|
|
|
|
|
|
|
|
Re: Unable to launch AUT with OpenJDK17 [message #1855275 is a reply to message #1854984] |
Wed, 05 October 2022 23:48   |
Eclipse User |
|
|
|
It took me a while to figure this out so I am posting what I did here, in this post, in case someone come across this same issue later on.
First off, all the 'add-opens' option is to be added to the actual command that starts the AUT, not in the Jubula IDE (project setup page) or when starting Jubula. Let me repeat - The actual command that starts the AUT - that was my first mistake.
Options that doesn't work:
- Jubula IDE AUT configure page
- AUT Arguments
- JRE Arguments
Second, I found that when running Jubula via the IDE, the client and agent logs are not very detailed and not very helpful in trying to figure out what is missing. What helped me ultimately in figuring out what is missing and getting past this issue with serialization, i.e. what needs to 'open' when starting the AUT, is to use the command line option
<Juluba_install>/ite/testexec.exe
to start the Jubula tests/AUT. The data that appears in the console log (command line or terminal) provides much more information - actual exception and call stack - which helped in figuring out what is missing.
The bottom line is if you are running into same issue with serialization when starting your application using JDK 17 (and it works with other JDK versions - 8 or 11), you need to add the '--add-opens' line into the command that starts the AUT.
For me the call to start AUT is a batch (or sh) file, so I added all the missing '--add-opens' into the same line that starts the AUT.
Here is a snippet of what my command eventually looks like:
"%JAVA_PATH%" --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED ... (other parameters that starts the AUT)
At minimum, as mentioned in previous comments, you need to add the following line
--add-opens java.base/java.util=ALL-UNNAMED
to the starting command for your AUT. You can also add the
when running in OpenJDK 17 (or above) just so you can see that this option is now deprecated in the (same) console log when starting AUT
Once you are successful - meaning you can see the line for deprecated option illegal-access AND see the add-opens line in your AUT start-up, you will now be able to see what else is missing.
Hint:
Start with the keyword "InvocationTargetException" in the console log. Look down from there until you see the 'InaccessibleObjectException" or any other exceptions that points to the exact issue that is causing the Exception - those at the items that needs to be 'opened'. A sample of what I mean is attached to this post under the file name "missingAddOpensOptionsWithJDK17.png"
Start adding those missing items, one at a time, to the same command that starts the AUT and run the testexec.exe command again. Repat until you no longer see any issues and finally see that AUT starting up.
|
|
|
Re: Unable to launch AUT with OpenJDK17 [message #1855931 is a reply to message #1855275] |
Thu, 10 November 2022 03:49  |
Eclipse User |
|
|
|
Hi Jubula Team,
i'd the same problem as Martin and Lynette described. With their tips it was possible to start the Java17 swift-app with Jubula 8.6.
These additional parameters will be used with the app:
--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED
but.....
The methods "ub_cti_inputText / input text" and„ub_grc_click / click" doesn't work any more. Jubula stated "Configuration Error".
Other methods like "store value" or "Button exists" works fine. Also all objects are recognized in the object mapper
Do you haveany hints where to search for the origin of the "Configuration Error" ?
Additional:
- Same Problem with latest Jubula-Version 8.8.1
- ObjectMapper works fine. New Objects can be added
- right and left Mouseclick, Input Text doesn't work
- "ub_ctx_storeValue" works fine
Problem solved!
Solution: adding a fourth "add-opens" when starting AUT:
--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED
But now mouse is moving veeeery slow. This Problem exist since JDK 11.0.12.x in Windows (see: https://www.eclipse.org/forums/index.php/t/1109633/)
Workaround: (with Jubula 8.8.1, doesn't work with 8.6.0)
add
TEST_DISABLE_MOUSE_MOVEMENT=true
to AUT-Agents "System Environment Variables"
How to do:
Click in Jubula on menu "Test" -> "Properties" -> "AUTs" -> choose your "AUT" -> "Edit" -> choose your "AUT configurations" -> "Edit" -> "Expert" -> Enter "TEST_DISABLE_MOUSE_MOVEMENT=true" (without ") in "System Environment Variables" -> "ok" -> "ok" -> "Apply and Close"
Thanks to Martin J ! :-)
[Updated on: Fri, 18 November 2022 11:28] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03901 seconds