I'm using Spring 1.2.7 under AppFuse 1.9.1
I think I'm using a regular spring context.. how do I check for sure? Here is the Spring context config in web.xml:
<!-- Context Configuration locations for Spring XML files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml</param-value>
</context-param>
I tried to resolve it from a jsp page and it worked okay.
I am using Tomcat 5.5.17
And yes, I'm getting a NPE when I try to use the object that is supposed to be set using the managed-property. Here is the relevant part of the backing bean:
private SearchManager searchManager;
public void setSearchManager(SearchManager searchManager) {
log.info("*************** setSearchManager has been called ***************");
this.searchManager = searchManager;
}
public SearchManager getSearchManager() {
return searchManager;
}
I never see the "*** setSearchManager has been called ***" message..
What version of spring is this?
Can you resolve spring beans from anywhere else? Say from a JSP page if you use the same EL _expression_? If you cant then you know it's a problem with appfuse and how it's set up.
Also are you using a spring webapp context or a regular spring context (example ClassPathXmlApplicationContext)?
I know that some Servlet 2.3's (tomcat 4? 5.0?) and below have an issue with the <listener> tags not being loaded before <load-on-startup> servlets which will result in incorrect wiring to the JSF container (that is if Appfuse uses a WebApplicationContext for spring).
When you say the property is "NEVER set" can you elaborate? Is it a NPE you're getting—can you maybe post the backing bean (relevant portions thereof)?
From: Robert Campbell [mailto:[EMAIL PROTECTED]]
Sent: Friday, 14 July 2006 12:52 AM
To: [email protected]
Subject: JSF/Spring integration - managed-property problem
I have what seems to be a simple problem. I have a JSF managed-bean:
<managed-bean>
<managed-bean-name>searchForm</managed-bean-name>
<managed-bean-class>com.mycompany.SearchForm </managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>searchManager</property-name>
<value>#{searchManager}</value>
</managed-property>
</managed-bean>
And a Spring bean:
<bean id="searchManager" parent="txProxyTemplate">
<property name="target">
<bean class="com.mycompany.SearchManagerImpl">
<property name="awardDao" ref="awardDao"/>
<property name="sponsorDao" ref="awardSponsorDao"/>
</bean>
</property>
</bean>
I'm using AppFuse, which comes with JSF and Spring pre-wired together (ie. <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver </variable-resolver> is already there and working, etc).
Now AppFuse has lots of JSF managed beans that take Spring bean references as a managed-property. The whole application works fine, and all these other JSF managed beans get their Spring bean references fine and everything is dandy. Sadly, this doesn't work for me. The searchForm JSF bean is instantiated correctly (I use logging) but the managed-property is NEVER set. The setSearchManager function is never called ( log.info as the first line of the setter).
I also know that the Spring searchManager bean is created fine (again, using logging), and I have other Spring beans which make use of it perfectly.
So my question is: how do I troubleshoot this?
Thank you!
This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the individual sender except where the sender expressly,
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.

