Internal Error 500( Unable to read webpack stats file)

Hello every one, please help

update to Vaadin 14.0.5 (deploy as debugMode)

Java 1.8

TomCat 9.0.20

Every 30min get this error:

Server internal error 500

javax.servlet.ServletException: com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

17857417.png

Are you really using 14.0.5 or 14.0.6? 14.0.6 has a serious bug which causes a lot of these kind of issues. The only workaround is to downgrade to 14.0.5

Artur Signell:
Are you really using 14.0.5 or 14.0.6? 14.0.6 has a serious bug which causes a lot of these kind of issues. The only workaround is to downgrade to 14.0.5

Im using 14.0.5

I am new to Vaadin trying to get a vaadin 14 project deployed as a test. I am in process of setting up a tomcat server for my project. What I read about the tomcat server is that a default time out of 30 minutes exist. Not sure if this helps at all, but maybe try to change this time out to something else to see if the errors occur at that new time? Depending on results workaround may be possible.

had the same error double check your version

I had the same problem with a spring app. Found that removing all build artifacts and then using production mode, mvn spring-boot:run -Pproduction, resolved thie issue.

I just downloaded the Vaadin 14 starter project which uses Vaadin 14.3.0.
While mvn jetty:run works just fine mvn jetty:run-exploded -Dvaadin.productionMode produces a 500 error in the webbrowser:

javax.servlet.ServletException: javax.servlet.ServletException: com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:502)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:249)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1701)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
	... 10 more
Caused by: com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
	at com.vaadin.flow.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1594)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1557)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
	... 28 more
Caused by: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
	at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:893)
	at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupDocumentHead(BootstrapHandler.java:770)
	at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.getBootstrapPage(BootstrapHandler.java:539)
	at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:480)
	at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1545)
	... 29 more
Caused by: java.io.IOException: The stats file from webpack (stats.json) was not found.
The application is running in production mode.Verify that build-frontend task has executed successfully and that stats.json is on the classpath.Or switch application to development mode.
	at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.appendNpmBundle(BootstrapHandler.java:925)
	at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:891)
	... 34 more

It seems that you didn’t build it in production mode before running the project in production.

can you try mvn package -Pproduction ?

https://vaadin.com/docs/flow/production/tutorial-production-mode-basic.html

It seems I have a similar issue:

Java 11, Spring Boot 2.2.0(from starter), Vaadin 14.3.0, war packaging, multi module project.

Maven build with package -Pproduction with production profile(pom from starter):

[INFO]
 Running webpack ...Emitted C:\..\target\classes\META-INF\VAADIN/config/stats.json

build-frontend successfully completes.

When I start tomcat I see

INFO: Initializing AtmosphereFramework
12:08:58.996 [main]
 DEBUG com.vaadin.flow.server.startup.DevModeInitializer - Skipping DEV MODE because PRODUCTION MODE is set.

2020-07-22 12:09:48.859  INFO 22212 --- [nio-8080-exec-3]
 o.s.web.servlet.DispatcherServlet        : Completed initialization in 14 ms
2020-07-22 12:09:48.918  INFO 22212 --- [nio-8080-exec-3]
 c.v.f.s.DefaultDeploymentConfiguration   : Vaadin is running in production mode.
2020-07-22 12:09:49.935  INFO 22212 --- [nio-8080-exec-3]
 c.vaadin.flow.spring.SpringInstantiator  : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
2020-07-22 12:09:50.318 ERROR 22212 --- [nio-8080-exec-4]
 c.v.flow.server.frontend.FrontendUtils   : Cannot get the 'stats.json' from the classpath 'META-INF/VAADIN/config/stats.json'
2020-07-22 12:09:50.328 ERROR 22212 --- [nio-8080-exec-4]
 c.v.flow.server.DefaultErrorHandler      : 

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.

Caused by: java.io.IOException: The stats file from webpack (stats.json) was not found.
The application is running in production mode.Verify that build-frontend task has executed successfully and that stats.json is on the classpath.Or switch application to development mode.

I see stats.json in …/target/classes/META-INF/VAADIN/config of parent project.

What would be the reason ?

Hi,

It’s hard to say but:

  • Is your application working in development mode?
  • Can you check the content of stats.json ? (if it looks empty or “good”)
  • Did you put your project in a specific folder (with space, special characters) and can you move it if it’s the case?
  • Did you change something in the pom.xml (standard build or path) ?

Hi Jean-Christophe,

Thanks for your reply.

Actually I’m trying to figure out Vaadin-Spring Boot-Multimodule project pom configuration.

What I’m trying to is having:

* a- project           aggregator pom, all the starter pom configuration is in here, stats.json is in here
* b- project-service   service module, simple pom, parent -> project
* c- project-web       webapp module, simple pom, packaging war, dependency for service, frontend folder is in here, parent ->project
  • Yes it is working in dev mode (goal:package), it is just the starter, In STS(Eclipse) with Tomcat
  • with goal: package -Pproduction profiles: production, …project…\target\classes\META-INF\VAADIN\config\stats.json has 2089 lines. When I run Tomcat(in STS), initally it says
2020-07-23 12:42:06.422  WARN 10092 --- [           main]
 c.v.f.s.c.JSR356WebsocketInitializer     : Atmosphere already initialized
2020-07-23 12:42:06.544  INFO 10092 --- [           main]
 org.apache.catalina.startup.Catalina     : Server startup in [8191]
 milliseconds

when I tried to access application in localhost from browser it says

2020-07-23 12:44:18.820  INFO 10092 --- [nio-8080-exec-3]
 o.a.c.c.C.[.[.
[/xxxxxxxxxxxxx-web]
       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-07-23 12:44:18.821  INFO 10092 --- [nio-8080-exec-3]
 o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-07-23 12:44:18.831  INFO 10092 --- [nio-8080-exec-3]
 o.s.web.servlet.DispatcherServlet        : Completed initialization in 10 ms
2020-07-23 12:44:18.891  INFO 10092 --- [nio-8080-exec-4]
 c.v.f.s.DefaultDeploymentConfiguration   : Vaadin is running in production mode.
2020-07-23 12:44:19.931  INFO 10092 --- [nio-8080-exec-4]
 c.vaadin.flow.spring.SpringInstantiator  : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
2020-07-23 12:44:20.315 ERROR 10092 --- [nio-8080-exec-4]
 c.v.flow.server.frontend.FrontendUtils   : Cannot get the 'stats.json' from the classpath 'META-INF/VAADIN/config/stats.json'
2020-07-23 12:44:20.328 ERROR 10092 --- [nio-8080-exec-4]
 c.v.flow.server.DefaultErrorHandler      : 

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
  • No special characters - But yes some specific folders, explained below
  • Not changed build path, build section and profile section of pom
    • but added ${project.artifactId}
    • added spring-boot-starter-tomcat dependency
    • added modules for my configuration
  • Meanwhile I have moved my generated war package file to my test server and when I start tomcat I experience different case:Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [spring_web]
    was found. This is not legal with relative ordering.

I guess I have a configuration issue with pom.

Many thanks

Just downloaded fresh my-starter-project from vaadin.com, imported and changed only the packaging to war and java version to 11.

  1. Build goal:package - OK , run on tomcat - OK, I can access application from http://localhost:8080/my-starter-project/ and it works
  2. Clean project and then Build goal:package -Pproduction Profiles: production - OK
  3. Added -Dapplication.properties.path server configuration and run on tomcat again the same issue even with the basic starter download:
2020-07-23 14:03:36.928  INFO 21848 --- [nio-8080-exec-2]
 o.a.c.c.C.[.[.
[/my-starter-project]
      : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-07-23 14:03:36.929  INFO 21848 --- [nio-8080-exec-2]
 o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-07-23 14:03:36.941  INFO 21848 --- [nio-8080-exec-2]
 o.s.web.servlet.DispatcherServlet        : Completed initialization in 12 ms
2020-07-23 14:03:36.999  INFO 21848 --- [nio-8080-exec-3]
 c.v.f.s.DefaultDeploymentConfiguration   : Vaadin is running in production mode.
2020-07-23 14:03:38.107  INFO 21848 --- [nio-8080-exec-3]
 c.vaadin.flow.spring.SpringInstantiator  : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
2020-07-23 14:03:38.551 ERROR 21848 --- [nio-8080-exec-3]
 c.v.flow.server.frontend.FrontendUtils   : Cannot get the 'stats.json' from the classpath 'META-INF/VAADIN/config/stats.json'
2020-07-23 14:03:38.563 ERROR 21848 --- [nio-8080-exec-3]
 c.v.flow.server.DefaultErrorHandler      : 

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.

Did I do something missing ?

Hi,

Can you add the exact steps you did (the command you ran)?

  1. mvn package
  2. mvn spring-boot:run → OK
  3. mvn package -Pproduction
  4. mvn spring-boot:run -Dvaadin.productionMode=true → OK

Then I’m not sure about your last command?

Hi,

Actually, I’m trying to run sample starter in tomcat in STS/Eclipse.

I found that subsequent builds(Dev-mode then Prod-mode) creates the issue, but what would be the residual information which cannot be deleted by Clean ?

Here the scenario, it’s a bit long though:

  1. I have cleared all the workspace and downloaded fresh my-starter-project and imported as Maven project

  2. In pom.xml, I have changed packaging to war, java to 11 and added finalName for simple war file name and performed Maven - Update project

  3. From Run - Run configurations menu I have created Maven Build configuration Development Build with goal package and executed the build . Final war was 30MB in size.

  4. I have added Tomcat server to Servers in STS/Eclipse and added my-starter-project to server with Run as Run on server but cancelled run due to missing application properties.

  5. Then, again from Run Run configurations I have edited Tomcat profile and added -Dapplication.properties.path=“file:///C:/xxxx/STS4470-NewApp-WS/my-starter-project/src/main/resources/application.properties” to point application properties file.

  6. And started the Tomcat in STS/Eclipse

  7. While starting Tomcat I see lots of messages under DEBUG dev-updater and DEBUG dev-webpack and it has started normally and

  8. I could access it through localhost:8080/my-starter-project, all is perfect - dev mode

  9. I have stopped Tomcat server in my local STS/Eclipse

  10. I have created duplicate Maven Build configuration from Run - Run configurations and chagned the goal to package -Pproduction and Profiles: production and run it.

  11. Project - Clean - Clean all projects

  12. Run the Production Build. This time webpack ran during build. Final war was 33MB in size.

  13. I started tomcat, no errors during startup. But when I tried to access localhost:8080/my-starter-project I got Unable to read webpack stats file, on my browser and in server log.

So I guess that an issue happens when -Pproduction build made after normal build. In order to check:

  1. I have performed Project - Clean - Clean all projects and change the goal to clean package -Pproduction and rebuilt.
  2. Build completes but this time I have experienced the case explained in https://github.com/vaadin/flow/issues/7985 and added Validator exclusions to STS/Eclipse and Maven Update project again
  3. I got thousands of Warnings for generated html files in node_modules and added HTML Exclusion also for validation and after Maven Update project I see only two Warnings for serialVersionUID in MainView and GreetService
  4. Then assuming with all is OK I have re-Launched Tomcat.
  5. No way! Started webpack-dev-server - “Vaadin is running in DEBUG MODE” ?? goal clean -Pproduction and webpack ?

I could not be sure if my goal is correct but it was, removed target folder contents and retried the build, and relaunched the tomcat, now it turned to Prod mode but again with The stats file from webpack (stats.json) was not found. error on browser and in the log.

As a final attempt, I have cleared all the workspace again(deleted all the files in STS/Eclipse workspae), and re-execute 1-13 but this time with -Pproduction build for the first time and never built for development.

Suprise, in local it was ok with Production mode, no errors on browser it says hello anonymous user. I have transferred war file to my server and it has worked there also and accessible from browser.

So my experience is development mode, somehow persists in somewhere, for war packaging, even Project - clean, maven clean or removing target folder not helped.

Could be the clean goal before package is not executed from Run configuration ? Should I add maven-clean-plugin to production Profile section in pom.xml ?

but even with removing the all the contents of target folder did not help(resulting to not found stats.json)?

It seems the only way to run Production mode was to build first with Production and continue with it.

Maybe I have a small mistake/missing point in the above flow but I could not figure out what.

Thanks in advance.

That’s a lot of tests.

I’m thinking of a synchronization problem of the files you have on your file system and the files in your workspace. I had this kind of errors when I used eclipse (but I’m using IntelliJ most of the time).

But I don’t know. Most of the time I’m not switching from productionMode to devMode and to try productionMode I generally use the command line (to avoid this kind of cache/ error).

It is simply a new folder as a workspace and clean import of a sample project starter, that is strange.

I guessed the issue is about m2e but even with moving war file to server did not change the result. It seems problem happens during the build.

Actually I have also tested the following case to keep on PROD mode and prevent to switch to dev mode:

  1. Successfully built and run the sample application in PROD mode on server
  2. Changed something in java codes, server auto restarts and change was in effect
  3. Changed the styles simply changing lumo-base-color to lumo-success-color for the text field background in css.
  4. Re-execute clean build as the PROD mode requires
  5. Re-deploy on server - Nothing changes for text field background color.
  6. I have performed just Projects - Clean and then the same build configuration for PROD
  7. When I restarted the server it ran in DEV MODE even I did not have any build configuration without -Pproduction and did not build without -Pproduction before. But the style change was in effect :slight_smile:

So no way to keep in PROD mode with changing styles…

Just upgraded to Vaadin 14.4.1 and we are getting this after login:

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:893) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupDocumentHead(BootstrapHandler.java:770) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.getBootstrapPage(BootstrapHandler.java:539) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:480) ~[flow-server-2.3.7.jar:2.3.7]

...

This does not occur using Vaadin 14.3.9. Any help will be greatly appreciated.

Okay, no response…let’s try again…
Just upgraded to 14.4.3 and now getting this error:

2020-11-29 10:01:33.141 ERROR 22375 — [0.1-8080-exec-7]
o.a.c.c.C.[.[.[.[dispatcherServlet]
: Servlet.service() for servlet [dispatcherServlet]
in context with path
[/development] threw exception [com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.]
with root cause

java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]

at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[na:na]

at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[na:na]

at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[na:na]

...

Guess we’ll fall back to version 14.3.9 and wait to see if there is anyone who will help us with this issue.

The stack trace should have more of a root cause e.g. WebpackConnectionException or IOException with extra information.

Did the webpack build succeed and is the webpackDevServer up and running?
There should be in the log a line like ------------------ Frontend compilation failed. ----------------- or ----------------- Frontend compiled successfully. -----------------
If it has failed by scrolling up should give some more information on why it failed.

Else if the dev server is up and running try connecting to the devServer on the port printed before the execution should look something like i ?wds?: Project is running at http://localhost:49905/webpack-dev-server/ (Note the port is not static and changes between runs) the url should give a directory serving of config and going to http://localhost:49905/assetsByChunkName should return a string looking like {"bundle":"build/vaadin-bundle-6fea68761ed8139e41bf.cache.js","devmodeGizmo":"build/vaadin-devmodeGizmo-ab0c65ccc111fa465397.cache.js","export":"build/vaadin-export-b48171422a92f3d768fc.cache.js"}

Just upgraded to Vaadin 14.4.1 and we are getting this after login:

com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:893) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupDocumentHead(BootstrapHandler.java:770) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.getBootstrapPage(BootstrapHandler.java:539) ~[flow-server-2.3.7.jar:2.3.7]

at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:480) ~[flow-server-2.3.7.jar:2.3.7]

...

This does not occur using Vaadin 14.3.9. Any help will be greatly appreciated.