Configuration problems: Unable to locate Spring NamespaceHandler for XML schema namespace [http://java.sun.com/xml/ns/javaee]

末鹿安然 提交于 2019-12-01 21:21:57

问题


I'm trying to combine JUnit and Spring in a web project. Thanks to this question, I have succeeded in loading the spring config file into TestClass:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class TwitterServiceTest {
    @Resource
    IRepository repository;

But when the test runs, I got the following error:

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://java.sun.com/xml/ns/javaee]

I guess that the problem might be that the library files are not in classpath. Currently I use Sysdeo Eclipse Tomcat plugin DevLoader to do the loading job (load jar file from M2_REPO to the classpath).

This project depends on many libraries. Is there any idea about how to fix this error? Any help would be greatly appreciated.


回答1:


I made a stupid mistake, which is using "web.xml" as spring configuration context file. SpringJUnit4ClassRunner try to parse it as the spring context file so it failed.

After including the right context file, the application works now.



来源:https://stackoverflow.com/questions/8666720/configuration-problems-unable-to-locate-spring-namespacehandler-for-xml-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!