2016-05-13 81 views
1

MyApp.Endpoint在我的鳳凰應用程序我有一個服務器上的這個錯誤,在當地當我跑步鳳凰控制檯:關機:無法啓動子:在鳳凰城/藥劑

[info] Application MyApp exited: MyApp.start(:normal, []) returned an error: shutdown: failed to start child: MyApp.Endpoint 
    ** (EXIT) already started: #PID<0.1012.0> 
{"Kernel pid terminated",application_controller,"{application_start_failure,MyApp,{{shutdown, 
{failed_to_start_child,'Elixir.MyApp.Endpoint', 
{already_started,<0.1012.0>}}},{'Elixir.MyApp',start,[normal,[]]}}}"} 

Crash dump is being written to: erl_crash.dump...done 
Kernel pid terminated (application_controller) ({application_start_failure,MyApp,{{shutdown,{failed_to_start_child,'Elixir.MyApp.Endpoint',{already_started,<0.1012.0>}}},{'Elixir.MyApp',start,[no.... 

什麼是關於?如何解決它?

UPDATE:

下面是完整的混淆堆棧跟蹤:

$ ./bin/my_app console  
Using /home/my_name/my_app_com_webite2/releases/0.0.2/my_app.sh 
Exec: /home/my_name/my_app_com_webite2/erts-7.3.1/bin/erlexec -boot /home/my_name/my_app_com_webite2/releases/0.0.2/my_app -mode embedded -config /home/my_name/my_app_com_webite2/running-config/sys.config -boot_var ERTS_LIB_DIR /home/my_name/my_app_com_webite2/erts-7.3.1/../lib -env ERL_LIBS /home/my_name/my_app_com_webite2/lib -pa /home/my_name/my_app_com_webite2/lib/my_app-0.0.2/consolidated -args_file /home/my_name/my_app_com_webite2/running-config/vm.args -user Elixir.IEx.CLI -extra --no-halt +iex -- console 
Root: /home/my_name/my_app_com_webite2 
/home/my_name/my_app_com_webite2 
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false] 

[info] Application my_app exited: my_app.start(:normal, []) returned an error: shutdown: failed to start child: my_app.Endpoint 
    ** (EXIT) already started: #PID<0.1012.0> 
{"Kernel pid terminated",application_controller,"{application_start_failure,my_app,{{shutdown,{failed_to_start_child,'Elixir.my_app.Endpoint',{already_started,<0.1012.0>}}},{'Elixir.my_app',start,[normal,[]]}}}"} 

Crash dump is being written to: erl_crash.dump...done 
Kernel pid terminated (application_controller) ({application_start_failure,my_app,{{shutdown,{failed_to_start_child,'Elixir.my_app.Endpoint',{already_started,<0.1012.0>}}},{'Elixir.my_app',start,[no 

我創造了釋放它通過mix clean, compile, release

UPDATE2:

# lib/my_app 
defmodule MyApp123 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 = [ 
     supervisor(MyApp123.Endpoint, []), 
     supervisor(MyApp123.Repo, []), 
    ] 


    # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html 
    # for other strategies and supported options 
    opts = [strategy: :one_for_one, name: MyApp123.Supervisor] 
    Supervisor.start_link(children, opts) 
    end 

    # Tell Phoenix to update the endpoint configuration 
    # whenever the application is updated. 
    def config_change(changed, _new, removed) do 
    MyApp123.Endpoint.config_change(changed, removed) 
    :ok 
    end 
end 
+0

你可以發佈你的監督樹的代碼? –

+0

@PawełObrok,那是哪裏? –

+0

它應該在'lib/my_app.ex' – tkowal

回答

0

這意味着,你可能開始MyApp.Endpoint手動地方。在你的lib/my_app.ex裏面應該有這樣一段代碼。

children = [ 
    # Start the endpoint when the application starts 
    supervisor(MyApp.Endpoint, []), 
    # Start the Ecto repository 
    supervisor(MyApp.Repo, []), 
    # Here you could define other workers and supervisors as children 
    # worker(MyApp.Worker, [arg1, arg2, arg3]), 
] 

該代碼表示​​開始MyApp需要開始Endpoint。監督樹對訂單非常嚴格。他們需要監視已啓動的進程,因此如果其他人啓動該進程,則會返回錯誤。這會關閉MyApp和整個虛擬機,因爲沒有主應用程序就無法運行它。嘗試尋找代碼中的某個地方的Endpoint.start調用。

+0

你和我的文件有什麼不同? –

+0

錯誤是由我的本地機器和服務器造成的。 –

+0

沒有什麼區別,我只是把它列入解釋監督。你有沒有檢查你的代碼來調用'Endpoint.start'?如果這不是問題,你能分享回購? – tkowal