Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file-routes.json cannot be found #2408

Closed
Tracked by #5012
mshabarov opened this issue May 13, 2024 · 10 comments · Fixed by #2423
Closed
Tracked by #5012

file-routes.json cannot be found #2408

mshabarov opened this issue May 13, 2024 · 10 comments · Fixed by #2423

Comments

@mshabarov
Copy link
Contributor

mshabarov commented May 13, 2024

Describe the bug

Each Vaadin 24.4 application, that contains Hilla, shows this exception on startup, complaining about file-routes.json file not found:

java.io.FileNotFoundException: .../skeleton-starter-flow-spring/./src/main/frontend/generated/file-routes.json (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method) ~[na:na]
	at java.base/java.io.FileInputStream.open(FileInputStream.java:216) ~[na:na]
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157) ~[na:na]
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111) ~[na:na]
	at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86) ~[na:na]
	at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189) ~[na:na]
	at java.base/java.net.URL.openStream(URL.java:1161) ~[na:na]
	at com.vaadin.hilla.route.ClientRouteRegistry.registerClientRoutes(ClientRouteRegistry.java:158) ~[hilla-endpoint-24.4-20240506.022159-195.jar:na]
	at com.vaadin.hilla.startup.RouteUnifyingServiceInitListener.serviceInit(RouteUnifyingServiceInitListener.java:101) ~[hilla-endpoint-24.4-20240506.022159-195.jar:na]

This, however, doesn't affect the application behaviour and most likely an intermediate state during the build, when this file isn't created yet.

Related-to #2358 (comment), as a possible way to fix it, this exception can be ignored in the ClientRouteRegistry.

Expected-behavior

No exception

Reproduction

Any Hilla or Flow+Spring-Boot starter for Vaadin 24.4.

System Info

Vaadin 24.4.0.beta2

@mshabarov mshabarov added bug Something isn't working hilla Issues related to Hilla labels May 13, 2024
@ZheSun88
Copy link
Contributor

ZheSun88 commented May 14, 2024

this actually affects my application with the following steps.

download the app using this preset https://start.vaadin.com/dl?&preset=test-hybrid-react&projectName=test-hybrid-react&preset=partial-prerelease
unzip
./mvnw
navigate to localhost:8080 [1]
click Hello Hilla
click Hello Flow [2]

in the build log, i have the same exception as mentioned in the original post

image

  • [1]
    image

  • [2]
    the url goes to about:blank#blocked and leave a blank screen
    image

@taefi
Copy link
Contributor

taefi commented May 14, 2024

@ZheSun88 I haven't looked into this yet, but that error log is only happening when a clean app (mostly when a newly created one) is started as the result of an eager attempt for initializing the ClientRouteRegistry and that error log should be just silently ignored as it is expected not to have the file-routes.json in that phase for a new/clean app.
I'd say it has nothing to do with what you've described above, and it's a separate issue (highly probably a blocker) that should be resolved.

@ZheSun88
Copy link
Contributor

I can create a separate issue if necessary..

@Artur-
Copy link
Member

Artur- commented May 14, 2024

Create a new issue, we need to fix this first to avoid that everybody associates all new issues with this stack trace when no other stack trace is shown

@mcollovati
Copy link
Contributor

mcollovati commented May 14, 2024

I think it is related to the fact that the Flow view has a route template parameters

@Route(value = "/:samplePersonID?/:action?(edit)")
@RouteAlias(value = "")
@Uses(Icon.class)
public class HelloFlowView extends Div implements BeforeEnterObserver {

If you replace the @Route(value = "/:samplePersonID?/:action?(edit)") part with @Route("") (also removing the alias) the menu link seems to work,

@ZheSun88
Copy link
Contributor

@mcollovati then it seems the problem comes from the app itself than flow/hilla?

if so, we need to fix that in start project on how to generate this project.

@mcollovati
Copy link
Contributor

I'm not sure. The /:samplePersonID?/:action?(edit) is a valid route in a Flow application, but I don't know if it is supported in the autogenerated menu.

@ZheSun88
Copy link
Contributor

aww.. okay.. anyway.. i will make this to another ticket.. :-)

@taefi taefi closed this as completed May 15, 2024
@taefi taefi reopened this May 15, 2024
ZheSun88 added a commit that referenced this issue May 15, 2024
* fix: ignore absence of file-routes.json at startup in dev mode

Fixes #2408

* apply suggestions from code review

* Update packages/java/endpoint/src/main/java/com/vaadin/hilla/route/ClientRouteRegistry.java

Co-authored-by: Artur <artur@vaadin.com>

---------

Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
Co-authored-by: Artur <artur@vaadin.com>
ZheSun88 added a commit that referenced this issue May 15, 2024
* fix: ignore absence of file-routes.json at startup in dev mode

Fixes #2408

* apply suggestions from code review

* Update packages/java/endpoint/src/main/java/com/vaadin/hilla/route/ClientRouteRegistry.java

Co-authored-by: Artur <artur@vaadin.com>

---------

Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
Co-authored-by: Artur <artur@vaadin.com>
ZheSun88 added a commit that referenced this issue May 15, 2024
… (CP: 24.4) (#2426)

fix: ignore absence of file-routes.json at startup in dev mode (#2423)

* fix: ignore absence of file-routes.json at startup in dev mode

Fixes #2408

* apply suggestions from code review

* Update packages/java/endpoint/src/main/java/com/vaadin/hilla/route/ClientRouteRegistry.java



---------

Co-authored-by: Soroosh Taefi <taefi.soroosh@gmail.com>
Co-authored-by: Zhe Sun <31067185+ZheSun88@users.noreply.github.com>
Co-authored-by: Artur <artur@vaadin.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.4.0.beta3 and is also targeting the upcoming stable 24.4.0 version.

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants