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

got exception during startup process #7

Closed
evgenyz1 opened this issue Dec 9, 2020 · 3 comments
Closed

got exception during startup process #7

evgenyz1 opened this issue Dec 9, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@evgenyz1
Copy link

evgenyz1 commented Dec 9, 2020

I use a simple spring boot app which expose rest endpoint. If I use the following configuration in application.yml
flightrecorder:
enabled: true # is this starter active?

I've got the following exception. Please see log below.

And everything is fine if I use the following configuration

flightrecorder:
enabled: true # is this starter active?
recordingCleanupInterval: 5000 # try to cleanup old recordings every 5 seconds
triggerCheckInterval: 10000 # evaluate trigger expressions every 10 seconds
trigger:
- expression: meter('jvm.memory.used').tag('area','nonheap').tag('id','Metaspace').measurement('value') > 100
startRecordingCommand:
duration: 60
timeUnit: SECONDS

C:\Users\evgen\jfr_test\jfrdemo1>docker run --name jfrtestimage_c -p 8080:8080 --rm -i -t jfrtestimage1 bash

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.4.0)

2020-12-09 09:28:45.547 INFO 1 --- [ main] com.example.jfrdemo.JfrdemoApplication : Starting JfrdemoApplication v0.0.1-SNAPSHOT using Java 11.0.7 on d7e2cec6ca38 with PID 1 (/app.jar started by root in /)
2020-12-09 09:28:45.554 INFO 1 --- [ main] com.example.jfrdemo.JfrdemoApplication : No active profile set, falling back to default profiles: default
2020-12-09 09:28:47.351 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-12-09 09:28:47.365 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-12-09 09:28:47.366 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-12-09 09:28:47.439 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-12-09 09:28:47.440 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1746 ms
2020-12-09 09:28:47.990 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-12-09 09:28:48.259 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triggerChecker' defined in class path resource [de/mirkosertic/flightrecorderstarter/FlightRecorderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.mirkosertic.flightrecorderstarter.TriggerChecker]: Factory method 'triggerChecker' threw exception; nested exception is java.lang.NullPointerException
2020-12-09 09:28:48.260 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2020-12-09 09:28:48.264 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-12-09 09:28:48.292 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-09 09:28:48.313 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triggerChecker' defined in class path resource [de/mirkosertic/flightrecorderstarter/FlightRecorderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.mirkosertic.flightrecorderstarter.TriggerChecker]: Factory method 'triggerChecker' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925) ~[spring-context-5.3.1.jar!/:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.1.jar!/:5.3.1]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.0.jar!/:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.0.jar!/:2.4.0]
at com.example.jfrdemo.JfrdemoApplication.main(JfrdemoApplication.java:10) ~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[app.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[app.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.mirkosertic.flightrecorderstarter.TriggerChecker]: Factory method 'triggerChecker' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.1.jar!/:5.3.1]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.3.1.jar!/:5.3.1]
... 28 common frames omitted
Caused by: java.lang.NullPointerException: null
at de.mirkosertic.flightrecorderstarter.TriggerChecker.(TriggerChecker.java:70) ~[flight-recorder-starter-2.0.0.jar!/:2.0.0]
at de.mirkosertic.flightrecorderstarter.FlightRecorderConfiguration.triggerChecker(FlightRecorderConfiguration.java:49) ~[flight-recorder-starter-2.0.0.jar!/:2.0.0]
at de.mirkosertic.flightrecorderstarter.FlightRecorderConfiguration$$EnhancerBySpringCGLIB$$3320d9b9.CGLIB$triggerChecker$3() ~[flight-recorder-starter-2.0.0.jar!/:2.0.0]
at de.mirkosertic.flightrecorderstarter.FlightRecorderConfiguration$$EnhancerBySpringCGLIB$$3320d9b9$$FastClassBySpringCGLIB$$d14052db.invoke() ~[flight-recorder-starter-2.0.0.jar!/:2.0.0]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.1.jar!/:5.3.1]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.1.jar!/:5.3.1]
at de.mirkosertic.flightrecorderstarter.FlightRecorderConfiguration$$EnhancerBySpringCGLIB$$3320d9b9.triggerChecker() ~[flight-recorder-starter-2.0.0.jar!/:2.0.0]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.1.jar!/:5.3.1]
... 29 common frames omitted

@mirkosertic mirkosertic self-assigned this Dec 10, 2020
@mirkosertic mirkosertic added the bug Something isn't working label Dec 10, 2020
@mirkosertic
Copy link
Owner

Thank you for reporting this bug!

I've release version 2.0.1 including a fix to Maven Central a few minutes ago. It should be synced to all mirrors in a few hours.

@evgenyz1
Copy link
Author

Cool! Thank you!

@evgenyz1
Copy link
Author

I've checked out. Everything is working well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants