puniverse / quasar

Fibers, Channels and Actors for the JVM
http://docs.paralleluniverse.co/quasar/
Other
4.56k stars 573 forks source link

Instrumenting fails on com.apple.eawt classes #261

Open arohner opened 7 years ago

arohner commented 7 years ago

When starting up my app the console is filled with stacktraces:

[quasar] ERROR: while transforming com/apple/eawt/_AppMenuBarHandler: null
java.lang.IllegalArgumentException
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.getMethodDatabase(QuasarInstrumentor.java:180)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:102)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:88)
    at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:190)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.findBootstrapClass(Native Method)
    at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[quasar] ERROR: while transforming com/apple/eawt/_AppEventHandler: null
java.lang.IllegalArgumentException
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.getMethodDatabase(QuasarInstrumentor.java:180)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:102)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:88)
    at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:190)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.findBootstrapClass(Native Method)
    at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[quasar] ERROR: while transforming com/apple/eawt/_AppEventHandler$_AboutDispatcher: null
java.lang.IllegalArgumentException
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.getMethodDatabase(QuasarInstrumentor.java:180)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:102)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:88)
    at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:190)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at com.apple.eawt._AppEventHandler.<init>(_AppEventHandler.java:71)
    at com.apple.eawt._AppEventHandler.<clinit>(_AppEventHandler.java:65)
[quasar] ERROR: while transforming com/apple/eawt/_AppEventHandler$_AppEventDispatcher: null

There are maybe 3 dozen similar stacktraces, all in a row. All are com.apple.eawt.* classes.

$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)

Running macOS 10.12.4

fonghou commented 7 years ago

Unless the app uses GUI, a simple workaround is "-Djava.awt.headless=true".