cognitect-labs / aws-api

AWS, data driven
Apache License 2.0
730 stars 100 forks source link

Illegal reflective access warnings when doing through the default steps in readme with java11 #19

Closed kulminaator closed 5 years ago

kulminaator commented 5 years ago

Environment Ubuntu 18.10 box:

$ uname -a
Linux martin-nitro 4.18.0-12-generic #13-Ubuntu SMP Wed Nov 14 15:17:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-2ubuntu1, mixed mode, sharing)

$ lein --version
Leiningen 2.8.1 on Java 11.0.1 OpenJDK 64-Bit Server VM

#obviously keeping dummy usernames in default aws config for start
$ cat ~/.aws/credentials 
[default]
aws_access_key_id = YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key = YOUR_AWS_SECRET_ACCESS_KEY
region=eu-west-1

Steps followed : Creating a new app with leiningen lein new app aws-api-testbed

Modifying only the dependencies in project file to contain the latest versions, after edit looks like this

$ cat project.clj 
(defproject aws-api-testbed "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
 :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [
    [org.clojure/clojure "1.10.0-RC4"]
    [org.clojure/core.async "0.4.490"]
    [com.cognitect.aws/api "0.8.122"]
    [com.cognitect.aws/endpoints "1.1.11.462"]
    [com.cognitect.aws/s3 "680.2.370.0"]
    ]
  :main ^:skip-aot aws-api-testbed.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

Now executing with lein repl:

$ lein repl
nREPL server started on port 43883 on host 127.0.0.1 - nrepl://127.0.0.1:43883
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.10.0-RC4
OpenJDK 64-Bit Server VM 11.0.1+13-Ubuntu-2ubuntu1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

aws-api-testbed.core=> (require '[cognitect.aws.client.api :as aws])
nil
aws-api-testbed.core=> (def s3-client (aws/client {:api :s3}))
2018-12-08 18:27:08.035:INFO::async-dispatch-1: Logging initialized @12589ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.jetty.util.BufferUtil (file:/home/martin/.m2/repository/org/eclipse/jetty/jetty-util/9.3.7.v20160115/jetty-util-9.3.7.v20160115.jar) to field java.nio.MappedByteBuffer.fd
WARNING: Please consider reporting this to the maintainers of org.eclipse.jetty.util.BufferUtil
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

Syntax error (ExceptionInfo) compiling at (form-init14772803263696788523.clj:1:16).
No region found by any region provider.
aws-api-testbed.core=> 

Just maybe the final error has some reason for the illegal reflective access ?

dchelimsky commented 5 years ago

Thanks for this report. We're using an older version of jetty (transitive dep), so this may just be a matter of upgrading.

ghost commented 5 years ago

Can confirm, on openjdk11 updating the jetty dependencies resolves this issue. It did bring up another illegal access at https://github.com/cognitect-labs/aws-api/blob/master/src/cognitect/aws/util.clj#L137, but could be unrelated.

dchelimsky commented 5 years ago

d4d987038c80a83cd1477f937a77f23a5140e1c7 resolves the xml parse warning, but now seeing the following with jetty 9.4.18.v20190429 and java 11.0.2.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by mranderson049.orchard.v0v4v0.dynapath.v0v2v5.dynapath.defaults$eval2067$fn__2068 to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of mranderson049.orchard.v0v4v0.dynapath.v0v2v5.dynapath.defaults$eval2067$fn__2068
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
dchelimsky commented 5 years ago

This new illegal reflective access issue is coming from cider-nrepl's dependency on mranderson and is not related to jetty, xml, or aws-api. The next release will, however, fix the issues related to jetty and xml.

dchelimsky commented 5 years ago

Fixed in 0.8.335.

payneio commented 5 years ago

Can confirm, on openjdk11 updating the jetty dependencies resolves this issue. It did bring up another illegal access at https://github.com/cognitect-labs/aws-api/blob/master/src/cognitect/aws/util.clj#L137, but could be unrelated.

How does one "update ... jetty dependencies"?

dchelimsky commented 5 years ago

How does one "update ... jetty dependencies"?

If you're using tools.deps, use :override-deps (see https://clojure.org/reference/deps_and_cli#_resolve_deps). AFAIK, Leiningen and Boot each offer ways to override transitive dependencies as well.