romenigld

romenigld

Application isn't started

I am doing the code gnome course (which the application is a Hangman) and I tried to start a module with Application which uses an Agent and is complainig this:

iex(1)> Dictionary.random_word
** (exit) exited in: GenServer.call(Dictionary.Runtime.Server, {:get, &Dictionary.Impl.WordList.random_word/1}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.13.0) lib/gen_server.ex:1019: GenServer.call/3

I tried to start with the atom mod: and start_module: on the file mix.exs

def application do
    [
      # mod: { Dictionary.Runtime.Application, [] },
      start_module: { Dictionary.Runtime.Application, [] },
      extra_applications: [:logger]
    ]
  end

application.ex:

defmodule Dictionary.Runtime.Application do

  use Application

  def start(_type, _args) do
    Dictionary.Runtime.Server.start_link()
  end
end

server.ex :

defmodule Dictionary.Runtime.Server do

  @type t :: pid()

  @me __MODULE__

  alias Dictionary.Impl.WordList

  def start_link do
    Agent.start_link(&WordList.word_list/0, name: @me)
  end

  def random_word() do
    Agent.get(@me, &WordList.random_word/1)
  end
end

Marked As Solved

romenigld

romenigld

I solved the problem.
I was putting the mod: on a different app.
Rather than to put on the :dictionary app hahaha.
Thank you all guys for the help.

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New

We're in Beta

About us Mission Statement