i upgraded today from 1.2.0.M1 to 1.2.0.M2 in my development version and tried to deploy my app on wildfly 8.1.0. during app start i got this exception:
09:56:25,987 INFO [org.springframework.core.annotation.AnnotationUtils] (MSC service thread 1-4) Failed to introspect annotations on [class org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration]: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
09:56:25,988 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./steamstats: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./steamstats: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_20]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]
Caused by: java.lang.RuntimeException: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:219)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) [rt.jar:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) [rt.jar:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) [rt.jar:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) [rt.jar:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) [rt.jar:1.8.0_20]
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) [rt.jar:1.8.0_20]
at java.lang.Class.createAnnotationData(Class.java:3508) [rt.jar:1.8.0_20]
at java.lang.Class.annotationData(Class.java:3497) [rt.jar:1.8.0_20]
at java.lang.Class.getDeclaredAnnotations(Class.java:3464) [rt.jar:1.8.0_20]
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:371)
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:333)
at org.springframework.core.annotation.OrderUtils.getOrder(OrderUtils.java:58)
at org.springframework.core.annotation.OrderUtils.getOrder(OrderUtils.java:47)
at org.springframework.core.annotation.AnnotationAwareOrderComparator.findOrder(AnnotationAwareOrderComparator.java:79)
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:105)
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:94)
at org.springframework.core.OrderComparator.doCompare(OrderComparator.java:77)
at org.springframework.core.OrderComparator.compare(OrderComparator.java:63)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351) [rt.jar:1.8.0_20]
at java.util.TimSort.sort(TimSort.java:216) [rt.jar:1.8.0_20]
at java.util.Arrays.sort(Arrays.java:1438) [rt.jar:1.8.0_20]
at java.util.List.sort(List.java:478) [rt.jar:1.8.0_20]
at java.util.Collections.sort(Collections.java:175) [rt.jar:1.8.0_20]
at org.springframework.core.annotation.AnnotationAwareOrderComparator.sort(AnnotationAwareOrderComparator.java:111)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:179)
... 7 more
09:56:25,997 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "steamstats.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host./steamstats" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./steamstats: Failed to start service
Caused by: java.lang.RuntimeException: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy"}}
09:56:25,998 ERROR [org.jboss.as.server] (XNIO-1 task-3) JBAS015870: Deploy of deployment "steamstats.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host./steamstats" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./steamstats: Failed to start service
Caused by: java.lang.RuntimeException: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy"}}
1.2.0.M1 works fine here
This is the JDK's cryptic way of telling you that it's encountered an annotation that's referencing a class that isn't on the class path. Unfortunately, it doesn't tell you which annotation it was processing, where that annotated was sited, or the class that's missing.
Can you post your application's dependencies, please? They should be enough for us to figure it out. The output from mvn dependency:tree
or ./gradlew dependencies
would be ideal.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SteamStats 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ steamstats ---
[INFO] de.bigmichi1:steamstats:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.0.M2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.0.M2:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.0.M2:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.0.M2:compile
[INFO] | | \- org.springframework.boot:spring-boot-starter-logging:jar:1.2.0.M2:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
[INFO] | | +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
[INFO] | | \- ch.qos.logback:logback-classic:jar:1.1.2:compile
[INFO] | | \- ch.qos.logback:logback-core:jar:1.1.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.2:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.1.2.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.1.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.1.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.0.M2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.2.0.M2:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.8.2:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.0.M2:compile
[INFO] | | +- org.springframework:spring-jdbc:jar:4.1.1.RELEASE:compile
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.0.14:compile
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.0.14:compile
[INFO] | | \- org.springframework:spring-tx:jar:4.1.1.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.6.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.3.6.Final:compile
[INFO] | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- org.springframework:spring-orm:jar:4.1.1.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.7.0.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.9.0.RELEASE:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.2.0.M2:compile
[INFO] | +- org.springframework:spring-beans:jar:4.1.1.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.1.1.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.1.1.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:4.0.0.M2:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework.security:spring-security-web:jar:4.0.0.M2:compile
[INFO] | \- org.springframework:spring-aop:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jta-bitronix:jar:1.2.0.M2:compile
[INFO] | +- javax.jms:jms-api:jar:1.1-rev-1:compile
[INFO] | \- org.codehaus.btm:btm:jar:2.1.4:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.2.0.M2:compile
[INFO] | \- org.springframework.boot:spring-boot-actuator:jar:1.2.0.M2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-social-facebook:jar:1.2.0.M2:compile
[INFO] | +- org.springframework.social:spring-social-config:jar:1.1.0.RELEASE:compile
[INFO] | +- org.springframework.social:spring-social-core:jar:1.1.0.RELEASE:compile
[INFO] | +- org.springframework.social:spring-social-web:jar:1.1.0.RELEASE:compile
[INFO] | | \- javax.inject:javax.inject:jar:1:compile
[INFO] | \- org.springframework.social:spring-social-facebook:jar:1.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-social-twitter:jar:1.2.0.M2:compile
[INFO] | \- org.springframework.social:spring-social-twitter:jar:1.1.0.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-crypto:jar:4.0.0.M2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.2.0.M2:compile
[INFO] | +- org.thymeleaf:thymeleaf-spring4:jar:2.1.3.RELEASE:compile
[INFO] | \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.2.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.0.M2:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.14:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.14:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.14:provided
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.2.0.M2:test
[INFO] | +- junit:junit:jar:4.11:test
[INFO] | +- org.mockito:mockito-core:jar:1.9.5:test
[INFO] | | \- org.objenesis:objenesis:jar:1.0:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | \- org.springframework:spring-test:jar:4.1.1.RELEASE:test
[INFO] +- org.springframework.social:spring-social-security:jar:1.1.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-openid:jar:4.0.0.M2:compile
[INFO] | +- com.google.inject:guice:jar:2.0:compile
[INFO] | +- org.openid4java:openid4java-nodeps:jar:0.9.6:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:4.0.0.M2:compile
[INFO] | \- net.sourceforge.nekohtml:nekohtml:jar:1.9.20:runtime
[INFO] | \- xerces:xercesImpl:jar:2.10.0:runtime
[INFO] +- org.springframework.security:spring-security-test:jar:4.0.0.M2:test
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.1.RELEASE:compile
[INFO] | +- org.thymeleaf:thymeleaf:jar:2.1.3.RELEASE:compile
[INFO] | | +- ognl:ognl:jar:3.0.6:compile
[INFO] | | \- org.unbescape:unbescape:jar:1.0:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.0.8:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.13:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.4.2:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.2:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.4.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.2:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.4.2:compile
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] +- com.h2database:h2:jar:1.4.181:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.3.5:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- org.apache.httpcomponents:httpasyncclient:jar:4.0.2:compile
[INFO] | \- org.apache.httpcomponents:httpcore-nio:jar:4.3.2:compile
[INFO] +- javax.cache:cache-api:jar:1.0.0:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.1.RELEASE:compile
[INFO] +- org.projectlombok:lombok:jar:1.14.8:provided
[INFO] +- org.assertj:assertj-core:jar:1.7.0:test
[INFO] +- org.codehaus.sonar-plugins.java:sonar-jacoco-listeners:jar:2.4:test
[INFO] +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.webjars:bootstrap:jar:3.2.0:compile
[INFO] +- org.webjars:font-awesome:jar:4.2.0:compile
[INFO] \- org.webjars:jquery:jar:2.1.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
This is similar to #1065. The problem this time is JerseyAutoConfiguration
. It's annotated with @ConditionalOnClass({SpringComponentProvider.class, ServletRegistration.class})
. Normally, this wouldn't be a problem as, in the absence of either of those classes, the configuration class bean will not be present in the bean factory and, therefore, its annotations will never be introspected using reflection.
However, JerseyAutoConfiguration
is a WebApplicationInitializer
. This means that when it's deployed to a standalone container, JerseyAutoConfiguration
is found by the container and its class is passed to SpringServletContainerInitializer
. SpringServletContainerInitializer
introspects every WebApplicationInitializer
class so that it can order them. This blows up if Jersey's SpringComponentProvider
class isn't on the classpath as the annotation is referencing SpringComponentProvider
as a Class
and the attempt to load it fails. The problem can be avoided by referencing SpringComponentProvider
using a String
.
TL;DR: Using @ConditionalOnClass
on a WebApplicationInitializer
is risky. For it to be safe, the class must be referenced as a String
rather than a Class
.
@wilkinsona I think there is a similar case with EndpointWebMvcChildContextConfiguration
2015-03-17 17:59:29.112 INFO 99517 --- [ main] o.s.core.annotation.AnnotationUtils : Failed to introspect annotations on [class org.springframework.boot.actuate.autoconfigure.EndpointWebMvcChildContextConfiguration$EndpointHandlerMappingConfiguration$$EnhancerBySpringCGLIB$$80ee83ce]: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
2015-03-17 17:59:29.113 INFO 99517 --- [ main] o.s.core.annotation.AnnotationUtils : Failed to introspect annotations on [class org.springframework.boot.actuate.autoconfigure.EndpointWebMvcChildContextConfiguration$EndpointHandlerMappingConfiguration$$EnhancerBySpringCGLIB$$80ee83ce]: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
When Spring Security is not in classpath. Should I open an issue on this?
@lazee Yes, please. EndpointWebMvcChildContextConfiguration
isn't a WebApplicationInitializer
so it's a different (and currently not obvious) cause. A sample app that reproduces the problem would be very helpful.
Thanks
I am getting this :
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
@rupams2002 This issue has been closed for a while. If you think you've found a bug please open a new issue with as much information as possible and a project that reproduces it.
If you are seeing this error (ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy) when running tests with surefire, a workaround is discussed at #6254
I also meet this question, becasue someone of the maven dependency(nested) is conflict with your spring-boot, so you can find the which depency is connect with spring ,so you can exclude it and try run again.
@wilkinsona I have this issue using Boot 2.0 and Spring Security in a project. I understand this issue is closed, but I'm interested in knowing how did you pinpoint the JerseyAutoConfiguration
based on the Gradle dependencies log. I'm sure understanding that would help others later, as the exception is as close to useless as it gets: Otherwise, it's always going to be each ticket for itself (teach a man to fish etc).
I have opened an issue https://github.com/spring-cloud/spring-cloud-netflix/issues/2926
Debug the app with an entry breakpoint on sun.reflect.annotation.TypeNotPresentExceptionProxy.TypeNotPresentExceptionProxy(String, Throwable)
. The Throwable
passed into that constructor is the underlying failure that the JVM swallows.
@wilkinsona - thanks for this tip, you have unblocked my project!
Most helpful comment
Debug the app with an entry breakpoint on
sun.reflect.annotation.TypeNotPresentExceptionProxy.TypeNotPresentExceptionProxy(String, Throwable)
. TheThrowable
passed into that constructor is the underlying failure that the JVM swallows.