本文介绍了部署后禁用grails 2.0资源处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的应用打包成一场战争(由 code>都依赖于Rhino的javascript引擎,但YUI团队已经制作了对它们的Rhino版本进行了一些修改,导致它与香草犀牛不兼容。你有两种选择:
$ b


  1. 尝试使用类加载器

  2. 不要使用YUI压缩器


I've packaged my app into a war (by grails war), and as I see, it have built all required resources. For example I have coffeescript code, that have translated to into js dir. Same for scss, etc. I mean I have all static resources, that can be served directly (and I want to server it from Nginx, not Tomcat)

But after deploying this war into Tomcat, I'm getting errors like:

ERROR plugins.DefaultGrailsPluginManager  - Error configuring dynamic methods for plugin [resources:1.1.6]: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)

This one is from yui-minify-resources plugin. Similar thing happening for coffeescript-resources plugin. Maybe it's because there is something wrong with this plugins, but it's crazy, because I already have all resources, prepared/processed/compiled to static files. I don't need this plugins on production mode.

How I can disable all this resource plugins on production mode? Is it possible?

PS same thing for grails run-war

This is likely due to coffeescript-resources and yui-minify-resources both having a dependency to Rhino javascript engine, but the YUI team has made some modifications to their version of Rhino, which causes it to be incompatible with vanilla Rhino. You have two options:

  1. Try hacking around with classloaders
  2. Don't use YUI compressor

这篇关于部署后禁用grails 2.0资源处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:15