I've recently started learning Spring. I've looked at the online MVC tutorial and have used "Spring, A Developer's Notebook". I keep running into the same problem. I define a bean in the *servlet.xml file that has a property with a value. After deploying the code to tomcat (6.0.16) and starting up, I keep getting initialization of bean failed. It seems to not be reading or interpreting the value. Here is part of my servlet.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="rentaBike" class="com.springbook.ArrayListRentABike">
<property name="storeName"><value>Bruce's Bikes</value></property>
</bean>
And here is the error I receive from tomcat:
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'rentaBike' defined in ServletContext resource [/WEB-INF/RentABikeApp-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.lang.String] for property 'storeName'; nested exception is java.lang.IllegalArgumentException: Original must not be null
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:470)
Any help would be appreciated.


Reply With Quote

