简体   繁体   中英

How can I resolve this IllegalAccessError in org.mozilla.javascript.optimizer.BodyCodegen running on Heroku?

I have googled far and wide and not found any references to this issue, so any help would be much appreciated.

I can regularly generate an illegal access error when using the Java Less compiler ( https://github.com/marceloverdijk/lesscss-java ), but not on my development machine - only on Heroku (and dokku it seems - same issue there). The compiler calls compile on some javascript code, which goes through the optimiser, and fails with the following stack trace:

java.lang.IllegalAccessError: tried to access method org.mozilla.classfile.ClassFileWriter.getLabelPC(I)I from class org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager
    at org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager.endCatch(Codegen.java:4051)
    at org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager.removeHandler(Codegen.java:3952)
    at org.mozilla.javascript.optimizer.BodyCodegen.visitTryCatchFinally(Codegen.java:3705)
    at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1897)
    at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1873)
    at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1858)
    at org.mozilla.javascript.optimizer.BodyCodegen.generateBodyCode(Codegen.java:1289)
    at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:306)
    at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:166)
    at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:75)
    at org.mozilla.javascript.Context.compileImpl(Context.java:2377)
    at org.mozilla.javascript.Context.compileReader(Context.java:1296)
    at org.lesscss.LessCompiler.init(LessCompiler.java:295)
    at org.lesscss.LessCompiler.compile(LessCompiler.java:357)
    at org.lesscss.LessCompiler.compile(LessCompiler.java:450)

This is particularly odd since the method it fails to call is public ( https://github.com/mozilla/rhino/blob/master/src/org/mozilla/classfile/ClassFileWriter.java#L1260-L1268 ).

As mentioned, I think this has something to do with the Heroku environment, since I cannot replicate this on my development machine.

Any ideas would be gratefully received.

I resolved this by excluding the offending dependency from my build in project.clj , since it wasn't actually needed itself. I'm still not sure why this problem only manifested itself in some environments, but it is now resolved at least.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM