开发者

Spring xml problem part 2

I just asked a question: Spring xml problem I solved the problem, but now i got another one:

Configuration problem: Unable to locate Spring Namesp开发者_开发技巧aceHandler for XML schema namespace [http://www.springframework.org/schema/aop]

My XML:

<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

<bean id="audience" class="springaop.Audience">
</bean>

<bean id="sam" class="springaop.Singer">
    <property name="id" value="1"></property>
</bean>

<aop:config>
    <aop:aspect ref="audience">

        <aop:before pointcut="* springaop.Singer.perform(..)" 
        method="takeSeats"></aop:before>

    </aop:aspect>
</aop:config>

</beans>

I use Spring 3.1.0.M2


You'd get that error if you don't have the spring-aop artifact on your classpath. You'd also get it if you somehow included the spring-aop classes without having available the META-INF/spring.handlers entry from that jar. That file is how Spring finds its "namespace handlers". The on in the spring-aop jar is what tells spring how to handle the "http://www.springframework.org/schema/aop" namespace. One way you can get this problem is by trying to create a fat jar including several spring jars. You'll end up overwriting all the spring.handlers files with one of the others and losing a lot of essential entries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜