Search code examples
jbossclojurewildflyundertowimmutant

Deploying Immutant to WildFly with several contexts


I have an Undertow web server with Immutant (Clojure), my main- looks like this:

(run
  (-> routes/app
    wrap-something-app-specific
    wrap-params)
  (options
    {:path "/" :port 8080}))

(run
  (-> routes/billing
    wrap-something-billing-specific)
  (options
    {:path "/billing" :port 8081
     :worker-threads 4}))

When running not in a WildFly countainer, it works just fine: localhost:8080/ maps to app routes, and localhost:8081/billing to billing routes. However when I do deploy to WildFly as a ROOT, I can get only one context working, never both. I've tried all combinations of :path / :port params. WildFly logs include this:

13:07:46,295 INFO  [org.projectodd.wunderboss.web.Web] (MSC service thread 1-12) Registered web context /billing
13:07:46,308 INFO  [org.projectodd.wunderboss.web.Web] (MSC service thread 1-12) Registered web context /
................
13:07:46,325 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-12) JBAS017534: Registered web context: /

So how do I make Undertow register both contexts?


Solution

  • This is not a solution but it can give you a hint on what's happening. From Immutant/WildFly documentation, it looks like your problem may come from this limitation when deploying and running into WildFly:

    When running inside WildFly, the :host and :port options to immutant.web/run are silently ignored since your handlers are mounted on WildFly’s internal Undertow server, bound to whatever host/port it’s been configured for.