danielsz/system

Reload not working well with Interfaces

ryallk opened this issue · 6 comments

When we modify a method of an interface with a running system, we get:

#'project.sys/dev:refreshing
Unloading: (project.sys project.handler project.api project.search)
Reloading: (project.search project.api project.handler project.sys)
Elapsed time: 0.105 sec

However, when we call any method from that interface we get the following error:
java.lang.IllegalArgumentException: No implementation of method: ...

We need to stop and start the system to make it work again.

In our build.boot we have:

(deftask dev []
  ...
  (system.boot/system :sys #'project.sys/dev
                      :auto true
                      :files ["project/sys.clj"
                              "project/handler.clj"
                              "project/search.clj"])
  ...
)

Please provide a minimal scenario in a separate repo so I can look at example code. Thank you.

Thank you.

This is a known issue related to tools.namespace. It is addressed here:

https://github.com/clojure/tools.namespace#warnings-for-protocols

That sections also contains suggestions to work around the issue.

Ok sorry figured it out,

(system.boot/system :sys #'project.sys/dev
                      :auto true
                      :files ["project/sys.clj"
                              "project/handler.clj"
                              "project/search.clj"])

should only contain filenames without path:

(system.boot/system :sys #'project.sys/dev
                      :auto true
                      :files ["sys.clj"
                              "handler.clj"
                              "search.clj"])

now it restarts and everything works fine

would be nice for debugging if you could print in the console that the system is restarting.. i had to clone the repo and add the print myself to debug it.

Yes, that is a good idea. Thank you.

BTW, there are new optons available in the latest snapshots. boot system -h for more info.

On 7 Jul 2016, at 2:55 AM, Daniel Szmulewicz notifications@github.com wrote:

Yes, that is a good idea. Thank you.

BTW, there are new optons available in the latest snapshots. boot system -h for more info.

yeah I've seen them when i was adding the print :)

@peterromfeldhk Latest snapshot will print output indicating system is restarting. Thank you!