私のJavaサーブレットにhttpc要求を行うのに問題があります。 私のローカルシステムでは、コードは正常に動作していますが、ejabberdサーバーのerlangファイルから呼び出しを実行すると、不正な引数例外が発生します。httpc要求:不正な引数の例外長
これは私のローカルシステムからの私のコードです:
Body = "deviceToken=dy....[Very long FCM token]....b1&sender=epeued7o3z", inets:start(), httpc:request(post, { "http://192.168.2.110:8080/020/service", [], "application/x-www-form-urlencoded", Body }, [], []).
私はejabberdサーバのErlangのファイルにコードをコピーして、私はこの例外を得た:
2017-11-24 18:05:40 =CRASH REPORT==== crasher: initial call: httpc_handler:init/1 pid: <0.522.0> registered_name: [] exception error: bad argument: [{erlang,length,[[100,101,118,105,99,101,84,111,107,101,110,61,<<"dy....[Very long FCM token]...Kn4b1">>,38,115,101,110,100,101,114,61|<<"epeued7o3z">>]],[]},{httpc_request,body_length,1,[{file,"httpc_request.erl"},{line,233}]},{httpc_request,post_data,4,[{file,"httpc_request.erl"},{line,208}]},{httpc_request,send,4,[{file,"httpc_request.erl"},{line,85}]},{httpc_handler,connect_and_send_first_request,3,[{file,"httpc_handler.erl"},{line,815}]},{httpc_handler,init,1,[{file,"httpc_handler.erl"},{line,238}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}] ancestors: [httpc_handler_sup,httpc_sup,inets_sup,<0.439.0>] message_queue_len: 0 messages: [] links: [<0.445.0>,#Port<0.14269>] dictionary: [] trap_exit: true status: running heap_size: 610 stack_size: 27 reductions: 978 neighbours: 2017-11-24 18:05:40 =SUPERVISOR REPORT==== Supervisor: {local,httpc_handler_sup} Context: child_terminated Reason: {badarg,[{erlang,length,[[100,101,118,105,99,101,84,111,107,101,110,61,<<"dy...[Very long FCM token].....Kn4b1">>,38,115,101,110,100,101,114,61|<<"epeued7o3z">>]],[]},{httpc_request,body_length,1,[{file,"httpc_request.erl"},{line,233}]},{httpc_request,post_data,4,[{file,"httpc_request.erl"},{line,208}]},{httpc_request,send,4,[{file,"httpc_request.erl"},{line,85}]},{httpc_handler,connect_and_send_first_request,3,[{file,"httpc_handler.erl"},{line,815}]},{httpc_handler,init,1,[{file,"httpc_handler.erl"},{line,238}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]} Offender: [{pid,<0.522.0>},{id,undefined},{mfargs,{httpc_handler,start_link,undefined}},{restart_type,temporary},{shutdown,4000},{child_type,worker}]
です私のローカルプログラムではうまく働いているので、体の長さは間違っているか長いですか?サーブレットへのリクエストは問題ではありません。
ありがとうございます!
ありがとう、これは私のために働く! – Ghostw4lk