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

Java error on startup when using a custom JRE #2284

Closed
jospoortvliet opened this issue Jun 21, 2021 · 15 comments · Fixed by #2285
Closed

Java error on startup when using a custom JRE #2284

jospoortvliet opened this issue Jun 21, 2021 · 15 comments · Fixed by #2285
Assignees
Milestone

Comments

@jospoortvliet
Copy link

jospoortvliet commented Jun 21, 2021

Hi,

starting the client, I get this in a dialog:

java.lang.RuntimeException: Exception in Application init method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:895)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: Failed to init Reactor's debug agent
	at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:52)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
	at com.faforever.client.FafClientApplication.init(FafClientApplication.java:110)
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
	... 2 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:49)
	... 19 more
Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:675)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:606)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:586)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:515)
	at reactor.tools.agent.ReactorDebugAgent.init(ReactorDebugAgent.java:56)
	... 24 more

and on the command line, this:

INSTALL4J_JAVA_HOME="/usr/lib64/jvm/jre-15-openjdk" ./downlords-faf-client
21:26:37.798 [main] DEBUG com.faforever.client.preferences.PreferencesService - Logger initialized
21:26:38.810 [JavaFX-Launcher] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.RuntimeException: Failed to init Reactor's debug agent
        at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:52)
        at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
        at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
        at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
        at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
        at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
        at com.faforever.client.FafClientApplication.init(FafClientApplication.java:110)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
        at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:49)
        ... 19 common frames omitted
Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
        at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:675)
        at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:606)
        at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:586)
        at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538)
        at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:515)
        at reactor.tools.agent.ReactorDebugAgent.init(ReactorDebugAgent.java:56)
        ... 24 common frames omitted

Version 1.4.3 still works for me, 1.4.4, 1.4.5 and 1.4.6 as well as 1.4.7RC1 all have this problem. Log file for 1.4.5 for example contains:

Exception in Application init method
java.lang.RuntimeException: Exception in Application init method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:895)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: Failed to init Reactor's debug agent
	at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:52)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
	at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
	at com.faforever.client.FafClientApplication.init(FafClientApplication.java:110)
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:824)
	... 2 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.springframework.boot.reactor.DebugAgentEnvironmentPostProcessor.postProcessEnvironment(DebugAgentEnvironmentPostProcessor.java:49)
	... 19 more
Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:675)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:606)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:586)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538)
	at reactor.tools.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:515)
	at reactor.tools.agent.ReactorDebugAgent.init(ReactorDebugAgent.java:56)
	... 24 more

OS: Linux 5.12.10 on openSUSE Tumbleweed
Java: openJDK 15.0.3.0

What can I do to help debug this?

@Brutus5000
Copy link
Member

This error occurs when running on a JRE. Your INSTALL4J_JAVA_HOME also indicates this. Running it from a JDK should work.
I don't know why this happened though 🤷

@Sheikah45
Copy link
Member

I have also seen this error be caused by antivirus.

@Brutus5000
Copy link
Member

Not on Linux 😛

@jospoortvliet
Copy link
Author

This error occurs when running on a JRE. Your INSTALL4J_JAVA_HOME also indicates this. Running it from a JDK should work.
I don't know why this happened though shrug

For whomever reads this issue - on my openSUSE system, installing these packages fixed it:
java-15-openjdk-devel java-15-openjdk-jmods java-15-openjdk-src

from a 5 minute google search - a JRE is a runtime, a JDK is a full development kit. Somehow, the runtime isn't enough (anymore) so the entire dev kit is needed. Install it - and 🚀

Not sure if this issue should remain open - I can imagine a JRE is supposed to be sufficient to run the faf client, but I can also imagine this ain't the most important problem (all it takes is a quick installation of a few libs and a bit of disk space):

20:21:39 root@localhost:/home/spelletje/>zypper in java-15-openjdk-src java-15-openjdk-jmods 
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  java-15-openjdk-devel java-15-openjdk-jmods java-15-openjdk-src

3 new packages to install.
Overall download size: 288.0 MiB. Already cached: 0 B. After the operation, additional 303.5 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package java-15-openjdk-devel-15.0.3.0-1.2.x86_64(1/3),   5.3 MiB (  8.1 MiB unpacked)
Retrieving: java-15-openjdk-devel-15.0.3.0-1.2.x86_64.rpm ..........[done (5.5 MiB/s)]
Retrieving package java-15-openjdk-src-15.0.3.0-1.2.x86_64 (2/3),  49.0 MiB ( 54.2 MiB unpacked)
Retrieving: java-15-openjdk-src-15.0.3.0-1.2.x86_64.rpm ............[done (6.1 MiB/s)]
Retrieving package java-15-openjdk-jmods-15.0.3.0-1.2.x86_64  (3/3), 233.7 MiB (241.3 MiB unpacked)
Retrieving: java-15-openjdk-jmods-15.0.3.0-1.2.x86_64.rpm ..........[done (6.2 MiB/s)]

Checking for file conflicts: ...................................................[done]
(1/3) Installing: java-15-openjdk-devel-15.0.3.0-1.2.x86_64 ....................[done]
Additional rpm output:
update-alternatives: using /usr/lib64/jvm/java-15-openjdk/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib64/jvm/java-15-openjdk to provide /usr/lib64/jvm/java-openjdk (java_sdk_openjdk) in auto mode
update-alternatives: using /usr/lib64/jvm/java-15-openjdk to provide /usr/lib64/jvm/java-15 (java_sdk_15) in auto mode


(2/3) Installing: java-15-openjdk-src-15.0.3.0-1.2.x86_64 ......................[done]
(3/3) Installing: java-15-openjdk-jmods-15.0.3.0-1.2.x86_64 ....................[done]
20:23:06 root@localhost:/home/spelletje/>

@Sheikah45
Copy link
Member

I believe we have some critical components which need the jdk

@micheljung
Copy link
Member

You're right @jospoortvliet, the JDK shouldn't be required. Thanks to the information provided by you we should be able to fix this, I'll look into it

@micheljung micheljung reopened this Jun 24, 2021
@micheljung micheljung self-assigned this Jun 24, 2021
@micheljung micheljung changed the title Java error on startup Java error on startup: Failed to init Reactor's debug agent Jun 24, 2021
@micheljung micheljung changed the title Java error on startup: Failed to init Reactor's debug agent Java error on startup when using a custom JRE Jun 24, 2021
@micheljung
Copy link
Member

I submitted #2285. Does this really not happen with a JRE on Windows or are we using a JDK now?

@Sheikah45
Copy link
Member

The client is currently packaged with a jdk these days

@Sheikah45
Copy link
Member

Oh wait no I am totally wrong I think

@Sheikah45
Copy link
Member

Sheikah45 commented Jun 24, 2021

But regardless it does not happen on windows. And this is the first case I have heard of with Linux as well. But I did think when I made the packaged java for install4j that it was based on the jdk and not the jre

@micheljung
Copy link
Member

Install4J should create a JRE based on the JDK. There should be no reason to ship a JDK.

@Sheikah45
Copy link
Member

Yeah I have to check what it is we have on the content server that is being pulled when we build

@Sheikah45 Sheikah45 added this to the 1.5.0 milestone Jul 13, 2021
mrchris2000 pushed a commit to mrchris2000/downlords-faf-client that referenced this issue Apr 15, 2022
@jospoortvliet
Copy link
Author

jospoortvliet commented Oct 21, 2023

Hi team, esp @micheljung @Sheikah45 the problem is back. My solution, installing java-21-openjdk-devel java-21-openjdk-jmods java-21-openjdk-src works - but perhaps the regression can be re-fixed ;-)

EDIT: back in 2023.10.0 - and with Java 21, indeed. Still openSUSE Tumbleweed (it has rolled a fair bit further obviously).

@Sheikah45
Copy link
Member

I had readded the reactor debug agent for some debugging help when people give me logs and forgot this was an issue but I guess it is just expected now.

@jospoortvliet
Copy link
Author

jospoortvliet commented Oct 22, 2023

I had readded the reactor debug agent for some debugging help when people give me logs and forgot this was an issue but I guess it is just expected now.

Allright, works for me of course. I would suggest somebody put this in documentation - somewhere. I volunteer to be 'somebody'.

I cannot change the wiki or figure out how to submit a PR to do so, but the Linux install guide links to a wrong page:
https://github.com/FAForever/downlords-faf-client/wiki/Install-on-Linux#how-to-run-on-linux
https://wiki.faforever.com/en/FAQ/Client-Setup should now be: https://wiki.faforever.com/en/Play/Linux-Install

Meanwhile I will try and update the wiki page and/or report under https://github.com/FAForever/faf-linux

Thanks!

EDIT: looking at wiki & other locations, it seems the "do it yourself" I did just isn't documented much beyond the wiki, which is using ubuntu/debian. The only suggestion I'd make is to add a note to install java-[number]-openjdk-devel java-[number]-openjdk-jmods java-[number]-openjdk-src on openSUSE and their equivalents on other distro's. Will try to get wiki access ;-)

I don't think it's relevant for the linux-install script.

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.

4 participants