I could be wrong in my assumption, but I became suspicious when the action class wasn't in the stacktrace...
On Tue, 2008-05-06 at 20:48 -0400, Jim Kiley wrote: > It's weird and confusing that inherited methods don't make it into the proxy > class. Took me an age to figure it out, in no small part because I couldn't > find an easy way to inspect the proxy class's methods. My workaround was to > eliminate the @Transactional annotation entirely, and I'm hoping that > doesn't bite me later. > > jk > > On Tue, May 6, 2008 at 8:38 PM, Wes Wannemacher <[EMAIL PROTECTED]> wrote: > > > Sorry I didn't catch this earlier, but I had the exact same problem. It > > would seem that when you use Spring's @Transactional annnotation, the > > class gets proxied... Which I would think is okay, except for the fact > > that inherited methods (such as ActionSupport.input()) do not make it > > into the proxied class. :( > > > > For me, I simply re-factored the @Transactional method out into a > > service class that I have injected into my Action class. IMO, it's ugly, > > but it works. > > > > -Wes > > > > On Tue, 2008-05-06 at 17:36 -0400, Jim Kiley wrote: > > > I solved this problem and I figure that nabble might want to record the > > end > > > reason for the bug. > > > > > > Another method entirely, elsewhere on ProductDetailAction, had a > > > @Transactional annotation. It didn't need one -- I was using injected > > > transaction management and the OpenEntityManagerInViewFilter. Why the > > error > > > message below was generated, instead of "hey dummy, don't use > > @Transactional > > > in this context," is beyond me, but at least it's fixed. > > > > > > jk > > > > > > On Wed, Apr 30, 2008 at 3:47 PM, Jim Kiley <[EMAIL PROTECTED]> > > wrote: > > > > > > > Hi folks, > > > > > > > > I've run into a problem with Struts 2 validation annotations. > > > > > > > > In short -- I have a VisitorFieldValidator on an action POJO named > > > > ProductDetailAction. I have RequiredFieldValidator and > > > > RequiredStringValidator on one field within the "visited" object. > > > > > > > > Now -- ProductDetailAction did not (originally) inherit from > > > > ActionSupport. I could see validation errors cropping up in my log, > > but my > > > > save() method was still executing, because , as I understand it, > > without > > > > ActionSupport (or ValidationAware) there was no way for Struts to > > redirect > > > > my action back to my input() method when it found a validation error. > > > > > > > > If I change the hierarchy so that ProductDetailAction DOES inherit, > > > > indirectly, from ActionSupport, I can't even get to my input() method > > -- my > > > > productDetail JSP doesn't render. Instead I get the following > > exception: > > > > > > > > java.lang.IllegalArgumentException: The input() is not defined in > > action > > > > class $Proxy99 > > > > at > > > > > > com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:412) > > > > at > > > > > > com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) > > > > at > > > > > > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) > > > > at > > > > > > com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88) > > > > (...) > > > > > > > > I get the same exception if I simply implement ValidationAware in the > > same > > > > way that ActionSupport does. > > > > > > > > I'm including relevant snippets of ProductDetailAction, Product, and > > > > struts.xml below. Does anyone have any insight as to why this might > > be > > > > happening? I'm stumped, and so are my coworkers. Thanks. > > > > > > > > Jim > > > > > > > > ----- > > > > ProductDetailAction.java > > > > ----- > > > > @Validation > > > > public class ProductDetailAction extends FormularyDetailAction { // > > note: > > > > FormularyDetailAction extends ActionSupport > > > > // snippery > > > > > > > > @Override > > > > @SkipValidation > > > > public String input() throws Exception { > > > > if(id==null || id < 1) { > > > > this.product = new Product(); > > > > } else { > > > > this.product = formularyBso.fetchProduct(this.id); > > > > } > > > > return Action.INPUT; > > > > } > > > > > > > > @VisitorFieldValidator(message="") > > > > public Product getProduct() { > > > > return product; > > > > } > > > > // snippery > > > > } > > > > ----- > > > > Product.java > > > > ----- > > > > @Entity > > > > @Table(name="myrespironics.p_product_versions") > > > > @Validation > > > > public class Product extends FormularyProduct { > > > > //snip > > > > @RequiredFieldValidator(message="Please enter a value.") > > > > @RequiredStringValidator(message="Please enter a value.") > > > > public String getName() { > > > > return name; > > > > } > > > > //snip > > > > } > > > > ----- > > > > struts.xml > > > > ----- > > > > <struts> > > > > <package name="user" extends="struts-default"> > > > > <interceptors> > > > > <interceptor-stack name="myInterceptors"> > > > > <interceptor-ref name="exception"/> > > > > <interceptor-ref name="alias"/> > > > > <interceptor-ref name="params"/> > > > > <interceptor-ref name="servletConfig"/> > > > > <interceptor-ref name="prepare" /> > > > > <interceptor-ref name="i18n"/> > > > > <interceptor-ref name="chain"/> > > > > <interceptor-ref name="modelDriven"/> > > > > <interceptor-ref name="fileUpload"/> > > > > <interceptor-ref name="checkbox"/> > > > > <interceptor-ref name="staticParams"/> > > > > <interceptor-ref name="params"/> > > > > <interceptor-ref name="conversionError"/> > > > > <interceptor-ref name="validation"> > > > > <param > > name="excludeMethods">input,back,cancel</param> > > > > </interceptor-ref> > > > > <interceptor-ref name="workflow"> > > > > <param > > name="excludeMethods">input,back,cancel</param> > > > > </interceptor-ref> > > > > </interceptor-stack> > > > > </interceptors> > > > > > > > > <default-interceptor-ref name="myInterceptors"/> > > > > <global-results> > > > > <result name="error">/error.jsp</result> > > > > </global-results> > > > > > > > > <action name="productDetail" class="productDetailAction" > > > > method="input"> > > > > <result name="success" > > > > type="redirect-action">productList</result> > > > > <result > > > > name="input">/WEB-INF/secure/formulary/productDetail.jsp</result> > > > > <result name="success-subcategory" type="redirect-action"> > > > > <param name="actionName">subcategoryDetail</param> > > > > <param name="parse">true</param> > > > > <param name="id">${subcategoryId}</param> > > > > </result> > > > > </action> > > > > > > > > </package> > > > > </struts> > > > > -- > > > > Jim Kiley > > > > Technical Consultant | Summa > > > > [p] 412.258.3346 [m] 412.445.1729 > > > > http://www.summa-tech.com > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]