How to start my OTP app - getting: method_missing - no such file or directory, ''

I have my elixir app, every things works and starts well, but after I compile my project and try to start it, I have problem with it. I think I have misunderstanding how to start app.
After googling my question I found answer that start compiled app i need to run:

iex(1)> :application.ensure_all_started(:dispatcher_service)

I did it in dispatcher_service/_build/dev/lib/dispatcher_service/ebin, but get error with starting other dependents apps.

{:error, {:method_missing, {'no such file or directory', ''}}}

my mix.exs

defmodule DispatcherService.MixProject do
  use Mix.Project

  def project do
      app: :dispatcher_service,
      version: "0.1.0",
      elixir: "~> 1.6",
      start_permanent: Mix.env() == :prod,
      deps: deps()

  # Run "mix help" to learn about applications.
  def application do
      applications: [:method_missing, :logger, :mongodb_ecto, :ecto],
      mod: {DispatcherService.Application, []}, # points to the module with application
      extra_applications: [:logger]

  # Run "mix help deps" to learn about dependencies.
  defp deps do
      {:amqp, "~> 1.0"},
      {:poison, "~> 3.1"},
      {:postgrex, ">= 0.0.0"},
      {:ecto, "~> 2.0"},
      {:mongodb_ecto, "~> 0.1"},
      {:method_missing, "~> 0.1.0"},
      { :uuid, "~> 1.1" }
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "", tag: "0.1.0"},

tree dispatcher_service/_build/dev/lib

β”œβ”€β”€ amqp
β”œβ”€β”€ amqp_client
β”œβ”€β”€ connection
β”œβ”€β”€ db_connection
β”œβ”€β”€ decimal
β”œβ”€β”€ dispatcher_service
β”œβ”€β”€ ecto
β”œβ”€β”€ goldrush
β”œβ”€β”€ jsx
β”œβ”€β”€ lager
β”œβ”€β”€ method_missing
β”œβ”€β”€ mongodb
β”œβ”€β”€ mongodb_ecto
β”œβ”€β”€ poison
β”œβ”€β”€ poolboy
β”œβ”€β”€ postgrex
β”œβ”€β”€ rabbit_common
β”œβ”€β”€ ranch
β”œβ”€β”€ ranch_proxy_protocol
β”œβ”€β”€ recon
└── uuid

You should remove the :applications key and just use:

  def application do
      mod: {DispatcherService.Application, []}, # points to the module with application
      extra_applications: [:logger, :mongodb_ecto, :ecto]]

But I’m pretty sure :mongodb_ecto and :ecto are not necessary as Elixir starts these automatically.

:method_missing is not an application, it’s a library, so you would want to remove that from your list of apps.

What did you do there?

Aside of that unclarity, @voughtdq is totally correct, unless you want to maintain compatibility to elixir <1.4 you shouldn’t use :applications at all, and mixing them is a no go.

Since you are specifiyng elixir ~> 1.6, you shouldn’t use :applications but only :extra_applications, and usually you do not need to add anything there.

1 Like