My guess is that you have entered the correct setter method in the
UserAction.java but at runtime the original org.appfuse....UserAction code
is being run.  This has has to do with how you have your project setup.

How are you getting UserAction.java into your projects source code?  mvn
appfuse:full-source?  Copy and paste>?

It can be tricky to get used to working with the appfuse code being
separated if you are coming from the 1.x appfuse world.  At least it was for
me!  ;-)

-D




Robyn Sambo wrote:
> 
> 
> 
> 
> 
> 
> Hello - 
> 
> I'm working with Appfuse 2.0( Struts 2 Basic) and trying to add an
> instance of a custom manager class (clientManager) to
> org.appfuse.webapp.action.UserAction. 
> 
>     public void setClientManager(GenericManager<Client,
> Long>
> clientManager) { 
>         this.clientManager =
> clientManager; 
>     } 
> 
> 
> clientManager is using the GenericManagerImpl and is defined as so
> in applicationContext.xml 
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <beans xmlns= "http://www.springframework.org/schema/beans"; 
> xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"; 
>        xsi:schemaLocation=
> "http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"; 
>        default-lazy-init="true"> 
> 
>     <bean id="clientManager"
> class="org.appfuse.service.impl.GenericManagerImpl">    
>  
>        
> <constructor-arg>         
>             <bean
> class="org.appfuse.dao.hibernate.GenericDaoHibernate"
> autowire="byType">            
>  
>    
>            
> <constructor-arg
> value="org.gd.model.Client"/>        
>  
>            
> </bean>     
>         </constructor-arg> 
>     </bean> 
>     
> </beans> 
> 
> 
> 
> In applicationContext-struts.xml I have altered the bean definition
> for userAction by adding a property for clientManager: 
> 
> 
>     <bean id="userAction"
> class="org.appfuse.webapp.action.UserAction" scope="prototype"> 
>         <property name="userManager"
> ref="userManager"/> 
>         <property name="roleManager"
> ref="roleManager"/> 
>         <property name="mailEngine"
> ref="mailEngine"/> 
>         <property name="mailMessage"
> ref="mailMessage"/> 
>         <property
> name="templateName" value="accountCreated.vm"/> 
>         <property name="clientManager"
> ref="clientManager"/> 
>     </bean> 
> 
> 
> With this setup, my application runs in jetty, however when I click
> to edit users, i receive the following errors. 
> 
> If I remove the clientManager property reference from the userAction
> bean definition in applicationContext-struts.xml then clientManager
> ends up being null in userAction. 
> 
> javax.servlet.ServletException: Unable to instantiate Action, userAction, 
> defined for 'users' in namespace '/admin'Error creating bean with name
> 'userAction' defined in ServletContext resource
> [/WEB-INF/applicationContext-struts.xml]: Error setting property values;
> nested exception is
> org.springframework.beans.NotWritablePropertyException: Invalid property
> 'clientManager' of bean class [org.appfuse.webapp.action.UserAction]: Bean
> property 'clientManager' is not writable or has an invalid setter method.
> Does the parameter type of the setter match the return type of the getter?
> - action -
> file:/C:/opt/source/livinghomes_cp/target/classes/struts.xml:147:63 
>       at
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515) 
>       at
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
>  
>       at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>  
>       at
> org.appfuse.webapp.filter.StaticFilter.doFilterInternal(StaticFilter.java:106)
>  
>       at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
>  
>       at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>  
>       at
> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
>  
>       at
> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
>  
>       at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>  
>       at
> org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
>  
>       at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>  
>       at org.tuckey.web.filters.urlrewrite.RuleChain.hand 
> 
> Any pointers would be greatly appreciated.  
> 
> I have been using the old appfuse for quite a while and am only
> recently migrating to appfuse2.0 and Struts2. 
> 
> Best, 
> Robyn 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/adding-manager-class-to-UserAction.java-tp16342065s2369p16398228.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to