clj-commons / aleph

Asynchronous streaming communication for Clojure - web server, web client, and raw TCP/UDP
http://aleph.io
MIT License
2.54k stars 241 forks source link

Missing aleph.utils.PluggableDnsAddressResolverGroup #616

Closed pavel-klavik closed 2 years ago

pavel-klavik commented 2 years ago

I have a project when an upgrade from aleph-0.4.6 to 0.5.0 fails with the following stacktrace:

Exception in thread "main" Syntax error macroexpanding at (user.clj:1:1).
    at clojure.lang.Compiler.load(Compiler.java:7665)
    at clojure.lang.RT.loadResourceScript(RT.java:381)
    at clojure.lang.RT.loadResourceScript(RT.java:368)
    at clojure.lang.RT.maybeLoadResourceScript(RT.java:364)
    at clojure.lang.RT.doInit(RT.java:486)
    at clojure.lang.RT.init(RT.java:467)
    at clojure.main.main(main.java:38)
Caused by: java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForName(RT.java:2218)
    at clojure.lang.RT.loadClassForName(RT.java:2237)
    at clojure.lang.RT.load(RT.java:449)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6908.invoke(core.clj:6161)
    at clojure.core$load.invokeStatic(core.clj:6160)
    at clojure.core$load.doInvoke(core.clj:6144)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5933)
    at clojure.core$load_one.invoke(core.clj:5928)
    at clojure.core$load_lib$fn__6850.invoke(core.clj:5975)
    at clojure.core$load_lib.invokeStatic(core.clj:5974)
    at clojure.core$load_lib.doInvoke(core.clj:5953)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$load_libs.invokeStatic(core.clj:6016)
    at clojure.core$load_libs.doInvoke(core.clj:6000)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$require.invokeStatic(core.clj:6038)
    at clojure.core$require.doInvoke(core.clj:6038)
    at clojure.lang.RestFn.invoke(RestFn.java:619)
    at aleph.http.core$loading__6789__auto____1954.invoke(core.clj:1)
    at aleph.http.core__init.load(Unknown Source)
    at aleph.http.core__init.<clinit>(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForName(RT.java:2218)
    at clojure.lang.RT.loadClassForName(RT.java:2237)
    at clojure.lang.RT.load(RT.java:449)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6908.invoke(core.clj:6161)
    at clojure.core$load.invokeStatic(core.clj:6160)
    at clojure.core$load.doInvoke(core.clj:6144)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5933)
    at clojure.core$load_one.invoke(core.clj:5928)
    at clojure.core$load_lib$fn__6850.invoke(core.clj:5975)
    at clojure.core$load_lib.invokeStatic(core.clj:5974)
    at clojure.core$load_lib.doInvoke(core.clj:5953)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$load_libs.invokeStatic(core.clj:6016)
    at clojure.core$load_libs.doInvoke(core.clj:6000)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$require.invokeStatic(core.clj:6038)
    at clojure.core$require.doInvoke(core.clj:6038)
    at clojure.lang.RestFn.invoke(RestFn.java:619)
    at aleph.http.server$loading__6789__auto____1952.invoke(server.clj:1)
    at aleph.http.server__init.load(Unknown Source)
    at aleph.http.server__init.<clinit>(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForName(RT.java:2218)
    at clojure.lang.RT.loadClassForName(RT.java:2237)
    at clojure.lang.RT.load(RT.java:449)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6908.invoke(core.clj:6161)
    at clojure.core$load.invokeStatic(core.clj:6160)
    at clojure.core$load.doInvoke(core.clj:6144)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5933)
    at clojure.core$load_one.invoke(core.clj:5928)
    at clojure.core$load_lib$fn__6850.invoke(core.clj:5975)
    at clojure.core$load_lib.invokeStatic(core.clj:5974)
    at clojure.core$load_lib.doInvoke(core.clj:5953)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$load_libs.invokeStatic(core.clj:6020)
    at clojure.core$load_libs.doInvoke(core.clj:6000)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$require.invokeStatic(core.clj:6038)
    at clojure.core$require.doInvoke(core.clj:6038)
    at clojure.lang.RestFn.invoke(RestFn.java:512)
    at aleph.http$loading__6789__auto____173.invoke(http.clj:1)
    at aleph.http__init.load(Unknown Source)
    at aleph.http__init.<clinit>(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForName(RT.java:2218)
    at clojure.lang.RT.loadClassForName(RT.java:2237)
    at clojure.lang.RT.load(RT.java:449)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6908.invoke(core.clj:6161)
    at clojure.core$load.invokeStatic(core.clj:6160)
    at clojure.core$load.doInvoke(core.clj:6144)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5933)
    at clojure.core$load_one.invoke(core.clj:5928)
    at clojure.core$load_lib$fn__6850.invoke(core.clj:5975)
    at clojure.core$load_lib.invokeStatic(core.clj:5974)
    at clojure.core$load_lib.doInvoke(core.clj:5953)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$load_libs.invokeStatic(core.clj:6016)
    at clojure.core$load_libs.doInvoke(core.clj:6000)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$require.invokeStatic(core.clj:6038)
    at clojure.core$require.doInvoke(core.clj:6038)
    at clojure.lang.RestFn.invoke(RestFn.java:3894)
    at orgpad.server.core$loading__6789__auto____171.invoke(core.clj:1)
    at orgpad.server.core__init.load(Unknown Source)
    at orgpad.server.core__init.<clinit>(Unknown Source)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForName(RT.java:2218)
    at clojure.lang.RT.loadClassForName(RT.java:2237)
    at clojure.lang.RT.load(RT.java:449)
    at clojure.lang.RT.load(RT.java:424)
    at clojure.core$load$fn__6908.invoke(core.clj:6161)
    at clojure.core$load.invokeStatic(core.clj:6160)
    at clojure.core$load.doInvoke(core.clj:6144)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5933)
    at clojure.core$load_one.invoke(core.clj:5928)
    at clojure.core$load_lib$fn__6850.invoke(core.clj:5975)
    at clojure.core$load_lib.invokeStatic(core.clj:5974)
    at clojure.core$load_lib.doInvoke(core.clj:5953)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$load_libs.invokeStatic(core.clj:6016)
    at clojure.core$load_libs.doInvoke(core.clj:6000)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:669)
    at clojure.core$require.invokeStatic(core.clj:6038)
    at clojure.core$require.doInvoke(core.clj:6038)
    at clojure.lang.RestFn.invoke(RestFn.java:703)
    at user$eval138$loading__6789__auto____139.invoke(user.clj:1)
    at user$eval138.invokeStatic(user.clj:1)
    at user$eval138.invoke(user.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7194)
    at clojure.lang.Compiler.eval(Compiler.java:7183)
    at clojure.lang.Compiler.load(Compiler.java:7653)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: aleph.utils.PluggableDnsAddressResolverGroup
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at clojure.lang.RT.classForName(RT.java:2209)
    at clojure.lang.RT.classForNameNonLoading(RT.java:2222)
    at aleph.netty$loading__6789__auto____11535.invoke(netty.clj:1)
    at aleph.netty__init.load(Unknown Source)
    at aleph.netty__init.<clinit>(Unknown Source)
    ... 149 more

Any idea what could be causing this? The code does not interact with Aleph much, just starts the server at the beginning:

(http/start-server #'handler/handler {:socket-address (InetSocketAddress. host port)
                                          :epoll?         (Epoll/isAvailable)
                                          :ssl-context    (when (and dev https) (tls-context))})
arnaudgeiser commented 2 years ago

Hello Pavel!

Before digging too deeply, we have removed the usage of aleph.utils.PluggableDnsAddressResolverGroup. It's not present anymore on the code-base, it has been removed by the following PR : https://github.com/clj-commons/aleph/pull/399/files.

Maybe you have a mismatch between multiple aleph versions. What is the state of your deps?

KingMob commented 2 years ago

Hi Pavel.

In addition to what Arnaud said, what's the context you're using Aleph in? This sounds a lot like the sort of problem we see when multiple versions of a library end up on the classpath. Usually including an uberjar by accident is the reason. (E.g., Jepsen has a similar issue, related to deploying an uberjar that includes byte-streams and manifold.)

I would check for any uberjars in your classpath first. If in doubt, unzip them, look at the file list, and if any jars contain files/classes from elsewhere, they might be uberjars. Also, let us know if you're doing this with graal.

Based on the stacktrace, you're using orgpad-server, and looking at its project.clj, the first thing that looks suspicious is the dep on duct/server.http.aleph. Also, onyx-platform apparently used to use Aleph, and its onyx-http plugin looks like it still does.

That being said, neither appear to build uberjars like orgpad-server itself does. If you were using the orgpad-server uberjar as a dep in another project, that might be the most likely cause of the problem.

pavel-klavik commented 2 years ago

Thanks for the pointers. I checked my dependencies with lein deps :tree, but I couldn't find aleph included multiple times. The mentioned orgpad is our project itself. In the end, I tried to run lein clean and that fixed the problem.