Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace http//www.springframework.org/schema/security
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
This error usually means Spring found the XML namespace declaration but could not find the Java code that knows how to parse the security tags. In practice, that almost always points to a missing spring-security-config JAR, a version mismatch between Spring modules, or an XML file that declares the namespace incorrectly.
What the NamespaceHandler Error Really Means
When Spring parses XML configuration, each custom namespace is backed by a NamespaceHandler. For Spring Security XML, that handler is packaged in the Spring Security configuration module, not in Spring Core itself.
So this message is not about the XSD being unreachable on the internet. It is usually about the classpath. Spring loads handlers from metadata inside the JARs, especially META-INF/spring.handlers and related parser registrations.
If the right security configuration JAR is absent, Spring can resolve the XML namespace string but still fail when it tries to instantiate the handler.
The First Thing to Check: Dependencies
For XML-based Spring Security configuration, the critical artifact is typically spring-security-config, along with the rest of the matching Spring Security modules.
A Maven example:
The important part is version alignment. Mixing one Spring Security release with unrelated Spring framework versions is a reliable way to produce namespace or parser failures.
Verify the XML Namespace Declaration
The next check is the XML itself. A typical Spring Security configuration file needs the security namespace and schema location to be declared correctly.
Small typos in the namespace URI or in the schema location are enough to trigger confusing parser errors.
Check for Classpath Collisions
Older Spring applications often carry libraries manually in WEB-INF/lib, through IDE containers, or via partial Maven migration. That makes duplicate or conflicting JARs common.
If you use Maven, inspect the dependency tree:
If you do not use Maven, inspect the deployed WAR contents directly. One stray older Spring Security JAR can override the one you thought you were using.
A Useful Diagnostic Shortcut
If you suspect the correct module is missing, open the spring-security-config JAR and look for Spring namespace metadata. The exact file names matter more than guessing.
If that metadata is absent or the JAR is not on the runtime classpath, Spring has no handler to load.
Common Pitfalls
The most common mistake is adding spring-security-core and assuming that is enough for XML namespace support. It is not. The XML parser support lives in spring-security-config.
Another issue is mixing Spring and Spring Security versions loosely. Namespace parsing is sensitive to classpath compatibility.
A third problem is assuming the error means the XSD URL must be reachable over the network. Spring typically resolves this through packaged metadata, so classpath issues are the real target.
Summary
- This error usually points to a classpath problem, not an internet problem.
- Make sure
spring-security-configis present for XML-based security configuration. - Keep Spring Framework and Spring Security versions aligned.
- Verify the namespace URI and
xsi:schemaLocationvalues carefully. - Inspect the runtime classpath or dependency tree if the XML still looks correct.

