1 Reply Latest reply on Oct 20, 2006 6:17 PM by Chuck Adams

    adding messages.properties breaks validation

    Chuck Adams Novice

      I'm working with my optimistic-locking contact manager example, and added a messages.properties to the root of my source file with just one message in it:

      staleEditContact=Sorry, someone else has already updated this contact while you were working on it.
      


      And now I get this as soon as I try to update or create a contact:

      java.lang.IllegalArgumentException: could not instantiate ClassValidator
       at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:265)
       at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:233)
       at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:192)
       at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:110)
       at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:98)
       at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:92)
       at org.jboss.seam.util.Validation.getValidator(Validation.java:17)
       at org.jboss.seam.ui.ModelValidator.validate(ModelValidator.java:38)
       at javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:157)
       at javax.faces.component.UIInput.validateValue(UIInput.java:312)
       at javax.faces.component.UIInput.validate(UIInput.java:353)
       at javax.faces.component.UIInput.processValidators(UIInput.java:183)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIForm.processValidators(UIForm.java:70)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
       at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:146)
       at org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:262)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:33)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.util.MissingResourceException: Can't find resource in bundles: validator.length
       at org.jboss.seam.core.ResourceBundle$1.handleGetObject(ResourceBundle.java:126)
       at java.util.ResourceBundle.getObject(ResourceBundle.java:380)
       at java.util.ResourceBundle.getString(ResourceBundle.java:346)
       at org.hibernate.validator.ClassValidator.replace(ClassValidator.java:518)
       at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:260)
       ... 40 more
      


      I tried moving it to a different resource bundle, and following the documentation, put this in my components.xml:

       <component name="resourceBundle">
       <property name="bundleNames">
       <value>crud_messages</value>
       </property>
       </component>
      


      But got the same error.

      Incidentally, the documentation on message bundles has a typo, and doesn't capitalize the N in "bundleNames"


        • 1. Re: adding messages.properties breaks validation
          Chuck Adams Novice

          I added the "messages" bundle to the bundle names list, and copied an existing messages.properties file from the examples. It's a workaround I can deal with for now, but not one I'm comfortable with -- I doubt I have all the messages available should I add new validators.

          I'm sort of puzzled where the default messages bundle comes from in the first place, since I can't actually find such a bundle in the sources.