Recently, I encountered various strange exceptions when I used idea to build an aggregation project. Here is an exception reported by the operation of its sub module:
The prompt of exception information is:
Error creating bean with name ‘mvcContentNegotiationManager’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean] from ClassLoader [sun.misc.Launcher$ [email protected] ]
Check whether the POM file of the sub module depends on the parent class. Of course, many people will find that when wearing the submodule, the POM file of the sub module will automatically depend on the parent class (as shown in the figure below)
If the dependency in the above figure is not automatically generated after inspection, and you have the same exception as me, then the parent project dependency is added to solve the exception with a high probability
After consulting relevant posts on the Internet and repeated experiments for many times, I found that:
This bug is because we created a module with the same name before, and then we removed it. Then we automatically generate webapp module through the skeleton, so that the module generated by the skeleton will completely overwrite your original POM file!!!
Unfortunately, you need the parent project dependency to start the project, then you will have this bug!
The safest and most reliable solution to avoid problem reproduction: check the dependency of POM file every time you create a sub module. If not, solve it manually
Of course, there are various online solutions, but I have tried and found that it can temporarily solve the problem, but it will still be overwritten the next time I use the skeleton to generate a module with the same name
Solution 2 (slightly reliable):
Setting — build — Maven — ignored files, cancel the ignored POM file, and the parent project dependency will be automatically added!
The root cause is that we have created modules with the same name before, but they are not really removed There is still a lot of information about deleting modules in the idea, so when creating a new module, the idea will automatically ignore the new module with the same name we wrote
Of course, a large part of the impact is because we use automatic skeleton generation!
- [Fixed] Disgusting bug Error:Failed to Load project configuration: cannot parse filemessage: content is not allowed in the preface.
- [Solved] BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘
- [Solved] Mybatis add dependencies Error: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
- Eclipse Error: There are no resources that can be added or removed from the server.
- Spring Project Error: Error creating bean with name [How to Solve]
- Error:Cannot build artifact xxx:war exploded’ because it is included into a circular dependency
- [Solved] Java: compilation failed: internal java compiler error
- IDEA was Filed to Start: error launching idea (Failed to create JVM )
- BeanDefinitionStoreException: Failed to read candidate component class probably due to a new Java
- Caused by: java.lang.IllegalStateException (How to Fix)
- Notes for migrating Oracle jdk8 to openjdk11
- How to Solve idea com.baomidou Error
- Maven project running servlet jump JSP error: HTTP status 500 – unable to compile class for JSP
- Project Startup Error: Error running ‘xxxApplication‘；Command line is too long, Shoerten command line for……..
- [Siolved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘webMvcObject
- Springboot Project Error: Failed to execute goal org.apache.maven.plugins
- Xdoc generates API documents based on Java annotations
- springboot Integrate mybatis Error: Error creating bean with name ‘deptController‘: Unsatisfied dependency expresse
- Eclipse relies on spring boot configuration processor, and there is no prompt for writing properties and YML