web.xml snippet
Code:
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderListener</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>controller</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
dataAccessContext.xml
Code:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="userDAO" class="com.thoughtequity.refinery.integration.dao.hibernate.UserDAOHibernate">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
applicationContext.xml
Code:
<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<!-- User Service Business Object as an inner bean wrapped by an outer
- transactional proxy.
-->
<bean id="userService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
parent="baseTransactionProxy">
<property name="target">
<bean id="userServiceTarget" class="com.thoughtequity.refinery.service.impl.UserServiceImpl">
<property name="userDAO"><ref local="userDAO"/></property>
</bean>
</property>
</bean>
controller-servlet.xml
Code:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
<property name="prefix"><value>/WEB-INF/jsp/spring/</value></property>
<property name="suffix"><value>.jsp</value></property>
</bean>
<bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<bean name="/signon.do" class="com.thoughtequity.refinery.web.spring.SignonController">
<property name="userService"><ref bean="userService"/></property>
</bean>
StackTrace (during Tomcat Startup)
Code:
08:25:07,145 ERROR DispatcherServlet:227 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/signon.do' defined in ServletContext resource /WEB-INF/controller-servlet.xml]: Can't resolve reference to bean 'userService' while setting property 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDe
finitionException: No bean named 'userService' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [viewResolver,defaultHandlerMapping,/signon.do,/signonForm.do]; root of BeanFactory hierarchy
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '
userService' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans viewResolver,defaultHandlerMapping,/signon.do,/signonForm.do]; root of BeanFactory hierarchy
I have the UserService defined in my applicationContext.xml file and the reference to that in the contorller-servlet.xml file. Same error happens at a lower lever when the UserService Bean tries to access the UserDAO when the UserDAO is defined in the dataAccessContext.xml file. I have all my files in the WEB-INF directory and can't seem to figure out what is going wrong. Everything works file if I stick everything in the controller-servlet.xml file