bertramdev / asset-pipeline

The core implementation of the asset pipeline for the jvm
194 stars 92 forks source link

Running with spring boot & devtools causes exception after webapp redeployment #202

Closed tveimo closed 6 years ago

tveimo commented 6 years ago

If we deploy our webapp developed with spring boot / devtool and the asset pipeline with

gradle bootRun

when the webapp is automatically redeployed due to an updated java class file, the asset pipeline throws an exception when loading css:

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/assets/null/local/bootstrap.css.less]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

It appears that even though the webapp is redeployed, the old asset pipeline servlet filter, or some of the support classes still uses resources from the old webapp.

alt-vena commented 6 years ago

I have the same problem! Did you find a solution for this?

julianrschmidt commented 6 years ago

In order to solve this, include the asset pipeline explicitly in the restart process of devtools.

In the file META-INF/spring-devtools.properties put the following lines:

restart.include.assetpipeline=/asset-pipeline-.+\.jar restart.include.sass=/sass-asset-pipeline-.+\.jar

See also: https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html#using-boot-devtools-customizing-classload

tveimo commented 6 years ago

Ok, it seem to work, I had to add the less compiler plugin as well

restart.include.sass=/less-asset-pipeline-.+.jar