javamavenrhinowro4j

Wro4j - Rhino implementation


I'm trying to implement Wro4j on my Maven project.

I added the following code dependency in my pom.xml:

<properties>
    <wro4j.version>1.7.9</wro4j.version>
</properties>
<dependency>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-core</artifactId>
    <version>${wro4j.version}</version>
</dependency>
<dependency>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-extensions</artifactId>
    <version>${wro4j.version}</version>
</dependency>
<dependency>
    <groupId>org.webjars</groupId>
    <artifactId>envjs</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>org.mozilla</groupId>
    <artifactId>rhino</artifactId>
    <version>1.7R4</version>
</dependency>

And here is the error that appears:

7:26:58,396 ERROR [LessCss] Processing error:Couldn't initialize env.rhino script
java.lang.RuntimeException: Couldn't initialize env.rhino script
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.addClientSideEnvironment(RhinoScriptBuilder.java:96)
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.newClientSideAwareChain(RhinoScriptBuilder.java:233)
    at ro.isdc.wro.extensions.processor.support.less.LessCss.initScriptBuilder(LessCss.java:45)
    at ro.isdc.wro.extensions.processor.support.less.LessCss.less(LessCss.java:84)
    at ro.isdc.wro.extensions.processor.css.RhinoLessCssProcessor.process(RhinoLessCssProcessor.java:130)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.LazyProcessorDecorator.process(LazyProcessorDecorator.java:49)
    at ro.isdc.wro.extensions.processor.js.AbstractNodeWithFallbackProcessor.process(AbstractNodeWithFallbackProcessor.java:59)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.SupportAwareProcessorDecorator.process(SupportAwareProcessorDecorator.java:39)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator.process(ExceptionHandlingProcessorDecorator.java:56)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.BenchmarkProcessorDecorator.process(BenchmarkProcessorDecorator.java:44)
    at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
    at ro.isdc.wro.model.resource.processor.decorator.DefaultProcessorDecorator.process(DefaultProcessorDecorator.java:42)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor$2.process(PreProcessorExecutor.java:228)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.applyPreProcessors(PreProcessorExecutor.java:207)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processAndMerge(PreProcessorExecutor.java:103)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processAndMerge(PreProcessorExecutor.java:77)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:83)
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:101)
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:35)
    at ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator.get(AbstractSynchronizedCacheStrategyDecorator.java:55)
    at ro.isdc.wro.manager.ResourceBundleProcessor.serveProcessedBundle(ResourceBundleProcessor.java:63)
    at ro.isdc.wro.manager.WroManager.process(WroManager.java:159)
    at ro.isdc.wro.http.WroFilter.processRequest(WroFilter.java:340)
    at ro.isdc.wro.http.WroFilter.doFilter(WroFilter.java:295)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: No webjar with uri: env.rhino.js available.
    at ro.isdc.wro.extensions.locator.WebjarUriLocator.locate(WebjarUriLocator.java:72)
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.addClientSideEnvironment(RhinoScriptBuilder.java:92)
    ... 42 more
Caused by: java.lang.IllegalArgumentException: env.rhino.js could not be found. Make sure you've added the corresponding WebJar and please check for typos.
    at org.webjars.WebJarAssetLocator.throwNotFoundException(WebJarAssetLocator.java:174)
    at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:213)
    at org.webjars.WebJarAssetLocator.getFullPath(WebJarAssetLocator.java:189)
    at ro.isdc.wro.extensions.locator.WebjarUriLocator.locate(WebjarUriLocator.java:69)
    ... 43 more

Am I doing something wrong? How can I solve the problem of env.rhino.js being missing from the system as long as the file already exists in the org.webjars dependency? Any solution without using maven plugins is welcome.


Solution

  • It seems wro4j-extensions dependency on version 1.7.9 does not have env.rhino.js. I downgrade the wro4j.version to 1.7.0 and It's worked fine. I assume that the wro4j-extensions have been removed env.rhino.js by mistake, or they've moved it to another place.