Skip to content

java.lang.ClassNotFoundException: aleph.http.core.HeaderMap with 0.4.5-alpha6 #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rborer opened this issue Jun 8, 2018 · 11 comments
Closed

Comments

@rborer
Copy link
Contributor

rborer commented Jun 8, 2018

Hi,

I'm currently integrating aleph 0.4.5-alpha6 in one of my projects. As soon as I add a require on aleph.http.client-middleware namespace I receive the following ClassNotFoundException when compiling my project:

java.lang.ClassNotFoundException: aleph.http.core.HeaderMap, compiling:(aleph/http/client_middleware.clj:734:1)
Exception in thread "main" java.lang.ClassNotFoundException: aleph.http.core.HeaderMap, compiling:(aleph/http/client_middleware.clj:734:1)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7010)
	at clojure.lang.Compiler.analyze(Compiler.java:6773)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6991)
	at clojure.lang.Compiler.analyze(Compiler.java:6773)
	at clojure.lang.Compiler.access$300(Compiler.java:38)
	at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:595)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7003)
	at clojure.lang.Compiler.analyze(Compiler.java:6773)
	at clojure.lang.Compiler.analyze(Compiler.java:6729)
	at clojure.lang.Compiler.compile1(Compiler.java:7604)
	at clojure.lang.Compiler.compile(Compiler.java:7676)
	at clojure.lang.RT.compile(RT.java:413)
	at clojure.lang.RT.load(RT.java:458)
	at clojure.lang.RT.load(RT.java:426)
	at clojure.core$load$fn__6548.invoke(core.clj:6046)
	at clojure.core$load.invokeStatic(core.clj:6045)
	at clojure.core$load.doInvoke(core.clj:6029)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invokeStatic(core.clj:5848)
	at clojure.core$load_one.invoke(core.clj:5843)
	at clojure.core$load_lib$fn__6493.invoke(core.clj:5888)
	at clojure.core$load_lib.invokeStatic(core.clj:5887)
	at clojure.core$load_lib.doInvoke(core.clj:5868)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$load_libs.invokeStatic(core.clj:5925)
	at clojure.core$load_libs.doInvoke(core.clj:5909)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$require.invokeStatic(core.clj:5947)
	at clojure.core$require.doInvoke(core.clj:5947)
	at clojure.lang.RestFn.invoke(RestFn.java:551)
	at arachne.interceptor$loading__6434__auto____4299.invoke(interceptor.clj:1)

I'm using Clojure 1.9.0 with java version "1.8.0_161".

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

@rborer I assume we're talking about running the code in REPL, right?

@gsnewmark
Copy link
Contributor

gsnewmark commented Jun 8, 2018

It probably was broken in this commit 😞 🙈 a782c36#diff-0699d0c8d41a57446aff9b64094ddf35L15

Type hint requires class to be available on classpath, but I believe it's generated dynamically on namespace load.

@rborer
Copy link
Contributor Author

rborer commented Jun 8, 2018

@kachayev I have this issue when I run lein compile :all actually.

@rborer
Copy link
Contributor Author

rborer commented Jun 8, 2018

@kachayev Eratta: If I run lein compile :all twice in a row, it works. But with lein do clean, compile :all it fails.

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

@rborer Right, because it generates class first, then uses it.

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

@rborer Will try to find a solution for this. Thanks for reporting!

@rborer
Copy link
Contributor Author

rborer commented Jun 8, 2018

@kachayev Thanks.

I tried to look at it and I'm also struggling to build master branch, it exhibit a similar behaviour which may require changes in https://github.com/ztellman/byte-streams:

$ lein do clean, compile :all
Compiling 6 source files to /Users/reynald/Projects/aleph/target/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
Compiling aleph.flow
Compiling aleph.http.client
Compiling aleph.http.client-middleware
Compiling aleph.http.core
Compiling aleph.http.encoding
Compiling aleph.http.multipart
Compiling aleph.http.server
Compiling aleph.http
Compiling aleph.netty
nil
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(/Users/reynald/Projects/aleph/target/c7f87dfc52ee42bc564349586b532eba0514a016-init.clj:1:5)
	at clojure.lang.Compiler.load(Compiler.java:7526)
	at clojure.lang.Compiler.loadFile(Compiler.java:7452)
	at clojure.main$load_script.invokeStatic(main.clj:278)
	at clojure.main$init_opt.invokeStatic(main.clj:280)
	at clojure.main$init_opt.invoke(main.clj:280)
	at clojure.main$initialize.invokeStatic(main.clj:311)
	at clojure.main$null_opt.invokeStatic(main.clj:345)
	at clojure.main$null_opt.invoke(main.clj:342)
	at clojure.main$main.invokeStatic(main.clj:424)
	at clojure.main$main.doInvoke(main.clj:387)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)
Caused by: java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at clojure.lang.RT.classForName(RT.java:2204)
	at clojure.lang.RT.classForName(RT.java:2213)
	at clojure.lang.RT.loadClassForName(RT.java:2232)
	at clojure.lang.RT.load(RT.java:450)
	at clojure.lang.RT.load(RT.java:426)
	at clojure.core$load$fn__6548.invoke(core.clj:6046)
	at clojure.core$load.invokeStatic(core.clj:6045)
	at clojure.core$load.doInvoke(core.clj:6029)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invokeStatic(core.clj:5848)
	at clojure.core$compile$fn__6553.invoke(core.clj:6056)
	at clojure.core$compile.invokeStatic(core.clj:6056)
	at clojure.core$compile.invoke(core.clj:6048)
	at user$eval164$fn__173.invoke(c7f87dfc52ee42bc564349586b532eba0514a016-init.clj:1)
	at user$eval164.invokeStatic(c7f87dfc52ee42bc564349586b532eba0514a016-init.clj:1)
	at user$eval164.invoke(c7f87dfc52ee42bc564349586b532eba0514a016-init.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:7062)
	at clojure.lang.Compiler.eval(Compiler.java:7052)
	at clojure.lang.Compiler.eval(Compiler.java:7052)
	at clojure.lang.Compiler.load(Compiler.java:7514)
	... 12 more
Caused by: java.lang.ClassCastException: byte_streams.graph.Type cannot be cast to byte_streams.graph.Type
	at byte_streams.graph.ConversionGraph.assoc_conversion(graph.clj:122)
	at byte_streams.graph$fn__3174$G__3136__3180.invoke(graph.clj:91)
	at byte_streams.graph$fn__3174$G__3135__3187.invoke(graph.clj:91)
	at clojure.lang.AFn.applyToHelper(AFn.java:171)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.lang.Atom.swap(Atom.java:79)
	at clojure.core$swap_BANG_.invokeStatic(core.clj:2347)
	at clojure.core$swap_BANG_.doInvoke(core.clj:2337)
	at clojure.lang.RestFn.invoke(RestFn.java:529)
	at aleph.netty$fn__4240.invokeStatic(netty.clj:129)
	at aleph.netty$fn__4240.invoke(netty.clj:129)
	at aleph.netty__init.load(Unknown Source)
	at aleph.netty__init.<clinit>(Unknown Source)
	... 34 more

Again, a second pass with lein compile :all and it's fine :-)

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

@rborer That's the same problem with initialization flow that requires the class to be compiled prior to using it for any type hints.

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

kachayev@b0cc7ac this one should fix the problem with HeaderMap type hint. Still looking into the problem with byte-streams (the reason for that is not the same, unfortunately).

@kachayev
Copy link
Collaborator

kachayev commented Jun 8, 2018

Okay, let's do the following

#388

The problem with byte_streams.graph.Type is definitely not that simple to tackle, and (thanks @gsnewmark for the help), - it hasn't been working for a long time already. So, I'll try to tackle that separately.

@rborer
Copy link
Contributor Author

rborer commented Jun 8, 2018

Thanks.

Looks like byte-streams problem has already been reported under clj-commons/byte-streams#34 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants