I am getting error when following the 1.8 Understand auto-configuration video.
It is strange, because the file demo/LogTomcatVersionAutoConfiguration.class is in the fat jar.
alexub@alex-pc:~/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty$ mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building livelessons-bootstrap-autoconfiguration-jetty 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) > test-compile @ livelessons-bootstrap-autoconfiguration-jetty >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ livelessons-bootstrap-autoconfiguration-jetty ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/alexub/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty/src/main/resources
[INFO] skip non existing resourceDirectory /home/alexub/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ livelessons-bootstrap-autoconfiguration-jetty ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ livelessons-bootstrap-autoconfiguration-jetty ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/alexub/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ livelessons-bootstrap-autoconfiguration-jetty ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) < test-compile @ livelessons-bootstrap-autoconfiguration-jetty <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) @ livelessons-bootstrap-autoconfiguration-jetty ---
. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v1.4.1.RELEASE)
2017-01-15 19:34:55.696 INFO 32519 --- [ main] d.BootstrapAutoConfigureJettyApplication : Starting BootstrapAutoConfigureJettyApplication on alex-pc with PID 32519 (/home/alexub/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty/target/classes started by alexub in /home/alexub/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty)
2017-01-15 19:34:55.700 INFO 32519 --- [ main] d.BootstrapAutoConfigureJettyApplication : No active profile set, falling back to default profiles: default
2017-01-15 19:34:55.750 INFO 32519 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5676b034: startup date [Sun Jan 15 19:34:55 EST 2017]; root of context hierarchy
2017-01-15 19:34:56.000 WARN 32519 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [demo.BootstrapAutoConfigureJettyApplication]; nested exception is java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
2017-01-15 19:34:56.010 ERROR 32519 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [demo.BootstrapAutoConfigureJettyApplication]; nested exception is java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:489) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:191) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at demo.BootstrapAutoConfigureJettyApplication.main(BootstrapAutoConfigureJettyApplication.java:12) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:506) [spring-boot-maven-plugin-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
Caused by: java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:94) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:481) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
... 20 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:50) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:89) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:76) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClasses.(AutoConfigurationSorter.java:110) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:54) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.sort(EnableAutoConfigurationImportSelector.java:193) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:89) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
... 21 common frames omitted
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:506)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [demo.BootstrapAutoConfigureJettyApplication]; nested exception is java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:489)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:191)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at demo.BootstrapAutoConfigureJettyApplication.main(BootstrapAutoConfigureJettyApplication.java:12)
... 6 more
Caused by: java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:94)
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:481)
... 20 more
Caused by: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:50)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98)
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:89)
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:76)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClasses.(AutoConfigurationSorter.java:110)
at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:54)
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.sort(EnableAutoConfigurationImportSelector.java:193)
at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:89)
... 21 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.423 s
[INFO] Finished at: 2017-01-15T19:34:56-05:00
[INFO] Final Memory: 29M/275M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project livelessons-bootstrap-autoconfiguration-jetty: An exception occurred while running. null: InvocationTargetException: Failed to process import candidates for configuration class [demo.BootstrapAutoConfigureJettyApplication]; nested exception is java.lang.IllegalStateException: java.io.FileNotFoundException: class path resource [demo/LogTomcatVersionAutoConfiguration.class] cannot be opened because it does not exist -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
alexub@alex-pc:~/dev/videos/safari/microservices_spring_boot/code/livelessons-bootstrap/livelessons-bootstrap-autoconfiguration-jetty$
Update: I got livelessons-bootstrap-autoconfiguration-jetty$ mvn spring-boot:run working.
I commented out
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
demo.LogTomcatVersionAutoConfiguration
in livelessons-bootstrap-autoconfiguration/src/main/resources/META-INF/spring.factories.
This prevented finding LogTomcatVersionAutoConfiguration.
To fix that, I added @componentscan to BootStrapAutoConfigureApplication in livelessons-bootstrap-autoconfiguration/src/main/java/demo.