Open source software supply chain lighting plan, waiting for you>>>
After upgrading a project from spring boot1 to spring boot2, the following error was reported. Many different solutions were found but they were not solved:
An exception was encountered when the spring boot2 project started:
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_65]
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_65]
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_65]
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_65]
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_65]
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_65]
at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_65]
at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]
at java.lang.Class.createAnnotationData(Class.java:3526) ~[na:1.8.0_65]
at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]
at java.lang.Class.getAnnotation(Class.java:3415) ~[na:1.8.0_65]
at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258) ~[na:1.8.0_65]
at java.lang.Class.isAnnotationPresent(Class.java:3425) ~[na:1.8.0_65]
at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:570) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:218) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:189) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:136) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
... 16 common frames omitted
After simple troubleshooting, it is suspected that the exception is caused by jar version conflict. Use exception breakpoint:
And then in the
It should be an error from class org.activiti.spring.boot.securityautoconfiguration, and then an error java.lang.arraystoreexception: sun.reflect.annotation.typenotpresentexceptionproxy
Attempt to reproduce exception:
SecurityAutoConfiguration securityAutoConfiguration=new SecurityAutoConfiguration();
Normal
SecurityAutoConfiguration.class.getDeclaredAnnotation(Aspect.class);
Abnormal recurrence
Then find the typenotpresentexceptionproxy class and use Ctrl + n/Ctrl + N + n
Then we break the points in the construction method
It was found that cause: defaultauthenticationeventpublisher could not find the error
The actual error is classnotfound
If you look at the code carefully, you can see that annotationparser. Parseclassvalue
wraps the exception as object
private static Object parseClassValue(ByteBuffer buf,
ConstantPool constPool,
Class<?> container) {
int classIndex = buf.getShort() & 0xFFFF;
try {
try {
String sig = constPool.getUTF8At(classIndex);
return parseSig(sig, container);
} catch (IllegalArgumentException ex) {
// support obsolete early jsr175 format class files
return constPool.getClassAt(classIndex);
}
} catch (NoClassDefFoundError e) {
return new TypeNotPresentExceptionProxy("[unknown]", e);
}
catch (TypeNotPresentException e) {
return new TypeNotPresentExceptionProxy(e.typeName(), e.getCause());
}
}
Then in sun. Reflection. Annotation. Annotation parser. Parseclassarray (int, ByteBuffer, constantpool, class & lt>)
and try to set it directly to the array
Here, the array is out of bounds, arraystoreexception
only the type information of the out of bounds object
, that is, the above
Solution:
1: Downgrade springboot 2.0 to the original 1. X version
2: Add the
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
3: Modify the source code integration problem, recompile
Conclusion:
Specific problems need to be analyzed in detail, and different codes have different causes
My question is:
Springboot2.0 can't be directly integrated with activiti6.0.0, because activiti6.0.0 didn't come out when it came out. Activiti6.0.0 supports versions above 2.2.6 and below 2.0.0
The actual error reported here is classnotfound
Similar Posts:
- Error: there is already ‘RtController’ bean method [How to Solve]
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field
- [Solved] java.lang.IllegalStateException: Failed to introspect Class xxxx
- Error reported by feign component of springcloud microservice
- [Solved] Dependency injection exception: org.springframework.beans.factory.UnsatisfiedDependencyException
- Request processing failed; nested exception is java.lang.NullPointerException
- FAQ 66: java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
- ContextPath must start with ‘/’ and not end with ‘/’ [How to Solve]
- [Solved] Project Start Error: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
- [Solved] java.lang.ClassNotFoundException: org.apache.log4j.Logger