Closed objectconnexions closed 2 years ago
We believe the problem to be simply that the StaticMDCBinder class is available in the classpath. Can you share a fully reproducible example? We strongly prefer binary JARs, the code is not required.
Attached is the example I am running. example.zip
Compiled it with
/tmp/cheerpj_linux_2.2/cheerpj_2.2/cheerpjfy.py target/example.jar --deps target/libs/logback-classic-1.2.10.jar:target/libs/logback-core
-1.2.10.jar:target/libs/slf4j-api-1.7.32.jar
Error is:-
Uncaught ReferenceError: _n4_WObjeC0Z2getSingletonEU is not defined
_c4pbAiW0VVuGNCB2XDNhyX5W8amHeSqasmz2XPna8mre9f5WSH0mqe5vd http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:145
_c4pbAiW0nVuGNCB2Xfh7vtd http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:145
N3org5slf4j3MDCX http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:143
cjG https://cjrtnc.leaningtech.com/2.2/loader.js:2674
_c4_X2ch3qoseuPaagTGYUWcGKeIWT0dsTDPbtUTxfrZu9UbXKzhxAKZdr0eMjWJN9o http://localhost:8080/libs/logback-classic-1.2.10.jar.js:619
_c4_X2ch3qoseuPaagTGYUWcGKeIWT0dsTDPbtcUxfrZKn_teXdqeXNtuhrbrueXqAKJaHKerIiel http://localhost:8080/libs/logback-classic-1.2.10.jar.js:619
_c4_X2ch3qoseuPaaQTGcUGteHnnk10d1e7uebaJ2Zdrdbzjq5bhy0cd7vBd http://localhost:8080/libs/logback-core-1.2.10.jar.js:782
_c4_X2ch3qoseuPaa$TGcUGteHnnk10d1e7uebaJ2ZdrZarKoqriiSho http://localhost:8080/libs/logback-core-1.2.10.jar.js:782
_c4_X2ch3qoseuPaaAUGcUGteHTUBJewJWrKtdsgXG2ZdrZar0gGeb_GJroiSNn http://localhost:8080/libs/logback-core-1.2.10.jar.js:1391
_c4_X2ch3qoseuPaaAUGcUGteXT0dITT2ZdrZarK20eGWbqWcHiZZIDnqrxyCPJZdAdsJmSKNn http://localhost:8080/libs/logback-core-1.2.10.jar.js:1238
_c4_X2ch3qoseuPaacUGYUWcGKeIGEPJHbrKDnWZdrZqPJZdAJwrliaVel5vRd http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaoUGYUWcGKeIGEPJHbru9TaWYI2ZdrZarKKxDo http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaITGYUWcGKeIGEPJHbrKTEafYYarmmG7r7vr0mP1mO98q0m4zNd http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaasUGYUWcGKeIGEPJHbrunEbYYerKwZqPJXFTN9n http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaQTGYUWcGKeIGEPJHbruoruKtKhEp http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4VY7example9EgDG0$212mouseDraggedE2 http://localhost:8080/example.jar.js:16
_h4V33awt9Component23processMouseMoeWtYEventE215 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4p43awt9Component12processEventE210 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4_33awt9Container12processEventE77 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1326
_h4p33awt6Window12processEventE73 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1032
_h4F53awt9Component17dispatchEventImplE162 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4p53awt9Container17dispatchEventImplE79 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1326
_h4F43awt6Window17dispatchEventImplE99 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1032
_h4F43awt9Component13dispatchEventE161 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4V23awt10EventQueue17dispatchfnXXImplE23 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:881
_h4p23awt12EventQueue$33runE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:709
_h4p23awt12EventQueue$33runE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:709
_h4FcIdj4AccessController12doPrivilegedE3 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:818
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4p23awt12EventQueue$43runE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:858
_h4p23awt12EventQueue$43runE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:858
_h4FcIdj4AccessController12doPrivilegedE3 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:818
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4V23awt10EventQueue13dispatchfnXWE21 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:881
anonymous https://cjrtnc.leaningtech.com/2.2/loader.js line 218 > Function:5
runContinuationStack https://cjrtnc.leaningtech.com/2.2/loader.js:489
cheerpjSchedule https://cjrtnc.leaningtech.com/2.2/loader.js:1220
cheerpjSchedInit https://cjrtnc.leaningtech.com/2.2/loader.js:895
cheerpjInitOnce https://cjrtnc.leaningtech.com/2.2/loader.js:919
cheerpjInit https://cjrtnc.leaningtech.com/2.2/loader.js:2122
<anonymous> http://localhost:8080/test.html:11
slf4j-api-1.7.32.jar.js:145:243
_c4pbAiW0VVuGNCB2XDNhyX5W8amHeSqasmz2XPna8mre9f5WSH0mqe5vd http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:145
_c4pbAiW0nVuGNCB2Xfh7vtd http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:145
N3org5slf4j3MDCX http://localhost:8080/libs/slf4j-api-1.7.32.jar.js:143
cjG https://cjrtnc.leaningtech.com/2.2/loader.js:2674
_c4_X2ch3qoseuPaagTGYUWcGKeIWT0dsTDPbtUTxfrZu9UbXKzhxAKZdr0eMjWJN9o http://localhost:8080/libs/logback-classic-1.2.10.jar.js:619
_c4_X2ch3qoseuPaagTGYUWcGKeIWT0dsTDPbtcUxfrZKn_teXdqeXNtuhrbrueXqAKJaHKerIiel http://localhost:8080/libs/logback-classic-1.2.10.jar.js:619
_c4_X2ch3qoseuPaaQTGcUGteHnnk10d1e7uebaJ2Zdrdbzjq5bhy0cd7vBd http://localhost:8080/libs/logback-core-1.2.10.jar.js:782
_c4_X2ch3qoseuPaa$TGcUGteHnnk10d1e7uebaJ2ZdrZarKoqriiSho http://localhost:8080/libs/logback-core-1.2.10.jar.js:782
_c4_X2ch3qoseuPaaAUGcUGteHTUBJewJWrKtdsgXG2ZdrZar0gGeb_GJroiSNn http://localhost:8080/libs/logback-core-1.2.10.jar.js:1391
_c4_X2ch3qoseuPaaAUGcUGteXT0dITT2ZdrZarK20eGWbqWcHiZZIDnqrxyCPJZdAdsJmSKNn http://localhost:8080/libs/logback-core-1.2.10.jar.js:1238
_c4_X2ch3qoseuPaacUGYUWcGKeIGEPJHbrKDnWZdrZqPJZdAJwrliaVel5vRd http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaoUGYUWcGKeIGEPJHbru9TaWYI2ZdrZarKKxDo http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaITGYUWcGKeIGEPJHbrKTEafYYarmmG7r7vr0mP1mO98q0m4zNd http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaasUGYUWcGKeIGEPJHbrunEbYYerKwZqPJXFTN9n http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4_X2ch3qoseuPaaQTGYUWcGKeIGEPJHbruoruKtKhEp http://localhost:8080/libs/logback-classic-1.2.10.jar.js:247
_c4VY7example9EgDG0$212mouseDraggedE2 http://localhost:8080/example.jar.js:16
_h4V33awt9Component23processMouseMoeWtYEventE215 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4p43awt9Component12processEventE210 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4_33awt9Container12processEventE77 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1326
_h4p33awt6Window12processEventE73 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1032
_h4F53awt9Component17dispatchEventImplE162 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4p53awt9Container17dispatchEventImplE79 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1326
_h4F43awt6Window17dispatchEventImplE99 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:1032
_h4F43awt9Component13dispatchEventE161 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:950
_h4V23awt10EventQueue17dispatchfnXXImplE23 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:881
_h4p23awt12EventQueue$33runE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:709
_h4p23awt12EventQueue$33runE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:709
_h4FcIdj4AccessController12doPrivilegedE3 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:818
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4p23awt12EventQueue$43runE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:858
_h4p23awt12EventQueue$43runE2 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:858
_h4FcIdj4AccessController12doPrivilegedE3 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:818
_h4FcIFQXProteceWdZDomain$JavaSha$ZAccessImpl23doIeS4aHtapcztYivilegeE1 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.js:907
_h4V23awt10EventQueue13dispatchfnXWE21 https://cjrtnc.leaningtech.com/2.2/runtime/rt.jar.java.awt.js:881
anonymous https://cjrtnc.leaningtech.com/2.2/loader.js line 218 > Function:5
runContinuationStack https://cjrtnc.leaningtech.com/2.2/loader.js:489
cheerpjSchedule https://cjrtnc.leaningtech.com/2.2/loader.js:1220
(Async: EventHandlerNonNull)
cheerpjSchedInit https://cjrtnc.leaningtech.com/2.2/loader.js:895
cheerpjInitOnce https://cjrtnc.leaningtech.com/2.2/loader.js:919
cheerpjInit https://cjrtnc.leaningtech.com/2.2/loader.js:2122
<anonymous> http://localhost:8080/test.html:11
I cannot reproduce this problem, it works as expected for me. As a first step I recommend to not user jar.js files, they are only an optimization and CheerpJ can successfully run code without them.
As a followup step, make sure the paths to the jar files passed as --deps
are correct. I am quite sure that the problem is just that logback-classic-1.2.10.jar
was not actually used as a dependency while being required.
I had a problem running a very basic application, which failed to start. Tracking down the issue lead to an unusual practice in one of the dependent libraries. It was attempting to execute a method and was expecting to catch the
NoSuchMethodError
when it can't be found. However your code (cheerpJ) just fails with the thrown error (see below), thereby not executing the remaining code and preventing the application from running. This is in a common Java logging library--logback, specifically in theMDC
class in the slf4j-api library, as shown below.Unfortunately the implementation they provide (the logback-classic package) for the bindings does not follow their own suggestions. So, this problem will show up for anybody running code using this logging on your JVM. It is possible to use the log level to control the logging and by turning it to OFF then no attempts to log are made. Alternately, swap to an earlier version (latest logback-classic of 1.1.3), which unfortunately is from many years ago.
Exception displayed:-
Obviously other users of this trick might exist.