Skip to content

Instantly share code, notes, and snippets.

@jmsevold
Created February 13, 2016 02:34
Show Gist options
  • Save jmsevold/41efa0d1b7e4867d72e6 to your computer and use it in GitHub Desktop.
Save jmsevold/41efa0d1b7e4867d72e6 to your computer and use it in GitHub Desktop.
defmodule MyApp do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
worker(Todo, [[]])
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
@jmsevold
Copy link
Author

** (Mix) Could not start application my_app: MyApp.start(:normal, []) returned an error: shutdown: failed to start child: Todo
** (EXIT) an exception was raised:
** (UndefinedFunctionError) undefined function Todo.start_link/1
(my_app) Todo.start_link([])
(stdlib) supervisor.erl:343: :supervisor.do_start_child/2
(stdlib) supervisor.erl:326: :supervisor.start_children/3
(stdlib) supervisor.erl:292: :supervisor.init_children/2
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

@danielberkompas
Copy link

@jmsevold can you post your Todo GenServer also?

@jofan
Copy link

jofan commented Feb 21, 2016

@jmsevold Could it be that you start your GenServer with "start" and not "start_link"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment