Results 1 to 3 of 3

Thread: Getting Spring and XWork to work together (w/advised actions

  1. #1
    Join Date
    Aug 2004
    Posts
    8

    Default Getting Spring and XWork to work together (w/advised actions

    Below is the email from the opensymphony mailing list.

    I am trying to wrap/advise XWork actions and declare transaction handling around them. Transaction handling works fine.....for a little while at least. After a while the classes seem to be mutating.


    Is this a cglib problem? Why would class instances start mutating?


    --------------------------------------------------------------------------------
    From: Jason Carreira [mailto:jason.carreira@notiva.com]
    Sent: Wednesday, August 25, 2004 1:07 PM
    To: dev@webwork.dev.java.net
    Subject: RE: [OS-webwork] XWork/Spring work yet?


    Hmm... The problem is that it caches the Method object to execute against subsequent instances of the Action class... It appears that the Class of these instances is changing at some point.. I guess we'll need to implement the change suggested to check the Class to see if it has changed and dump the cached Method object... This is a bug with Spring, so if you can get them to fix this, that would be even better.

    Jason
    -----Original Message-----
    From: Matthew Payne [mailto:matthew.payne@ins.com]
    Sent: Wednesday, August 25, 2004 12:31 PM
    To: dev@webwork.dev.java.net
    Subject: [OS-webwork] XWork/Spring work yet?


    What the status of getting these two to behave well together?

    Specifically, the ability to "autoproxy" (or any proxy with cglib) an action.

    It works for a little while(transaction code works too), but after 10 minutes or so it breaks when the invocation of the action look throws a class cast exception.

    Note Spring 1.1 did not fix the problem(prehaps it now takes longer for the problem to occur).

    Is this a Spring issue or an Xwork issue? Is XWork caching the classes rather than retrieving them fresh from spring everytine?

    -Matt

    -->
    java.lang.IllegalArgumentException: java.lang.ClassCastException@4815e
    sun.reflect.GeneratedMethodAccessor181.invoke(Unkn own Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.opensymphony.xwork.DefaultActionInvocation.inv okeAction(DefaultActionInvocation.java:302)
    com.opensymphony.xwork.DefaultActionInvocation.inv oke(DefaultActionInvocation.java:170)
    com.opensymphony.xwork.interceptor.AroundIntercept or.intercept(AroundInterceptor.java:35)
    com.opensymphony.xwork.DefaultActionInvocation.inv oke(DefaultActionInvocation.java:165)
    com.opensymphony.xwork.interceptor.AroundIntercept or.intercept(AroundInterceptor.java:35)
    com.opensymphony.xwork.DefaultActionInvocation.inv oke(DefaultActionInvocation.java:165)
    com.opensymphony.xwork.interceptor.AroundIntercept or.intercept(AroundInterceptor.java:35)
    com.opensymphony.xwork.DefaultActionInvocation.inv oke(DefaultActionInvocation.java:165)
    com.opensymphony.xwork.interceptor.AroundIntercept or.intercept(AroundInterceptor.java:35)
    com.opensymphony.xwork.DefaultActionInvocation.inv oke(DefaultActionInvocation.java:165)
    com.opensymphony.xwork.DefaultActionProxy.execute( DefaultActionProxy.java:115)
    com.opensymphony.webwork.dispatcher.ServletDispatc her.serviceAction(ServletDispatcher.java:278)
    com.opensymphony.webwork.dispatcher.ServletDispatc her.service(ServletDispatcher.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    com.opensymphony.webwork.lifecycle.RequestLifecycl eFilter.doFilter(RequestLifecycleFilter.java:69)
    com.opensymphony.module.sitemesh.filter.PageFilter .parsePage(PageFilter.java:142)
    com.opensymphony.module.sitemesh.filter.PageFilter .doFilter(PageFilter.java:58)
    org.springframework.orm.hibernate.support.OpenSess ionInViewFilter.doFilterInternal(OpenSessionInView Filter.java:161)
    org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:73)

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    I'm not 100% clear on the exact sequenc of events here, but I can say that the Spring generated proxy is not magically mutating somehow.

    Is the class being wrapped a prototype or singleton, first of all?
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Posts
    8

    Default more details

    The class is being wrapped as a "prototype".




    There are more details on the issue here --->

    http://jira.opensymphony.com/browse/XW-174

    example of one of the actions
    Code:
    ...
    	<bean id="dnsServerOptions" class="com.diamondip.ipcontrol.actions.DnsServerOptions" singleton="false" autowire="byType"/>
    ...
    	<bean id="actionAutoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    		<property name="interceptorNames">
    			<list>
    				<value>myTxInterceptor</value>
    			</list>
    		</property>
    		<property name="proxyTargetClass">
    			       <value>true</value>
    		</property>
    		<property name="beanNames"><value>dnsViewAction,dnsServerAction,dnsZoneAction</value></property>
       </bean>
    ....

Similar Threads

  1. Comparison of XWork and Spring Webflow
    By dan.hatfield in forum Web Flow
    Replies: 1
    Last Post: Sep 8th, 2005, 01:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •