vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

vertx web deployed in spring boot, static resource can't be found in spring boot jar

Open don9139 opened this issue 3 years ago • 20 comments

Questions deployed vertx web in spring boot, review the static resource in vertx webroot, it can't be found with 404 error.

Version vertx.version > 4.0.0

Context I encountered an exception which looks suspicious while ...

Do you have a reproducer? springboot jar can be uploaded.

Link to github project/gist Steps to reproduce java -jar ./test-vertx.jar open web brower and input localhost:8080/hello.txt Extra JVM version 1.8

don9139 avatar May 17 '22 02:05 don9139

Resource not found

don9139 avatar May 17 '22 02:05 don9139

[Uploading test-vertx.jar.zip…] test-vertx.jar.zip ()

don9139 avatar May 17 '22 02:05 don9139

there is no issue when vertx version < 4.0.0

don9139 avatar May 17 '22 02:05 don9139

Can you rather share source code please? Thank you

tsegismont avatar May 17 '22 09:05 tsegismont

OK

don9139 avatar May 18 '22 03:05 don9139

test-vertx1.zip

don9139 avatar May 18 '22 03:05 don9139

source code was attached.

don9139 avatar May 18 '22 03:05 don9139

The file seems to be stored in the jar under: /BOOT-INF/classes/webroot/ while we usually expect it under /webroot/. This is something related to spring class loaders i guess.

pmlopes avatar May 19 '22 21:05 pmlopes

but it works when we used vert-web 3.0 before. the path /BOOT-INF/classes/ is defined by spring boot jar, so I think it should be the resource loaded logic was changed when using vert-web 4.0.

don9139 avatar May 23 '22 06:05 don9139

uploaded 3.0 working version.

don9139 avatar May 23 '22 06:05 don9139

the code is same only the version of vert-web is different.

don9139 avatar May 23 '22 06:05 don9139

the code is same only the version of vert-web is different.

Have you solved this problem? I also encountered this problem. The files in the resources directory cannot be obtained after being packaged

smwg avatar Aug 08 '22 04:08 smwg

it looks like the issue https://github.com/eclipse-vertx/vert.x/issues/1623 which was fixed in https://github.com/eclipse-vertx/vert.x/pull/1624, but got cleaned out in the code clean, @vietj

gaol avatar Aug 12 '22 06:08 gaol

@gaol So now the issue has been solved, right? By the way, which version should I use now?

smwg avatar Aug 12 '22 10:08 smwg

@smwg not yet, please take a look at the PR: https://github.com/eclipse-vertx/vert.x/pull/4454, maybe you can try with that branch?

gaol avatar Aug 12 '22 10:08 gaol

@gaol many thanks.

smwg avatar Aug 12 '22 11:08 smwg

@gaol @pmlopes excuse me,In the latest version, does this bug still exist?

smwg avatar Sep 27 '22 08:09 smwg

@smwg this should be fixed in 4.3.4

gaol avatar Sep 27 '22 08:09 gaol

@smwg this should be fixed in 4.3.4

thanks

smwg avatar Sep 27 '22 08:09 smwg