Question

We use JAWR to serve content, but would like to also make use of a CDN to distribute scripts. For instance, to use jQuery, we have:

jawr.js.bundle.jquery.id=/bundles/jquery.js
jawr.js.bundle.jquery.mappings=/js/lib/.license,/js/lib/jquery-1.8.2.js
jawr.js.bundle.jquery.productionURL=http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js

That works great. We get the local library in debug mode, and the one from CDN in production mode. However, let’s add:

jawr.js.bundle.bootstrap.id=/bundles/bootstrap.js
jawr.js.bundle.bootstrap.mappings=/js/lib/bootstrap-2.1.0/js/.license,/js/lib/bootstrap-2.1.0/js/bootstrap.js
jawr.js.bundle.bootstrap.dependencies=jquery

Now, upon access (not upon startup) of a page using /bundles/bootstrap.js, JAWR throws a nasty exception:

java.lang.IllegalStateException: The bundleDataHashCode must be set before accessing the url prefix.
    at net.jawr.web.resource.bundle.JoinableResourceBundleImpl.getURLPrefix(JoinableResourceBundleImpl.java:560)
    ...
    at net.jawr.web.taglib.AbstractResourceBundleTag.doStartTag(AbstractResourceBundleTag.java:68)
    ...

Does that mean I cannot depend on a bundle with a productionURL?

Was it helpful?

Solution

There is an open issue on JAWR about this and a thread (without any answers) in the forum. The answer (from myself) for now is:

You can use productionURL, but do not depend on these bundles. All that is broken is the dependency mechanism. Manually adding all the necessary <jawr:.../> tags works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top