I get this error when I run a certain Spring Web 3 project in NetBeans:
org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 30; The prefix \"
This is an IDE Error, Which can be resolved by adding the following to your Spring Dispatcher Servlet
xmlns:mvc="http://www.springframework.org/schema/mvc"
And also add the following snippet if it is not included in your xml file
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
You are probably missing some significant portion of the namespace declaration, as discussed here: http://forum.springsource.org/showthread.php?100397-The-prefix-mvc-for-element-mvc-annotation-driven-is-notbound
It does not effect runtime, but the development environment will suffer with similar problems as you describe.
I guess it should go this way: http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
Add: xmlns:p="http://www.springframework.org/schema/p"
Otherwise xml will not understand the p annotation.
Changing below code worked for me
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
to below code (imp : check xmlns:context and xmlns:xsi position)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
This is an IDE Error, Which can be resolved by following to
xmlns:mvc="http://www.springframework.org/schema/mvc"
try this it worked for me:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="com.mkyong.common.controller" />
<mvc:annotation-driven />