Hi,

Looking at the stacktrace I think you should add this line to Wicket's
resource bundle.
Just add it to YourApplication.properties and it should be fine.

On Wed, Nov 16, 2011 at 5:12 PM, Jablow, Eric R <[email protected]> wrote:
> First, let me thank Igor Vaynberg for being so responsive updating the 
> net.ftlines.wicket-bean-validation<http://mvnrepository.com/artifact/net.ftlines.wicket-bean-validation>
>  project.
>
> I still have one final problem configuring it. I have a test that checks that 
> setting a field to a value that violates an @Size constraint should fail 
> validation. I get the following stacktrace:
>
> codeMustBeAtMost4Chars(com.example.wicket.components.classification.CategoryPanelTest)
>   Time elapsed: 0.344 sec  <<< ERROR!
> org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface 
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at 
> [ValidationForm [Component id = form]] on component [ValidationForm 
> [Component id = form]] threw an exception
>      at 
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270)
>      at 
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
>      at 
> org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
>      at 
> org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
>      at 
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>      at 
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>      at 
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>      at 
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>      at 
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
>      at 
> org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:626)
>      at 
> org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:546)
>      at 
> org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:518)
>      at 
> org.apache.wicket.util.tester.BaseWicketTester.submitForm(BaseWicketTester.java:1900)
>      at org.apache.wicket.util.tester.FormTester.submit(FormTester.java:755)
>      at 
> com.example.wicket.components.classification.CategoryPanelTest.codeMustBeAtMost4Chars(CategoryPanelTest.java:81)
>      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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>      at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>      at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>      at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>      at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>      at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>      at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>      at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>      at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>      at 
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>      at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>      at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>      at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>      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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>      at 
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> Caused by: java.lang.reflect.InvocationTargetException
>      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.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
>      ... 43 more
> Caused by: java.util.MissingResourceException: Unable to find property: 
> 'javax.validation.constraints.Size.message' for component: testObject:form 
> [class=net.ftlines.wicket.validation.bean.ValidationForm]
>      at org.apache.wicket.Localizer.getString(Localizer.java:239)
>      at org.apache.wicket.Localizer.getString(Localizer.java:130)
>      at org.apache.wicket.Component.getString(Component.java:1889)
>      at org.apache.wicket.Component.getString(Component.java:1876)
>      at 
> net.ftlines.wicket.validation.bean.ValidationForm$FormErrorSource.getMessage(ValidationForm.java:231)
>      at 
> org.apache.wicket.validation.ValidationError.getErrorMessage(ValidationError.java:150)
>      at 
> net.ftlines.wicket.validation.bean.ValidationForm.validateFormModelObject(ValidationForm.java:215)
>      at 
> net.ftlines.wicket.validation.bean.ValidationForm.onValidateModelObjects(ValidationForm.java:198)
>      at org.apache.wicket.markup.html.form.Form.process(Form.java:830)
>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:762)
>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:692)
>      ... 48 more
>
> The Hibernate Validator documentation states:
>
> # In order to resolve these parameters Hibernate Validator's default 
> MessageInterpolator first recursively
> # resolves parameters against a custom ResourceBundle called 
> ValidationMessages.properties at the
> # root of the classpath (It is up to you to create this file). If no further 
> replacements are possible against the
> # custom bundle the default ResourceBundle under
> # /org/hibernate/validator/ValidationMessages.properties gets evaluated.
>
> So, something is causing the validator to not search its normal locations. 
> Version 4.2.0.Final of the Hibernate Validator jar is a transitive Maven 
> dependency
>
> Respectfully,
> Eric Jablow
>
> This communication, along with any attachments, is covered by federal and 
> state law governing electronic communications and may contain company 
> proprietary and legally privileged information.  If the reader of this 
> message is not the intended recipient, you are hereby notified that any 
> dissemination, distribution, use or copying of this message is strictly 
> prohibited.  If you have received this in error, please reply immediately to 
> the sender and delete this message.  Thank you.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to