I attempted to run a Spring WebMVC application, and when starting up the application complained that it didn't know how to handle the MVC namespace in my XML configuration. The project runs JDK 7 and Spring 4.0.6 using Maven as the build system.
The following is my XML configuration file:
The following is my XML configuration file:
<?xml version="1.0" encoding="UTF-8"?>I have a few more beans than this, but their details aren't especially relevant to this treatment. The application startup failed with a message indicating that Spring does not know how to process the MVC namespace specified in the XML configuration file:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:annotation-driven/>
</beans>
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc]After a good bit of searching, I found the answer on StackOverflow. I am using Maven Shade plugin to make a bundled jar file, but the bundle omitted some files in META-INF necessary for Spring to resolve the MVC namespace. The solution was to add some additional transformations into the Shade configuration:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.handlers</resource></transformer><transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.schemas</resource></transformer>Here is the full discussion on StackOverflow. It was frustrating that it was so hard to find this solution online - so hopefully this post saves somebody else some effort.
Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
ReplyDeleteclick here to connect
click here to check the status of your arn
click here for citizen registration
click here to continue your registration
click here to confirm