yui / yuicompressor

YUI Compressor
http://yui.github.com/yuicompressor/
Other
3.01k stars 663 forks source link

Can't find bundle for base name org.mozilla.javascript.resources.Messages, locale en_US #302

Open chengtie opened 6 years ago

chengtie commented 6 years ago

I try to use yui-compressor to compress some JS files. It gives the following exception for some files. Could anyone help?

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org.mozilla.javascript.resources.Messages, locale en_US
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:795)
    at org.mozilla.javascript.ScriptRuntime$DefaultMessageProvider.getMessage(ScriptRuntime.java:3608)
    at org.mozilla.javascript.ScriptRuntime.getMessage(ScriptRuntime.java:3592)
    at org.mozilla.javascript.ScriptRuntime.getMessage0(ScriptRuntime.java:3540)
    at org.mozilla.javascript.Parser.addError(Parser.java:145)
    at org.mozilla.javascript.Parser.reportError(Parser.java:160)
    at org.mozilla.javascript.Parser.memberExprTail(Parser.java:2039)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1977)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1832)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1761)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:1742)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1722)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:1696)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1652)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1641)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1630)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1619)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:1607)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:1595)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:1578)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:1563)
    at org.mozilla.javascript.Parser.expr(Parser.java:1542)
    at org.mozilla.javascript.Parser.statementHelper(Parser.java:1221)
    at org.mozilla.javascript.Parser.statement(Parser.java:726)
    at org.mozilla.javascript.Parser.parseFunctionBody(Parser.java:482)
    at org.mozilla.javascript.Parser.function(Parser.java:611)
    at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2255)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1974)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1832)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1761)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:1742)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1722)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:1696)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1652)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1641)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1630)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1619)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:1607)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:1595)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:1578)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:1563)
    at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2315)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1974)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1832)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1761)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:1742)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1722)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:1696)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1652)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1641)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1630)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1619)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:1607)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:1595)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:1578)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:1563)
    at org.mozilla.javascript.Parser.argumentList(Parser.java:1929)
    at org.mozilla.javascript.Parser.memberExprTail(Parser.java:2069)
    at org.mozilla.javascript.Parser.memberExpr(Parser.java:1977)
    at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1832)
    at org.mozilla.javascript.Parser.mulExpr(Parser.java:1761)
    at org.mozilla.javascript.Parser.addExpr(Parser.java:1742)
    at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1722)
    at org.mozilla.javascript.Parser.relExpr(Parser.java:1696)
    at org.mozilla.javascript.Parser.eqExpr(Parser.java:1652)
    at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1641)
    at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1630)
    at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1619)
    at org.mozilla.javascript.Parser.andExpr(Parser.java:1607)
    at org.mozilla.javascript.Parser.orExpr(Parser.java:1595)
    at org.mozilla.javascript.Parser.condExpr(Parser.java:1578)
    at org.mozilla.javascript.Parser.assignExpr(Parser.java:1563)
    at org.mozilla.javascript.Parser.expr(Parser.java:1542)
    at org.mozilla.javascript.Parser.statementHelper(Parser.java:1221)
    at org.mozilla.javascript.Parser.statement(Parser.java:726)
    at org.mozilla.javascript.Parser.parse(Parser.java:420)
    at org.mozilla.javascript.Parser.parse(Parser.java:378)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
    at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:131)
    ... 5 more
Archie1978 commented 5 years ago

We are in 2019, I have the same bug. Is there a solution?

jozef commented 5 years ago

Possible syntax error? (https://stackoverflow.com/questions/11276135/yuicompressortask-cant-find-bundle-for-base-name-org-mozilla-javascript-resou)

In my case it was a different syntax error → "class" reserved keyword used as object property name. (https://github.com/fancyapps/fancybox/issues/2173)

yui-compressor even with --verbose does not print anything helpful, had to use that webtool mentioned in those two issues above to figure out the cause.

To reproduce exception:

echo "var a = { class: 123 }" | yui-compressor --verbose --type js

Working version:

echo "var a = { classx: 123 }" | yui-compressor --verbose --type js

So the fix would be that there is syntax error message with line number instead of that Java exception.

Thank you.

ondrejd commented 5 years ago

After installing yui-compressor on Ubuntu Linux (via. apt-get install yui-compressor) I got same error (except in my case are cs-CZ locales missing).

stephenostermiller commented 4 years ago

I am encountering this issue now and a number of people on StackOverflow have encountered the problem: YuiCompressorTask: “Can't find bundle for base name org.mozilla.javascript.resources.Messages, locale en_US”