jdaugherty commented on issue #13695:
URL: https://github.com/apache/grails-core/issues/13695#issuecomment-4473819589
What the code does:
1. JMX first (lines 52–73): Uses com.sun.tools.attach.VirtualMachine to
find the running JVM, attach to it, load the management agent, and call
mbean.shutdown() on name=shutdownEndpoint,type=Endpoint.
2. HTTP fallback (lines 76–98): POSTs to /actuator/shutdown — this is
where your error comes from.
Why you're getting FileNotFoundException:
FileNotFoundException from Java's URL.openConnection() means HTTP 404. The
actuator shutdown endpoint is disabled by default. You need both:
# application.yml
management:
endpoint:
shutdown:
enabled: true
endpoints:
web:
exposure:
include: shutdown # only needed for HTTP fallback
Why JMX fallback likely silently failed:
The JMX path (line 46) catches Throwable silently. Common reasons it fails:
- com.sun.tools.attach.VirtualMachine not on classpath (requires JDK, not
JRE, or the jdk.attach module)
- MainClassFinder.findMainClass() returns null or doesn't match the
running process's display name
- Java 9+ module restrictions on management-agent.jar (line 31–32 tries to
load it, but that jar was removed in Java 9+)
Bottom line: Even if you fix the HTTP endpoint, the JMX approach is the
more reliable one — but it requires management.endpoint.shutdown.enabled=true
too (that's what registers the MBean). The
management-agent.jar loading at line 31–32 is a Java 8-era approach that
breaks on Java 9+.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]