Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot web app deployed to JBoss - webjars-locator does not appear to work

I have a small web app using Spring Boot 1.40 and I am having some issues with webjars-locator. When run on my machine using the embedded Tomcat, the webjars-locator works as expected, and I can access eg. jQuery with the following HTML:

<script src="/webjars/jquery/jquery.min.js" type="text/javascript"></script>

However, when the app is packaged as a .war file and deployed to JBoss 6.4.5, that same HTML no longer works. Trying to directly access the .js file in the browser with that URL results in a 404. However I can use

<script src="/webjars/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>

and the file will be found and everything is fine. I am seeing a possibly related log entry when running the app on JBoss:

2016-08-20 02:01:01.154 WARN  o.s.w.s.r.ResourceHttpRequestHandler - Locations list is empty. No resources will be served unless a custom ResourceResolver is configured as an alternative to PathResourceResolver.

I'm guessing there's something I need to specifically configure when running in JBoss that "just works" in the embedded Tomcat; if someone could point me in the right direction that would be great.

Having to specify the version of the webjar is not a deal breaker for this particular app, but could be a huge pain in a larger app if we needed to upgrade jQuery or something else.

like image 835
Brian Smith Avatar asked Aug 20 '16 07:08

Brian Smith


1 Answers

For context see: https://github.com/webjars/webjars-locator/issues/18

You might just need to add the following dependency:

<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>webjars-locator-jboss-vfs</artifactId>
    <version>0.1.0</version>
</dependency>
like image 159
James Ward Avatar answered Oct 04 '22 03:10

James Ward