Exception details
Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name xxxxx
Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [classA] from ClassLoader [sun.misc.Launcher$AppClassLoader@14dad5dc]
the reason
The reason for this exception is that a class that is not imported by the project is used in classA, which causes the class to fail to load. Generally speaking, if you use a class that has no dependencies, you should report a ClassNotFindException error, but if you only import but not use it, you may report this error.
Usually this error is related to the case where the scope of the third-party class configured using the maven framework is provided. The author caused this error when using spring boot and maven.
Solution
Check the non-dependent classes or packages that may exist in the classA class, import them (or add maven dependencies, or adjust the scope of dependencies in the dependent packages), in short, make the class loader can find this class in the current classPath.
Similar Posts:
- [How to Solve] java.lang.IncompatibleClassChangeError
- [Solved] Cannot resolve symbol ‘SpringJUnit4ClassRunner’
- SpringMVC Error: Cannot resolve org.springframework:spring-webmvc:5.2.9.RELEASE
- It is indirectly referenced from required .class files
- Spring cloud multi module packaging errors [How to Solve]
- HTTP Status 500 – Unable to compile class for JSP settlement program
- Thread.currentThread().getContextClassLoader()Class.getClassLoader()
- Tomcat10 Error: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
- How to Solve Cannot determine embedded database driver class for database type NONE
- The problem of JUnit test report class not found in maven