java.lang.IllegalStateException: Failed to execute CommandLineRunner

Spring JIRA | Mark Manders | 2 years ago
  1. 0

    Exception accessing Spring managed bean from Groovy closure

    Stack Overflow | 2 years ago
    java.lang.IllegalStateException: Failed to execute CommandLineRunner
  2. 0

    When using the Spring framework in combination with the Groovy language, it is impossible to access @Autowired beans from a Groovy closure. Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304) at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675) at com.example.closures.ClosuresApplication$_run_closure1.doCall(ClosuresApplication.groovy:22) at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.boot.SpringApplication$run.call(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292) at com.example.closures.ClosuresApplication.main(ClosuresApplication.groovy:27) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016) Caused by: groovy.lang.MissingPropertyException: No such property: bank for class: com.example.closures.ClosuresApplication$$EnhancerBySpringCGLIB$$44735576 at groovy.lang.Closure.call(Closure.java:423) at groovy.lang.Closure.call(Closure.java:439) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2027) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2012) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2053) at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at com.example.closures.ClosuresApplication$_run_closure1.doCall(ClosuresApplication.groovy:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) at java.lang.reflect.Method.invoke(Method.java:497) at com.example.closures.ClosuresApplication.run(ClosuresApplication.groovy:21) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:672) ... 9 common frames omitted is thrown from within the 'each' closure in the main class: @SpringBootApplication class ClosuresApplication implements CommandLineRunner { @Autowired private Bank bank @Override void run(String... args) throws Exception { for (def i = 0; i < 10; i++) { printf 'Bank %02d: %s%n', (i + 1), bank } (1..10).each { printf 'Bank %02d: %s%n', it, bank } } static void main(String[] args) { SpringApplication.run ClosuresApplication, args } }

    Spring JIRA | 2 years ago | Mark Manders
    java.lang.IllegalStateException: Failed to execute CommandLineRunner
  3. 0

    When using the Spring framework in combination with the Groovy language, it is impossible to access @Autowired beans from a Groovy closure. Exception in thread "main" java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304) at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675) at com.example.closures.ClosuresApplication$_run_closure1.doCall(ClosuresApplication.groovy:22) at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.boot.SpringApplication$run.call(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292) at com.example.closures.ClosuresApplication.main(ClosuresApplication.groovy:27) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016) Caused by: groovy.lang.MissingPropertyException: No such property: bank for class: com.example.closures.ClosuresApplication$$EnhancerBySpringCGLIB$$44735576 at groovy.lang.Closure.call(Closure.java:423) at groovy.lang.Closure.call(Closure.java:439) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2027) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2012) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2053) at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at com.example.closures.ClosuresApplication$_run_closure1.doCall(ClosuresApplication.groovy:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) at java.lang.reflect.Method.invoke(Method.java:497) at com.example.closures.ClosuresApplication.run(ClosuresApplication.groovy:21) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:672) ... 9 common frames omitted is thrown from within the 'each' closure in the main class: @SpringBootApplication class ClosuresApplication implements CommandLineRunner { @Autowired private Bank bank @Override void run(String... args) throws Exception { for (def i = 0; i < 10; i++) { printf 'Bank %02d: %s%n', (i + 1), bank } (1..10).each { printf 'Bank %02d: %s%n', it, bank } } static void main(String[] args) { SpringApplication.run ClosuresApplication, args } }

    Spring JIRA | 2 years ago | Mark Manders
    java.lang.IllegalStateException: Failed to execute CommandLineRunner
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Grails\Groovy Syntax Sugar not being added in Webflow integration tests on commmand line

    Stack Overflow | 2 years ago | Josh D
    groovy.lang.MissingPropertyException: No such property: blahMessage for class: org.springframework.webflow.core.collection.LocalAttributeMap
  6. 0

    Dmitrijs Artjomenko blog: No such property error in Cucumber specs with Geb

    artjomenko.com | 7 months ago
    groovy.lang.MissingPropertyException: No such property: loginField for class: steps.Login_steps

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. groovy.lang.MissingPropertyException

      No such property: bank for class: com.example.closures.ClosuresApplication$$EnhancerBySpringCGLIB$$44735576

      at groovy.lang.Closure.call()
    2. Groovy
      PojoMetaMethodSite.call
      1. groovy.lang.Closure.call(Closure.java:423)
      2. groovy.lang.Closure.call(Closure.java:439)
      3. org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2027)
      4. org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51)
      5. org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2012)
      6. org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
      7. org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2053)
      8. org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
      9. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304)
      10. org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
      11. org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
      11 frames
    3. com.example.closures
      ClosuresApplication$_run_closure1.doCall
      1. com.example.closures.ClosuresApplication$_run_closure1.doCall(ClosuresApplication.groovy:22)
      1 frame
    4. Java RT
      NativeMethodAccessorImpl.invoke0
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      1 frame
    5. Groovy
      CallSiteArray.defaultCall
      1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      1 frame
    6. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      1 frame
    7. Groovy
      AbstractCallSite.call
      1. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
      1 frame
    8. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      1 frame
    9. Groovy
      AbstractCallSite.call
      1. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)
      1 frame
    10. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Method.java:497)
      1 frame
    11. com.example.closures
      ClosuresApplication.run
      1. com.example.closures.ClosuresApplication.run(ClosuresApplication.groovy:21)
      1 frame
    12. Groovy
      CachedMethod.invoke
      1. org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      1 frame
    13. Spring Boot
      SpringApplication$run.call
      1. org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:672)
      2. org.springframework.boot.SpringApplication$run.call(Unknown Source)
      2 frames
    14. Groovy
      ClosureMetaClass.invokeMethod
      1. org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
      2. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
      3. groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
      4. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
      5. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
      6. org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292)
      6 frames
    15. com.example.closures
      ClosuresApplication.main
      1. com.example.closures.ClosuresApplication.main(ClosuresApplication.groovy:27)
      1 frame
    16. Groovy
      MetaClassImpl.invokeMethod
      1. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
      1 frame