juxt / yada

A powerful Clojure web library, full HTTP, full async - see https://juxt.pro/yada/index.html
MIT License
733 stars 101 forks source link

More reflection warnings #305

Open jdf-id-au opened 4 years ago

jdf-id-au commented 4 years ago

I'll try to use https://github.com/juxt/yada/pull/122 as a guide to resolve what I'm getting with:

It managed to take out my whole repl until I traced it down! (At project startup, maybe via a timeout.)

Clojure 1.10.0
nREPL server started on port 50476 on host 127.0.0.1 - nrepl://127.0.0.1:50476
user=> (require '[yada.yada])
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x00000008000ccc40 (file:/Users/jdf/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase)
WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x00000008000ccc40
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

EDIT ... oh dear can't find anything very quickly. Could it be in a sub-dependency? EDIT ... I was using only taoensso.timbre for logging; adding com.fzakaria/slf4j-timbre and org.slf4j/slf4j-api seems to have resolved the problem.

jdf-id-au commented 4 years ago

Coming back to this one because it was annoying me. I think yada is responsible for the reflection warning. I got around to enabling debug:

clj -J--illegal-access=debug -e "(compile 'project.namespace)"

and it pointed me at yada.charset using clojure.xml/parse, which is a known cause of the reflection problem.

WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x0000000800b7d440 (file:/Users/jdf/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
        at clojure.lang.Reflector.canAccess(Reflector.java:49)
        at clojure.lang.Reflector.toAccessibleSuperMethod(Reflector.java:84)
        at clojure.lang.Reflector.lambda$invokeInstanceMethod$0(Reflector.java:99)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1621)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:101)
        at clojure.xml$startparse_sax.invokeStatic(xml.clj:76)
        at clojure.xml$startparse_sax.invoke(xml.clj:75)
        at clojure.xml$parse.invokeStatic(xml.clj:92)
        at clojure.xml$parse.invoke(xml.clj:78)
        at clojure.xml$parse.invokeStatic(xml.clj:86)
        at clojure.xml$parse.invoke(xml.clj:78)
        at yada.charset__init.load(Unknown Source)
        at yada.charset__init.<clinit>(Unknown Source)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:416)
        at clojure.lang.RT.classForName(RT.java:2211)
        at clojure.lang.RT.classForName(RT.java:2220)
        at clojure.lang.RT.loadClassForName(RT.java:2239)
        at clojure.lang.RT.load(RT.java:449)
        at clojure.lang.RT.load(RT.java:424)
        at clojure.core$load$fn__6839.invoke(core.clj:6126)
        at clojure.core$load.invokeStatic(core.clj:6125)
        at clojure.core$load.doInvoke(core.clj:6109)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5908)
        at clojure.core$load_one.invoke(core.clj:5903)

Would it be possible to move to org.clojure/data.xml like Alex Miller suggests?