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

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement