2 Replies Latest reply on Nov 23, 2006 6:08 PM by Paul Harrington

    Validation problems in SEAM

    Paul Harrington Newbie

      I have been having problems applying validation to a field in an entity bean defined using annotations. We initially generated a project using seam-gen.

      @Column(name = "name", length = 20, nullable=false)
      @Length(min=1)
      public String getName()
      {
      return _name;
      }

      If I enter a zero length field, the generated seam application should apply the validation and then redisplay the form with the appropriate message saying the validation failed because the string entered was less than the minimum length. However, a validation exception is thrown (stacktrace shown below), but is not caught and dealt with.

      I am using SEAM 1.1.0 CR1 and version 4.0.5 of the Jboss app. server.

      Any help would be much appreciated, thanks

      Paul



      Exception during INVOKE_APPLICATION(5): validation failed for: com.santex.blankApp.core.model.Area

      org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:104)
      org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:127)
      org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:139)
      org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:44)
      org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
      org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
      org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
      org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
      org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
      org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)
      org.jboss.seam.framework.EntityHome.persist(EntityHome.java:44)
      org.jboss.seam.framework.EntityHome$$FastClassByCGLIB$$2a61cc01.invoke()
      net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
      org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:51)
      sun.reflect.GeneratedMethodAccessor1004.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:79)
      sun.reflect.GeneratedMethodAccessor1040.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
      sun.reflect.GeneratedMethodAccessor1007.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:33)
      sun.reflect.GeneratedMethodAccessor1006.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:55)
      sun.reflect.GeneratedMethodAccessor1003.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:25)
      org.jboss.seam.util.Work.workInTransaction(Work.java:31)
      org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:19)
      sun.reflect.GeneratedMethodAccessor1002.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:28)
      sun.reflect.GeneratedMethodAccessor1001.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
      org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
      org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
      org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:128)
      org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:69)
      com.santex.blankApp.web.home.AreaHome$$EnhancerByCGLIB$$ca753cad.persist()
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      com.sun.el.parser.AstValue.invoke(AstValue.java:151)
      com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
      com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
      org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      javax.faces.component.UICommand.broadcast(UICommand.java:106)
      javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
      javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
      org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
      org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      java.lang.Thread.run(Thread.java:595)