Websocket 运行Cowboy start_listener()时出现异常
我遵循了link,但当我运行这个项目时,它会显示崩溃报告,告诉我cowboy start_listener()是未定义的Websocket 运行Cowboy start_listener()时出现异常,websocket,erlang,gen-server,cowboy,Websocket,Erlang,Gen Server,Cowboy,我遵循了link,但当我运行这个项目时,它会显示崩溃报告,告诉我cowboy start_listener()是未定义的 =CRASH REPORT==== 12-Aug-2014::10:08:06 === crasher: initial call: simple_server_http:init/1 pid: <0.66.0> registered_name: [] exception exit: {undef,
=CRASH REPORT==== 12-Aug-2014::10:08:06 ===
crasher:
initial call: simple_server_http:init/1
pid: <0.66.0>
registered_name: []
exception exit: {undef,
[{cowboy,start_listener,
[http,16,cowboy_tcp_transport,
[{port,8082}],
cowboy_http_protocol,
[{dispatch,
[{'_',
[{[],simple_server_http_static,
[<<"html">>,<<"index.html">>]},
{'_',simple_server_http_catchall,[]}]}]}]],
[]},
{simple_server_http,init,1,
[{file,"src/simple_server_http.erl"},{line,45}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,306}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
in function gen_server:init_it/6 (gen_server.erl, line 330)
ancestors: [simple_server_sup,<0.64.0>]
messages: []
links: [<0.65.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 610
stack_size: 27
reductions: 913
neighbours:
=SUPERVISOR REPORT==== 12-Aug-2014::10:08:06 ===
Supervisor: {local,simple_server_sup}
Context: start_error
Reason: {undef,
[{cowboy,start_listener,
[http,16,cowboy_tcp_transport,
[{port,8082}],
cowboy_http_protocol,
[{dispatch,
[{'_',
[{[],simple_server_http_static,
[<<"html">>,<<"index.html">>]},
{'_',simple_server_http_catchall,[]}]}]}]],
[]},
{simple_server_http,init,1,
[{file,"src/simple_server_http.erl"},{line,45}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
Offender: [{pid,undefined},
{name,simple_server_http},
{mfargs,{simple_server_http,start_link,[]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
=事故报告===2014年8月12日::10:08:06===
撞车者:
初始调用:simple\u server\u http:init/1
pid:
注册名称:[]
异常退出:{unde,
牛仔,开始听,
[http,16,cowboy_tcp_transport,,
[{端口,8082}],
牛仔协议,
[{发送,
[{'_',
[{[],简单的\u服务器\u http\u静态,
[,]},
{'',简单的服务器\u http\u catchall,[]}]}],,
[]},
{simple_server_http,init,1,
[{file,“src/simple_server_http.erl”},{line,45}]},
{gen_server,init_it,6,
[{file,“gen_server.erl”},{line,306}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}
在gen_server函数中:init_it/6(gen_server.erl,第330行)
祖先:[简单服务器支持,]
信息:[]
链接:[]
字典:[]
陷阱_出口:错误
状态:正在运行
堆大小:610
堆栈大小:27
减少:913
邻居:
=主管报告===2014年8月12日::10:08:06===
主管:{本地,简单服务器}
上下文:启动错误
理由:{undf,
牛仔,开始听,
[http,16,cowboy_tcp_transport,,
[{端口,8082}],
牛仔协议,
[{发送,
[{'_',
[{[],简单的\u服务器\u http\u静态,
[,]},
{'',简单的服务器\u http\u catchall,[]}]}],,
[]},
{simple_server_http,init,1,
[{file,“src/simple_server_http.erl”},{line,45}]},
{gen_server,init_it,6,[{file,“gen_server.erl”},{line,306}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}
罪犯:[{pid,未定义],
{name,simple_server_http},
{mfargs,{simple_server_http,start_link,[]},
{restart_type,permanent},
{关闭,5000},
{child_type,worker}]
此错误的含义和解决方法?此错误消息表示模块simple_server_http在第45行调用的函数cowboy:start_listener/6不存在。我已经在github上查看了牛仔模块的源代码,这个函数确实不存在。因此,博客中的代码没有机会与当前版本的cowboy一起运行 当它指定使用过时的erlang版本R15B(2011年12月)时,也许您可以看看以前版本的cowboy:0.6.0版本提供了此功能