Closed CrazyPathFinder closed 12 years ago
supervisor2.erl isn't included in amqp_client, but is used in the code. You can work around this by putting a copy of supervisor2.erl (it's in nearly every project these days, but is in the rabbitmq source tree and can be pulled out from Github...just look at it in the browser in the "raw" format and download it to your project).
I think I took that out because it was causing compilation warnings/errors. I can't remember exactly. It really should be included one way or the other, I just think most people have supervisor2 already in their path somewhere so it's usually not an issue.
I think what I'll do is put in a modified version that does some ifdef stuff to get around the warnings.
thank you for answer
i have supervisor2.erl in "rabbit_common", now i put that file in my project folder and catch next error
=ERROR REPORT==== 26-Apr-2012::21:21:10 ===
* Generic server <0.39.0> terminating
* Last message in was connect
\ When Server state == {state,amqp_network_connection,
{state,undefined,undefined,undefined,undefined,
undefined,false},
<0.38.0>,undefined,
{amqp_params_network,<<"guest">>,<<"guest">>,
<<"/">>,"localhost",5672,0,0,0,infinity,none,
[#Fun
[],[]},
undefined,undefined,
#Fun<amqp_connection_sup.0.39273983>,
#Fun<amqp_connection_sup.2.54430129>,false}
* Reason for termination == * {'module could not be loaded', [{rabbit_net,send,[#Port<0.726>,<<65,77,81,80,0,0,9,1>>]}, {amqp_network_connection,handshake,4}, {amqp_network_connection,try_handshake,4}, {amqp_gen_connection,handle_call,3}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]} \ exception exit: {{undef,[{rabbit_net,send, [#Port<0.726>,<<65,77,81,80,0,0,9,1>>]}, {amqp_network_connection,handshake,4}, {amqp_network_connection,try_handshake,4}, {amqp_gen_connection,handle_call,3}, {gen_server,handle_msg,5}, {proc_lib,init_p_do_apply,3}]}, {gen_server,call,[<0.39.0>,connect,infinity]}} in function gen_server:call/3 in call from userlog_app:test/0
but now i have gen_server2.erl in rabbit_common
Looks like it's definitely not seeing the stuff in rabbit_common. supervisor2.erl and rabbit_net.erl are both in there.
Maybe your "erl -pa" settings need to be adjusted so that it finds "rabbit_common/ebin". It appears that it's not at the moment.
i misunderstand. folder amqp_connect visible in project and all lib (files) working ok. but folder rabbit_common not visible and files don't in path.
Maybe i do somthing wron. i try erl and erl -pa but the same error. when i put supervisor2 in project from deps folder, that file worked when i remove it from project error again. is i need to put all files in project folder? Other libraries work from deps folder ok, but this?
It depends on how you're starting your Erlang VM, but I usually test using a command line like (running this in the project home):
erl -pa deps/*/ebin -pa ebin -config test -s test_app
...or equivalent. This makes sure I have all my dependencies (located in rebar's default dependency folder "deps") in the path. The "-pa" switch is what tells Erlang about my rabbit_common, amqp_client, or whatever.
Sometimes it's even necessary to add dependencies of dependencies (erlv8 is one such beast):
erl -pa deps//ebin -pa deps/erlv8/deps//ebin -pa ebin
...etc.
How are you starting this test? What's your command line look like?
this is my folders struct project -- apps ----userlog ------src ------ebin --rel --deps ----amqp_client ----rabbit_common ----epgsql ----etc. How i can correct start VM for testing
thank you
First make sure "deps/*/ebin" actually has .beam files in it. :)
Without building a rel, which would give you different paths, you'll need something like (on *NIXs, Mac, etc...):
erl -pa deps/*/ebin -pa apps/userlog/ebin ...
Is that just a typo in the comment here where "rabbit_common" [sic] only has one "t"?
thwnk you.
Information for people that uses rebar. I included amqp_client and rabbit_common in myproject/rels/project/reltool.config and amqp_connection just works fine.
Thank you, jbrisbin.
Hello,
amqp_connection:start(#amqp_params_direct{}) or amqp_connection:start(#amqp_params_network{}) i have error
=INFO REPORT==== 26-Apr-2012::20:20:09 === application: amqp_client exited: {bad_return, {{amqp_client,start,[normal,[]]}, {'EXIT', {undef, [{supervisor2,start_link, [{local,amqp_sup},amqp_sup,[]]}, {application_master,start_it_old,4}]}}}} type: temporary \ exception throw: {error,{bad_return,{{amqp_client,start,[normal,[]]}, {'EXIT',{undef,[{supervisor2,start_link, [{local,amqp_sup},amqp_sup,[]]}, {application_master,start_it_old,4}]}}}}} in function amqp_connection:start/1 in call from userlog_app:test/0
RabbitMQ server 2.8.1/R14B04 x64