Closed paoloaq closed 7 years ago
I am not able to reproduce this. I copied your pom and application properties exactly. I did notice you do not have spring-boot-starter-web
as a dependency, usually you would want that included as well. If you can post a zip of the failing application or put the code on github I can try and use that to reproduce the problem.
The spring-boot-starter-web
, 1.4.2.RELEASE, is resolved in the effective pom. Anyway, adding the spring-boot-starter-web
to the pom file, does not change the situation.
Here is the code: eureka-server_issue-1491
It must be something in your environment because the app starts fine for me.
This is my environment:
I also tried to run it from the command line:
mvn spring-boot: run
The error is the same as in the IDE: NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter' available
.
However, another strange thing is the result of these commands from terminal:
mvn install
java -jar target/EurekaServer-0.0.1-SNAPSHOT.jar
Error:
Exception in thread "main" 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:497)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.IllegalArgumentException: Unable to load [org.springframework.context.ApplicationContextInitializer] factories from location [META-INF/spring.factories]
at org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(SpringFactoriesLoader.java:124)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:402)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:394)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:261)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at com.example.springMicroservices.EurekaServerApplication.main(EurekaServerApplication.java:11)
... 8 more
Caused by: java.util.zip.ZipException: invalid code lengths set
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:139)
at org.springframework.core.io.support.PropertiesLoaderUtils.loadProperties(PropertiesLoaderUtils.java:121)
at org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(SpringFactoriesLoader.java:117)
... 15 more
Thanks for your help!
Bad jar? try cleaning your maven repo.
@spencergibb thank you so much !!!
rm -r $HOME/.m2
has completely solved my issue!
Sorry for the inconvenience and thank you again! :)
I also faced the same problem, and yes rm -r $HOME/.m2 worked for me also. Thanks a lot guys.
Tried with deleting only the repo, still not working. After deleting m2 folder itself , started working. Bit strange though ???
@kuldeepkrsharma029 I am a beginner. How do I do this rm -r $ HOME / .m2
@kuldeepkrsharma029 Where to execute?
The following example works with the
spring-boot-starter-parent
1.4.1. However, with thespring-boot-starter-parent
1.4.2, the exceptionNoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter'
occurs.Boot Application class:
application.yml:
pom.xml:
Error with the
spring-boot-starter-parent
1.4.2: