puppetlabs / trapperkeeper

A services framework for Clojure / JVM applications.

Home Page:https://tickets.puppetlabs.com/browse/TK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Services defined via `puppetlabs.trapperkeeper.core/defservice` cannot be resolved in a AOT compiled executable.

timclemons opened this issue · comments

Steps to reproduce:

  1. In project.clj set :aot :all.
  2. Use puppetlabs.trapperkeeper.core/defservice to define a service that gets loaded by bootstrap.cfg.
  3. Attempt to create an uberjar.

Result:
Following error is thrown during compilation:

Compiling omf.http.http-service
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: http-service in this context, compiling:(omf/http/http_service.clj:108:1)
    at clojure.lang.Compiler.analyze(Compiler.java:6464)
    at clojure.lang.Compiler.analyze(Compiler.java:6406)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3719)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
    at clojure.lang.Compiler.analyze(Compiler.java:6445)
    at clojure.lang.Compiler.analyze(Compiler.java:6406)
    at clojure.lang.Compiler.compile1(Compiler.java:7221)
    at clojure.lang.Compiler.compile(Compiler.java:7292)
    at clojure.lang.RT.compile(RT.java:398)
    at clojure.lang.RT.load(RT.java:438)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5066.invoke(core.clj:5641)
    at clojure.core$load.doInvoke(core.clj:5640)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5446)
    at clojure.core$compile$fn__5071.invoke(core.clj:5652)
    at clojure.core$compile.invoke(core.clj:5651)
    at user$eval9.invoke(form-init8589420194764528579.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.eval(Compiler.java:6693)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)

Workaround:
The error does not occur when defservice is directly used from the puppetlabs.trapperkeeper.services namespace.

Hey @timclemons, thanks a lot for the bug reports! We actually use JIRA for this, not github issues (this makes me realize I need to turn them off). I've cloned these two issues over to JIRA - https://tickets.puppetlabs.com/browse/TK-24, so we can continue the conversation there. Also, I tried to reproduce this bug, but couldn't - see my comment on the bottom of that ticket. Thanks again!

We've decided to go ahead and turn Github issues back on.