aspose file tools*
The moose likes Other Application Frameworks and the fly likes Splring: ContextLoaderListener not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Splring: ContextLoaderListener not working" Watch "Splring: ContextLoaderListener not working" New topic
Author

Splring: ContextLoaderListener not working

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
Hi guys,

I'm using the springframeWork to initialize my hiberate classes which are location in my /WEB-INF/applicationContext.xml. However, when I try to start up my server, my strut action classes configuration in ContextLoaderPlugIn cannot find the bean classes defined in the applicationContext.

The following is the error I'm getting:
[9/15/07 3:49:14:421 PDT] 00000018 WebExtensionP W Servlet action_tmp is currently unavailable: null
[9/15/07 3:49:16:187 PDT] 00000018 WebApp A SRVE0180I: [PBTest#PBWebApp.war] [/PBWebApp] [Servlet.LOG]: Initializing WebApplicationContext for Struts ActionServlet 'action', module ''
[9/15/07 3:49:16:281 PDT] 00000018 WebApp A SRVE0181I: [PBTest#PBWebApp.war] [/PBWebApp] [Servlet.LOG]: action: null: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/displayAddImages' defined in ServletContext resource [/WEB-INF/presentationContext.xml]: Cannot resolve reference to bean 'businessBS' while setting bean property 'businessBS'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'businessBS' is defined


Here's my code:
/////WEB.XML//////////////

<!-- =================== Define Spring Bean Definition Files to be loaded ================== -->

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>



<!-- =================== Spring Context Loader Servlet ================== -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


///APPLiCATION Context.xml /////

<bean id="businessBSTarget" class="com.PBCoreApp.business.impl.BusinessBSImpl">
<property name="businessDao"><ref local="businessDao" /></property>
</bean>
<bean id="businessBS" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>com.PBCoreApp.business.BusinessBS</value>
</property>
<property name="target">
<ref local="businessBSTarget" />
</property>
<property name="interceptorNames">
<list>
<value>hibernateInterceptor</value>
</list>
</property>
</bean>


/////STRUTS-CONFIG//////

<!-- ============================= Spring Plugin ================================== -->

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property
property="contextConfigLocation"
value="/WEB-INF/presentationContext.xml/>
</plug-in>


/////////Action bean context: presentationContext.xml ////////
<beans>

<bean name="/displayAddImages" class="com.poshWebApp.action.AddImageDisplayAction">
<property name="businessBS"><ref bean="businessBS" /></property>
<property name="paymentProcessBS"><ref bean="paymentProcessBS" /></property>
</bean>
</beans>


Pls...Help.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I wonder if it could be related with the following bug :
http://sourceforge.net/tracker/index.php?func=detail&aid=1088866&group_id=39190&atid=424562

Try using this instead:


[My Blog]
All roads lead to JavaRanch
 
 
subject: Splring: ContextLoaderListener not working