这个问题困扰我一整天了,在网上也没找到解决办法,哪位知道怎么解决,请帮帮我吧,多谢。
java.util.Hashtable在Eclipse下的beans.xml的配置文件和发布到tomcat7.0的web-inf/classes下的是一样的:
<?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:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<beans>
<bean id="testbean" class="com.mytest.Test">
<property name="usertable">
<util:map map-class="java.util.Hashtable">
<entry key="userid">
<ref bean="User" />
</entry>
</</property>
</bean>
</beans>
在Eclipse下测试没有任何问题,一旦部署到tomcat下就报
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util]
Offending resource : file [....beans.xml]
Bean Test
->Property 'usertable'
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
很明显就是使用util:map的问题,而且如果不加map-class="java.util.Hashtable"不报异常,但Tomcat会挂起。
只用到了spring.jar这个包,tomcat和Eclipse的配置文件和引的包都是一模一样的,是拷过去的。怎么一个很简单的工程在两个环境下是两种结果,难道还和环境依赖?
真是无语了,哪位大虾知道的请指教啊,很急。谢谢!
java.util.Hashtable在Eclipse下的beans.xml的配置文件和发布到tomcat7.0的web-inf/classes下的是一样的:
<?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:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<beans>
<bean id="testbean" class="com.mytest.Test">
<property name="usertable">
<util:map map-class="java.util.Hashtable">
<entry key="userid">
<ref bean="User" />
</entry>
</</property>
</bean>
</beans>
在Eclipse下测试没有任何问题,一旦部署到tomcat下就报
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util]
Offending resource : file [....beans.xml]
Bean Test
->Property 'usertable'
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
很明显就是使用util:map的问题,而且如果不加map-class="java.util.Hashtable"不报异常,但Tomcat会挂起。
只用到了spring.jar这个包,tomcat和Eclipse的配置文件和引的包都是一模一样的,是拷过去的。怎么一个很简单的工程在两个环境下是两种结果,难道还和环境依赖?
真是无语了,哪位大虾知道的请指教啊,很急。谢谢!
https://www-304.ibm.com/support/docview.wss?uid=swg21496946
http://wdqzxcww.blog.163.com/blog/static/175261162201011610223256/
希望能提供帮助.
<util:map map-class="java.util.Hashtable">
<entry key="userid">
<ref bean="User" />
</entry>
</</property>