很早的时候就想尝试使用XPlanner,但是一直都没有成功,感觉很简单
但是运行时总是报spring的一个配置文件出错
今天终于在网上找到解决方案了
原来是因为XPlanner部署在JDK1.6上的问题
http://jira.codehaus.org/browse/XPR-391
错误如下:
ERROR - alina].[localhost].[/xplanner] - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘metaRepository’ defined in class path resource [spring-beans.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’]
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’
at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:839)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:584)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:469)
原来是spring-beans.xml文件中的问题
就是这个部分
<bean id=”metaRepository” class=”com.technoetic.xplanner.domain.repository.MetaRepositoryImpl”>
<property name=”repositories”>
<map>
com.technoetic.xplanner.domain.repository.MetaRepositoryImpl的repositories需要一个map,
spring中使用使用的实现是org.apache.commons.collections.map.LinkedMap
但是org.apache.commons.collections.map.LinkedMap实现了java.util.Map接口啊!
理论上应该的可以的啊!但是却出现了转化错误,没有找到原因,但是找到了解决方案啊!
把<property name=”repositories”><map>……</map></property>
修改为
<property name=”repositories”>
<bean class=”java.util.HashMap”>
<constructor-arg>
<map>…..</map>
</constructor-arg>
</bean>
</property>
就可以了啊!
但是运行时总是报spring的一个配置文件出错
今天终于在网上找到解决方案了
原来是因为XPlanner部署在JDK1.6上的问题
http://jira.codehaus.org/browse/XPR-391
错误如下:
ERROR - alina].[localhost].[/xplanner] - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘metaRepository’ defined in class path resource [spring-beans.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’]
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property ‘repositories’
at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:839)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:584)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:469)
原来是spring-beans.xml文件中的问题
就是这个部分
<bean id=”metaRepository” class=”com.technoetic.xplanner.domain.repository.MetaRepositoryImpl”>
<property name=”repositories”>
<map>
com.technoetic.xplanner.domain.repository.MetaRepositoryImpl的repositories需要一个map,
spring中使用使用的实现是org.apache.commons.collections.map.LinkedMap
但是org.apache.commons.collections.map.LinkedMap实现了java.util.Map接口啊!
理论上应该的可以的啊!但是却出现了转化错误,没有找到原因,但是找到了解决方案啊!
把<property name=”repositories”><map>……</map></property>
修改为
<property name=”repositories”>
<bean class=”java.util.HashMap”>
<constructor-arg>
<map>…..</map>
</constructor-arg>
</bean>
</property>
就可以了啊!