I connected to my heroku server and i found that suddenly after app restart it crashed, i did not change anything i did not push any changes, after inspecting the log i found out that the app couldn't find the class io.github.jhipster.config.metrics.PrometheusRegistry
so i looked for the class and i found that class does'nt exist anymore after the commit "f1d1f9c" that was made 6 days ago .
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Just for reference, the commit you are referring to is https://github.com/jhipster/jhipster/commit/f1d1f9c6f415abf2b417d57ddc15814a657573a9 but that shouldn't have affected your project as you use JHipster v4.6.2 (which uses v1.1.8 of the jhipster server library)
So this issue started happening after you restarted your app on Heroku?
yup the issue started after the daily restart of monday 26
Restarting your app wouldn't update your dependencies, so I'm not sure there's an issue on our end here. Can you tell us your version of jhipster-server from your pom.xml please?
Yes @ruddell thank you very much for your support it was an error due to heroku enabled feature i'm closing the issue , sorry my bad.
Hi @AbderrahimRayes, we are experiencing the same exception on Heroku... Would you be able to elaborate on which heroku feature was causing the issue? Thanks in advance!
Hello @kevinbbd i'm sorry for not clarifying the issue , the features were runtime-heroku-exec and runtime-heroku-metrics you can disable it by :
heroku features:disable runtime-heroku-exec -a yourapp
heroku features:disable runtime-heroku-metrics -a yourapp
Thanks @AbderrahimRayes!! The heroku features:disable runtime-heroku-metrics command is what fixed it for us. What we were experiencing was the Picked up JAVA_TOOL_OPTIONS: -javaagent:/app/.heroku/bin/heroku-metrics-agent.jar was showing showing up in the logs when the application was attempting to boot. Which resulted in the following exception:
java.lang.IllegalStateException: Cannot load configuration class: io.github.jhipster.config.metrics.PrometheusRegistry at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403)
The Heroku Java Metric Agent exposes a Prometheus Java client and the JHipster PrometheusRegistry is doing a @ConditionalOnClass to io.prometheus.client.CollectorRegistry which the Heroku agent is supplying, however the dependencies of the Heroku agent is different from JHipster, such as DropdownWizard metrics. This results in the java.lang.NoClassDefFoundError: io/prometheus/client/dropwizard/DropwizardExports
Most helpful comment
Thanks @AbderrahimRayes!! The
heroku features:disable runtime-heroku-metricscommand is what fixed it for us. What we were experiencing was thePicked up JAVA_TOOL_OPTIONS: -javaagent:/app/.heroku/bin/heroku-metrics-agent.jarwas showing showing up in the logs when the application was attempting to boot. Which resulted in the following exception:java.lang.IllegalStateException: Cannot load configuration class: io.github.jhipster.config.metrics.PrometheusRegistry at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403)The Heroku Java Metric Agent exposes a Prometheus Java client and the JHipster PrometheusRegistry is doing a
@ConditionalOnClasstoio.prometheus.client.CollectorRegistrywhich the Heroku agent is supplying, however the dependencies of the Heroku agent is different from JHipster, such as DropdownWizard metrics. This results in thejava.lang.NoClassDefFoundError: io/prometheus/client/dropwizard/DropwizardExports