tleveque tleveque - 1 month ago 19
Java Question

Using Spring Boot without the parent POM doesn't work

I am trying the simple sample from the SpringBoot QuickStart (http://projects.spring.io/spring-boot/#quick-start).
Using the spring-boot-starter-parent as the parent is working fine. I can run the sample without any problems.
But I absolutely need to use my own parant pom. So I read the documentation :
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-maven-without-a-parent

I tried it. It compiled fine. But crash at run time.
Here is my configuration.
In my parent pom:

<dependencyManagement>
<dependencies>
....
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.1.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
....
</dependencies>
</dependencyManagement>


In my pom:

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>


But when I run the application, I get this:



2014-08-11 12:50:29.275 ERROR 28474 --- [ main] o.s.boot.SpringApplication : Application startup failed

java.lang.IllegalStateException: Failed to introspect annotations: class com.imetrik.oaas.tool.application.springboottest.SampleController.SampleController
at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:169)
at org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:75)
at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:138)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:128)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:123)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:159)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.imetrik.oaas.tool.application.springboottest.SampleController.SampleController.main(SampleController.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
at java.lang.Class.getAnnotations(Class.java:3158)
at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:195)
at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:212)
at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:165)
... 18 common frames omitted

Exception in thread "main" java.lang.IllegalStateException: Failed to introspect annotations: class com.imetrik.oaas.tool.application.springboottest.SampleController.SampleController
at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:169)
at org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:75)
at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:138)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:128)
at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:123)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:159)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135)
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:127)
at org.springframework.boot.SpringApplication.load(SpringApplication.java:620)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.imetrik.oaas.tool.application.springboottest.SampleController.SampleController.main(SampleController.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
at java.lang.Class.getAnnotations(Class.java:3158)
at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:195)
at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:212)
at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:165)
... 18 more

Process finished with exit code 1



I have no clue how to solve this. I tried putting the dependencyManagement directly in my pom (not in the parent). Same result.
I did search here on stackoverflow and elsewhere, but I cannot find a single working example.
We are using Maven 3.0.4 and Java 1.7U51

Answer

The problem was that my parent pom was dependent on Spring 3.2.5. And I find out that Spring-Boot 1.5.x needs at least Spring 4. This is not clearly defined on the Spring-Boot page.

Comments