[jboss-user] [JBoss Seam] - Custom hibernate validator causes InvalidStateException
Sefai
do-not-reply at jboss.com
Thu Nov 1 16:43:40 EDT 2007
Hi all,
I wrote an hibernate validator for date/time comparing...Here is the code for this case:
Annotation Interface
| @Documented
| @ValidatorClass(AfterTimeValidator.class)
| @Target(TYPE)
| @Retention(RUNTIME)
| public @interface AfterTime {
|
| String property();
|
| String after();
|
| String message();
| }
|
Implementation
| public class AfterTimeValidator implements Validator<AfterTime>, Serializable {
|
| /**
| *
| */
| private static final long serialVersionUID = -769074362761155421L;
|
| String property;
|
| String after;
|
| private Getter propertyGetter;
|
| private Getter afterGetter;
|
| public void initialize(AfterTime parameters) {
| property = parameters.property();
| after = parameters.after();
| }
|
| public boolean isValid(Object value) {
| initGetters(value.getClass());
| LocalTime propertyValue = (LocalTime) propertyGetter.get(value);
| LocalTime afterValue = (LocalTime) afterGetter.get(value);
| return propertyValue.isAfter(afterValue);
| }
|
| @SuppressWarnings("unchecked")
| private synchronized void initGetters(Class value) {
| propertyGetter = ReflectHelper.getGetter(value, property);
| afterGetter = ReflectHelper.getGetter(value, after);
| }
|
| }
|
Since it will perform validation between two properties of a class its TARGET is TYPE. And I use it in my domain object like this:
| @Entity
| @AfterTime(property = "endTime", after = "startTime", message = "...")
| public class TestObject implements Serializable {
|
| private static final long serialVersionUID = 1974810250948566860L;
|
| private Long id;
| private String description;
| private LocalTime startTime;
| private LocalTime endTime;
|
|
| @Id
| @GeneratedValue(strategy = GenerationType.SEQUENCE)
| @Column(name = "id")
| public Long getId() {
| return id;
| }
|
|
| @Type(type = "org.joda.time.contrib.hibernate.PersistentLocalTimeAsString")
| @Column(name = "starttime")
| public LocalTime getStartTime() {
| return startTime;
| }
|
| @Type(type = "org.joda.time.contrib.hibernate.PersistentLocalTimeAsString")
| @Column(name = "endtime")
| public LocalTime getEndTime() {
| return endTime;
| }
|
| @Column(name = "description", length = 100, nullable = false, unique = true)
| public String getDescription() {
| return description;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| public void setStartTime(LocalTime startTime) {
| this.startTime = startTime;
| }
|
| public void setEndTime(LocalTime endTime) {
| this.endTime = endTime;
| }
|
| public void setDescription(String description) {
| this.description = description;
| }
| }
Here is the page i edit this object:
| <a4j:region id="modalPanelFormRegion">
|
| <h:form id="modalPanelForm">
|
| <seam:div id="editPanel" rendered="#{actionBean.selectedTestObject!=null}">
|
| <span class="smallerrors">
| <seam:message showDetail="false" showSummary="true" />
| </span>
|
| <seam:validateAll>
|
| <f:facet name="afterInvalidField">
| <seam:span styleClass="smallerrors">*
| <seam:message showDetail="true" showSummary="false" />
| </seam:span>
| </f:facet>
|
| <seam:decorate template="/templates/display.xhtml">
| <ui:define name="label">#{messages['ui.message1']}</ui:define>
| <h:inputText value="#{actionBean.selectedTestObject.startTime}" required="true">
| <my:convertDateTime type="time" pattern="HH:mm" />
| </h:inputText>
| </seam:decorate>
|
| <seam:decorate template="/templates/display.xhtml">
| <ui:define name="label">#{messages['ui.message2']}</ui:define>
| <h:inputText value="#{actionBean.selectedTestObject.endTime}" required="true">
| <my:convertDateTime type="time" pattern="HH:mm" />
| </h:inputText>
| </seam:decorate>
|
| <seam:decorate template="/templates/display.xhtml">
| <ui:define name="label">#{messages['ui.message3']}</ui:define>
| <h:inputText value="#{actionBean.selectedTestObject.description}" required="true"/>
| </seam:decorate>
|
| </seam:validateAll>
|
| <rich:spacer height="15" />
|
| <h:panelGrid columns="3">
| <a4j:commandButton
| value="#{messages['ui.button.message2']}"
| reRender="editPanel,listDataTable"
| actionListener="#{actionBean.saveTestObject}"/>
| <a4j:status>
| <f:facet name="start">
| <h:graphicImage value="/img/ajax-loader.gif" />
| </f:facet>
| <f:facet name="stop">
| <rich:spacer />
| </f:facet>
| </a4j:status>
| <a4j:commandButton
| value="#{messages['ui.button.message3']}"
| onclick="Richfaces.hideModalPanel('editor')" ajaxSingle="true"/>
| </h:panelGrid>
|
| </seam:div>
|
| </h:form>
|
| </a4j:region>
|
Here is the actionBean
| @Name("actionBean")
| @Scope(ScopeType.CONVERSATION)
| public class ActionBean {
|
| @Logger
| private Log logger;
|
| @In
| private FacesMessages facesMessages;
|
| @In(create = true)
| private TestObjectService testObjectService;
|
| private TestObject selectedTestObject;
|
| /**
| * other properties and methods removed for clearity
| */
|
| /**
| * End edit and save changes
| */
| public void saveTestObject() {
| logger.info("#0 updating", this.selectedTestObject);
| testObjectService.saveTestObject(this.selectedTestObject);
| facesMessages.add("operationCompleted.");
| }
|
| }
|
|
When I try to save this object with an invalid startDate,endDate combination i get the following exception stack trace...
| 01.Kas.2007 15:45:32 com.sun.faces.lifecycle.InvokeApplicationPhase execute
| WARNING: /admin/testObjectPage.xhtml @70,64 actionListener="#{actionBean.saveTestObject}": org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| javax.faces.el.EvaluationException: /admin/testObjectPage.xhtml @70,64 actionListener="#{actionBean.saveTestObject}": org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
| at javax.faces.component.UICommand.broadcast(UICommand.java:387)
| at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
| at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
| at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
| at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
| at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
| at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
| at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:273)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
| at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
| at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
| at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
| at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
| at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
| at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
| at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
| at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
| at org.mortbay.jetty.Server.handle(Server.java:324)
| at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
| at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
| at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
| at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
| at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
| at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
| at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
| Caused by: org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
| at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:177)
| at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:217)
| at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:65)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
| at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.dao.impl.TestObjectDAOImpl.get(TestObjectDAOImpl.java:18)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.dao.impl.TestObjectDAOImpl_$$_javassist_15.get(TestObjectDAOImpl_$$_javassist_15.java)
| at org.service.impl.TestObjectServiceImpl.get(TestObjectServiceImpl.java:23)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.service.impl.TestObjectServiceImpl_$$_javassist_12.get(TestObjectServiceImpl_$$_javassist_12.java)
| at org.action.admin.TestObjectAction.saveTestObject(ActionBean.java:111)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.action.admin.ActionBean_$$_javassist_9.saveTestObject(ActionBean_$$_javassist_9.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
| at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:45)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
| ... 45 more
| 01.Kas.2007 15:45:32 com.sun.faces.lifecycle.Phase doPhase
| SEVERE: JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /admin/testObjectPage.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl at 697087]
| 15:45:32,415 ERROR ExceptionFilter:68 - handling uncaught exception javax.servlet.ServletException: /admin/testObjectPage.xhtml @70,64 actionListener="#{ActionBean.saveTestObject}": org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
| at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:273)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
| at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
| at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
| at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
| at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
| at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
| at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
| at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
| at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
| at org.mortbay.jetty.Server.handle(Server.java:324)
| at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
| at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
| at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
| at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
| at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
| at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
| at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
| Caused by: javax.faces.el.EvaluationException: /admin/testObjectPage.xhtml @70,64 actionListener="#{ActionBean.saveTestObject}": org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
| at javax.faces.component.UICommand.broadcast(UICommand.java:387)
| at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
| at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
| at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
| at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
| at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
| at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
| ... 35 more
| Caused by: org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
| at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:177)
| at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:217)
| at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:65)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
| at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.dao.impl.TestObjectDAOImpl.get(TestObjectDAOImpl.java:18)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.dao.impl.TestObjectDAOImpl_$$_javassist_15.get(TestObjectDAOImpl_$$_javassist_15.java)
| at org.service.impl.TestObjectServiceImpl.get(TestObjectServiceImpl.java:23)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.service.impl.TestObjectServiceImpl_$$_javassist_12.get(TestObjectServiceImpl_$$_javassist_12.java)
| at org.action.admin.ActionBean.saveTestObject(ActionBean.java:111)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.admin.ActionBean_$$_javassist_9.saveTestObject(ActionBean_$$_javassist_9.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
| at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:45)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
| ... 45 more
| 15:45:32,415 ERROR ExceptionFilter:69 - exception root cause
| javax.faces.el.EvaluationException: /admin/testObjectPage.xhtml @70,64 actionListener="#{ActionBean.saveTestObject}": org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
| at javax.faces.component.UICommand.broadcast(UICommand.java:387)
| at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
| at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
| at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
| at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
| at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
| at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
| at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:273)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
| at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
| at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
| at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
| at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
| at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
| at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
| at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
| at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
| at org.mortbay.jetty.Server.handle(Server.java:324)
| at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
| at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
| at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
| at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
| at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
| at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
| at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
| Caused by: org.hibernate.validator.InvalidStateException: validation failed for: org.domain.TestObject
| at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
| at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:177)
| at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:217)
| at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:65)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
| at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.dao.impl.TestObjectDAOImpl.get(TestObjectDAOImpl.java:18)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.dao.impl.TestObjectDAOImpl_$$_javassist_15.get(TestObjectDAOImpl_$$_javassist_15.java)
| at org.service.impl.TestObjectServiceImpl.get(TestObjectServiceImpl.java:23)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.service.impl.TestObjectServiceImpl_$$_javassist_12.get(TestObjectServiceImpl_$$_javassist_12.java)
| at org.action.admin.ActionBean.saveTestObject(ActionBean.java:111)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.action.admin.ActionBean_$$_javassist_9.saveTestObject(ActionBean_$$_javassist_9.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
| at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:45)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
| ... 45 more
|
AfterTimeValidator works,and isValid returns false.But it is not reflected to the page with a validation message,instead an uncaught exception occurs. I searched this forum,but couldn't find any solution. Please help...
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101082#4101082
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101082
More information about the jboss-user
mailing list