5

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.

1 Answers1

5

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>
James Ward
  • 28,966
  • 9
  • 47
  • 79
  • That worked like a charm! The log message about the Locations list being empty is still showing up but the locator is working fine, and all other static resources in the project are working correctly now, so I won't fret about that. – Brian Smith Aug 21 '16 at 12:59
  • Works for me! Thanks. – Anand Mar 04 '17 at 06:37