I’ve seen this ages ago when JOSM tried to connect over IPv6 when it found IPv6 available but not routing (a web search for “josm ipv6” will find various comments). Various things have been changed at the JOSM end since then though.
If this is not the first time that JOSM was installed on the system maybe a broken configuration exists. Try to start josm from a command line in debug mode and with a clean directory:
If JOSM works with that command you should try to remove the old configuration. The command
java -jar josm-tested.jar --help
tells you the directory names.
If JOSM still doesn’t work please open a ticket here: https://josm.openstreetmap.de/newticket
and provide the content of the file josm.log and as well as the output of
java -version
The JOSM devs probably know what to do or where to look at.