[ 
https://issues.apache.org/jira/browse/WICKET-6002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962240#comment-14962240
 ] 

Martin Grigorov commented on WICKET-6002:
-----------------------------------------

How to run the application in my IDE? If you use non-standard ways to do that 
then please add it in the steps to reproduce! I'm wasting my spare time trying 
to figure out what to do with this rather big application.
Trying to start id.ac.itb.sigit.pengenalanpola.PlatNomorApp as SpringBoot app 
fails with:
Exception in thread "main" java.lang.IllegalStateException: Failed to execute 
CommandLineRunner
        at 
org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:676)
        at 
org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:691)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
        at 
org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
        at 
id.ac.itb.sigit.pengenalanpola.PlatNomorApp.main(PlatNomorApp.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.NullPointerException
        at 
org.bytedeco.javacpp.helper.opencv_core$AbstractArray.createIndexer(opencv_core.java:175)
        at 
org.bytedeco.javacpp.helper.opencv_core$AbstractArray.createIndexer(opencv_core.java:165)
        at 
id.ac.itb.sigit.pengenalanpola.ChainCodeWhiteConverter.getChainCode(ChainCodeWhiteConverter.java:49)
        at id.ac.itb.sigit.pengenalanpola.PlatNomorApp.run(PlatNomorApp.java:58)
        at 
org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:673)
        ... 9 more

Also please don't scratch your comments but delete them and leave only the 
latest version. It is hard to follow you this way.

Now on the issue itself: Spring Boot uses Servlet 3.0 MultipartConfig by 
default. Wicket 7.0.0 supports it partially - there is no support for progress 
notifications.
I'd recommend to use (exclude = MultipartAutoConfiguration.class) in Wicket 
applications.

> FileUploadField makes form-component models become null on submit
> -----------------------------------------------------------------
>
>                 Key: WICKET-6002
>                 URL: https://issues.apache.org/jira/browse/WICKET-6002
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.0.0
>         Environment: Spring Boot 1.2.6, wicket-bootstrap 0.10.3, Tomcat 8
>            Reporter: Hendy Irawan
>            Assignee: Martin Grigorov
>
> First form: (not working)
> {code:java}
>         final Form<Void> form = new Form<>("form");
>         final ListModel<FileUpload> filesModel = new ListModel<>();
>         final FileUploadField fileFld = new FileUploadField("fileFld", 
> filesModel);
>         form.add(fileFld);
>         final Model<GrayscaleMode> modeImageModel = new 
> Model<>(GrayscaleMode.WHITE_ON_BLACK);
>         final RadioChoice<GrayscaleMode> modeImage = new 
> RadioChoice<>("modeImage",
>                 modeImageModel, ImmutableList.copyOf(GrayscaleMode.values()));
>         form.add(modeImage);
>         form.add(new AjaxButton("loadBtn2") {
>             @Override
>             protected void onAfterSubmit(AjaxRequestTarget target, Form<?> 
> form) {
>                 super.onAfterSubmit(target, form);
>                 log.info("modeimageModel: {}", modeImageModel.getObject());
>             }
>         });
>         add(form);
> {code}
> Second form: exactly same as above, but remove the fileUploadField.
> {code:java}
> final Form<Void> form2 = new Form<>("form2");
> final Model<GrayscaleMode> modeImage2Model = new 
> Model<>(GrayscaleMode.WHITE_ON_BLACK);
> final RadioChoice<GrayscaleMode> modeImage2 = new RadioChoice<>("modeImage2",
>         modeImage2Model, ImmutableList.copyOf(GrayscaleMode.values()));
> form2.add(modeImage2);
> form2.add(new AjaxButton("loadBtn3") {
>     @Override
>     protected void onAfterSubmit(AjaxRequestTarget target, Form<?> form) {
>         super.onAfterSubmit(target, form);
>         log.info("modeimageModel: {}", modeImage2Model.getObject());
>     }
> });
> add(form2);
> {code}
> Markup:
> {code}
> <form class="col-md-3" wicket:id="form">
>     <p><strong>Original</strong></p>
>     <div>
>         <input type="file" wicket:id="fileFld" accept="image/*"/>
>         <p>
>             <label>Mode</label>:
>             <span wicket:id="modeImage"></span>
>         </p>
>         <button class="button" wicket:id="loadBtn2">Load Biasa</button>
>     </div>
> </form>
> <form class="col-md-3" wicket:id="form2">
>     <p><strong>Original</strong></p>
>     <div>
>         <p>
>             <label>Mode</label>:
>             <span wicket:id="modeImage2"></span>
>         </p>
>         <button class="button" wicket:id="loadBtn3">Load 3</button>
>     </div>
> </form>
> {code}
> With the non-working form, the request is multipart. This seems to cause all 
> form components' model.getObject() become null.
> {noformat}
> POST 
> /chaincode?0-1.IBehaviorListener.0-form-loadBtn2&wicket-ajax=true&wicket-ajax-baseurl=chaincode%3F0
>  HTTP/1.1
> Host: localhost:8080
> Connection: keep-alive
> Content-Length: 576
> Cache-Control: max-age=0
> Accept: 
> text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
> Origin: http://localhost:8080
> Upgrade-Insecure-Requests: 1
> User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 
> (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
> Content-Type: multipart/form-data; 
> boundary=----WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Referer: http://localhost:8080/chaincode?0
> Accept-Encoding: gzip, deflate
> Accept-Language: id,en-US;q=0.8,en;q=0.6,ms;q=0.4
> Cookie: JSESSIONID=746B6931A8791427E02FCE5C1D20F1B7
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Content-Disposition: form-data; name="form3_hf_0"
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Content-Disposition: form-data; name="fileFld"; filename=""
> Content-Type: application/octet-stream
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Content-Disposition: form-data; name="modeImage"
> 0
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Content-Disposition: form-data; name="msgImage"
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy
> Content-Disposition: form-data; name="loadBtn2"
> 1
> ------WebKitFormBoundaryv78rJ8mvP8YbHtBy--
> {noformat}
> With the working form, the request is urlencoded form:
> {noformat}
> POST /chaincode?0-1.IBehaviorListener.0-form2-loadBtn3 HTTP/1.1
> Host: localhost:8080
> Connection: keep-alive
> Content-Length: 36
> Origin: http://localhost:8080
> Wicket-FocusedElementId: loadBtn32
> User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 
> (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
> Accept: application/xml, text/xml, */*; q=0.01
> X-Requested-With: XMLHttpRequest
> Wicket-Ajax: true
> Wicket-Ajax-BaseURL: chaincode?0
> Referer: http://localhost:8080/chaincode?0
> Accept-Encoding: gzip, deflate
> Accept-Language: id,en-US;q=0.8,en;q=0.6,ms;q=0.4
> Cookie: JSESSIONID=746B6931A8791427E02FCE5C1D20F1B7
> form21_hf_0=&modeImage2=0&loadBtn3=1
> {noformat}
> "Probably" related with WICKET-5924, but I don't have issue with 
> FileUploadField, my issue is with other form components in the same form as 
> FileUploadField. Probably related to: 
> http://stackoverflow.com/questions/28784942/fileupload-field-wicket-error
> *Test case:*
> {code}
> git clone https://github.com/tmdgitb/pengenalan_pola_shih.git -t WICKET-6002
> {code}
> 1. Go to "ChainCode" page 
> 2. click "Load Biasa" on the left, you'll see "modeimageModel: null". --> not 
> working: using FileUploadField + multipart
> 3. click "Load 3" on the right, you'll see "modeimageModel: WHITE_ON_BLACK" 
> --> works: using urlencoded



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to