If it helps, there's a lein plugin
<https://github.com/mowat27/reloadable-app> that creates a new component
based app implementing the reloaded workflow.

I haven't used it myself. But maybe it gets an initial version going, that
you can build on.


Tim Washington
Interruptsoftware.com <http://interruptsoftware.com>


On Sun, Aug 10, 2014 at 3:46 AM, Sven Richter <sver...@googlemail.com>
wrote:

> Hi Alan,
>
> that's right, I did not call (reset) before reloading the page. But that's
> what happens sometimes, you change some things, don't call reset and then
> an exception will be thrown. Afterwards the state seems to be broken and
> nothing works anymore.
> In this special case, when I change the implementation of (add-job), call
> reset and then reload the page no exception appears, and I can see the
> change.
>
> And your second remark is true too, the server was not shutdown, because
> of the exception I guess, when I try to call (stop) explicitly I get this
> error:
> component-test.user=> (stop)
> ;; Shutting down HTTP-Kit server
>
> NullPointerException   component-test.server.Server (server.clj:15)
> component-test.user=>
>
> I mean, it's ok, one could say you have to call (reset) after every
> change, but sometimes one makes mistakes while coding and then you will get
> an exception too, which leads to a needed repl restart. And I just wonder
> if there is some way to get around that.
>
> Best Regards,
> Sven
>
> Am Sonntag, 10. August 2014 04:30:57 UTC+2 schrieb Alan Moore:
>
>>
>>
>> On Saturday, August 9, 2014 3:04:03 PM UTC-7, Sven Richter wrote:
>>>
>>> Hi,
>>>
>>> I setup a small project you can find here: https://github.com/sveri/
>>> component_test
>>> You can run it with lein repl and then calling (go).
>>> 2. In scheduler.clj I defined a protocol (additionally to the lifecycle
>>> protocol) and a record implementing that protocol. I create a new instance
>>> of that record and pass it down to the handler and there to the routes.
>>> Now, when I open a webpage and go to http://localhost:3000/sched
>>> everything works fine.
>>> Next I edit the add-job function in scheduler.cljs to print something
>>> different like this:
>>> (add-job [this]
>>>     (println "new sys out"))
>>> Just a small change is enough. If you go to the webpage again and try to
>>> reload it an exception will be thrown:
>>> Sat Aug 09 23:52:28 CEST 2014 [worker-3] ERROR - GET /sched
>>> java.lang.IllegalArgumentException: No implementation of method:
>>> :add-job of protocol: #'component-test.scheduler/ISched found for
>>> class: component_test.schedul
>>> er.Sched
>>>         at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544)
>>>         at component_test.scheduler$eval6553$fn__6554$G__6544__
>>> 6559.invoke(scheduler.clj:6)
>>>         at component_test.routes$sched_in.invoke(routes.clj:8)
>>>         at component_test.routes$home_routes$fn__3312.invoke(routes.
>>> clj:19)
>>>         at compojure.core$make_route$fn__2331.invoke(core.clj:99)
>>>         at compojure.core$if_route$fn__2315.invoke(core.clj:45)
>>> ...
>>>
>>
>> It just looks like the code didn't get relaoded.
>>
>>
>>>
>>> I dont really understand why that happens and any hints regarding what I
>>> am doing wrong would be great. And this leads to my last question.
>>>
>>> 3. After having an exception I will usually try to reset the system
>>> with: (reset), but in this case (and many different other cases) I will
>>> just get another error:
>>> component-test.user=> (reset)
>>> :reloading (component-test.scheduler component-test.routes
>>> component-test.server component-test.handler component-test.core
>>> component-test.user component-test.c
>>> ore-test)
>>> ;; Starting HTTP-Kit server on port 3000
>>>
>>> BindException Address already in use: bind  sun.nio.ch.Net.bind0
>>> (Net.java:-2)
>>>
>>
>> The server isn't being shut down by the reset or anything else as far as
>> I can see.
>>
>> The log message ";; Shutting down HTTP-Kit server" doesn't appear
>> anywhere in the output you supplied so I'm not sure the server's stop
>> lifecycle method is being called and in any case it doesn't appear to
>> actually shut down the server - it just calls (server)... whatever that
>> does... I'm not sure.
>>
>> Good luck.
>>
>> Alan
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to