English 中文(简体)
Problematic Wicket RuntimeException
原标题:

I m having trouble pinning down the cause of a RuntimeException in a Wicket application. I ve set numerous breakpoints, but none are firing when I submit my form, only when the form is loading. Here s the stack:

WicketMessage: No get method defined for class: class this.is.my.class.WicketDocumentModel expression: DocumentUpload

Root cause:

org.apache.wicket.WicketRuntimeException: No get method defined for class: class this.is.my.class.WicketDocumentModel expression: DocumentUpload at org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:445) at org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:287) at org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:90) at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:117) at org.apache.wicket.Component.getDefaultModelObject(Component.java:1664) at org.apache.wicket.Component$3.compare(Component.java:548) at org.apache.wicket.Component.setDefaultModelObject(Component.java:3049) at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168) at org.apache.wicket.markup.html.form.upload.FileUploadField.updateModel(FileUploadField.java:100) at org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:225) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465) at org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2051) at org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2019) at org.apache.wicket.markup.html.form.Form.process(Form.java:984) at org.apache.wicket.markup.html.form.Form.process(Form.java:911) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:876) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182) at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:456) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:289) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:619)

I did find discussion about a similar issue here, but I haven t quite been able to turn the advice presented there into a solution for my situation. My class does not contain a Java variable named DocumentUpload, but does contain this:

fuf = new FileUploadField("DocumentUpload");
最佳回答

I spent several hours on this issue, and once again, I figured it out 20 minutes after I posted to SO about it. The fix is to turn the upload field declaration into one that provides a model, like this:

fuf = new FileUploadField("DocumentUpload", new Model<FileUpload>());

EDIT: It turns out this was related to 1.3 -> 1.4 migration. Per the migration guide,

FileUploadField - now requires model

The FileUploadField now REQUIRES a model. This means that if you previously used the ID-only >constructor (i.e. new FileUploadField("myFileField")), you will need to change it to include >a model (i.e. new FileUploadField("myFileField", new Model())).

问题回答

暂无回答




相关问题
What PHP framework is most similar to Apache Wicket?

Feature I m looking for is being component based but not event driven. I also like the idea of defining component in his parent code but describing its placement and some visual aspects in the ...

Wicket: how to synchronize requests within session

Scenario: Apache Wicket based web application running on Tomcat server. User opens URL in browser, session is created and simple main page is shown in browser, user clicks on button and AJAX call is ...

Which Java generic should be used in ambiguous cases?

I m having some problems with a Wicket 1.3 -> Wicket 1.4 migration, but this question could be applied to Java generics overall, too. The migration has caused hundreds of warnings to spring up out of ...

How to display html text within a Wicket element?

i m trying to display html i.e. rich text within a wicket element dynamically. An example is like displaying a rich text email within a div tag. how can i get this done with wicket. the wicket Label ...

Problematic Wicket RuntimeException

I m having trouble pinning down the cause of a RuntimeException in a Wicket application. I ve set numerous breakpoints, but none are firing when I submit my form, only when the form is loading. Here ...

How to limit upload file size in Wicket

How to limit file size in uploads in Apache Wicket version 1.4? I am using FileUploadField to handle upload with normal form submit without any Ajax stuff. Is it enough to use Form.setMaxSize() to ...

热门标签