luminus-framework / luminus

documentation site for Luminus framework
http://www.luminusweb.net/
629 stars 121 forks source link

Issue with uberwar #69

Closed smahood closed 9 years ago

smahood commented 9 years ago

I'm having trouble getting 'lein ring uberwar' to create a file that will work in either Jetty or Tomcat.

Reproducible steps: lein new luminus test +swagger Go into test directory lein ring server works fine lein ring uberwar Copy war file into jetty webapps folder Start jetty using java -jar start.jar Get error in console in form java.lang.IllegalArgumentException: No value supplied for key: {:formats (:json-kw :yaml-kw :edn :transit-json :transit-msgpack), :handle-error #<middleware$handle_req_error compojure.api.middleware$handle_req_error@262d72a>}, compiling:(services.clj:12:1)...

This is running on Windows 10 preview, using Leiningen 2.5.1 on Java 1.8.0_31 Java HotSpot(TM) 64-Bit Server VM

Any ideas?

yogthos commented 9 years ago

You'd have to use lein ring uberwar to build a war archive using the lein-ring plugin.

smahood commented 9 years ago

Yeah, that was a mistake in the issue text only - I used lein ring uberwar to make a war archive. Fixed in issue description, sorry about that.

yogthos commented 9 years ago

OK I can reproduce the issue and it appears to be a problem with the compojure-api library that's pulled in with the +swagger profile. A base project without it doesn't exhibit the issue. So, might make sense to open issue for it instead.

smahood commented 9 years ago

Ok, will see if I can get it sorted there and will follow up here when fixed. Thanks!

mll commented 9 years ago

I finally solved this issue.

There is a library name conflict between

https://github.com/ngrunwald/ring-middleware-format

and

https://github.com/metosin/ring-middleware-format

compojure-api comes from metosin as well and depends on the latter while luminus had (i dont see it now) a dependency on the former. Therefore, it was completely undeterministic when which of them would be included and seems that uberjar was leaning towards importing the former, which is wrong and breaks compojure-api. So, just delete all references to ring-middleware-format in your project.clj and all should work fine (compojure would force fetching of the proper library anyway)

yogthos commented 9 years ago

Ah ok yeah, the middleware-format library used to have a different maintainer, I started using it in Luminus before it moved to metosin, so older versions of the template would have it instead.

ikitommi commented 9 years ago

Discussed with Nils at EuroClojure about our fork. Plan is to merge our stuff into original and add together some cool new features on top. Sorry for the hassle.