AlejandroRivera/embedded-rabbitmq

Embedded Rabbit MQ is not downloading and starting after deleting .embeddedRabbitMQ Directory

Closed this issue · 4 comments

Hi,

I am using Embedded RabbitMQ for running Integration Tests.
Earlier today, everything worked pretty well but after deleting .embeddedRabbitMQ directory and clearing the extracted files in Temp directory, I am not able to run anything smoothly.

I am getting below exception, even newly it is not getting downloaded.

Code

  var configBuilder = new EmbeddedRabbitMqConfig.Builder();
        configBuilder.downloadFrom(OfficialArtifactRepository.GITHUB);
        configBuilder.port(5673);
        configBuilder.useCachedDownload(false);
        var config = configBuilder.build();
        var command = new RabbitMqCommand(config, "rabbitmq-server", "start");
        command.call();

Need your help.

Exception Caused By

java.lang.IllegalArgumentException: The given command could not be found using the path: C:\Users\<username>\AppData\Local\Temp\rabbitmq_server-3.8.0\sbin\rabbitmq-server.bat

@AlejandroRivera Need your suggestion in resolving this issue.

Hi @vigneshbrb...
It's going to be hard for me to help out here since i don't have a Windows machine i can test things, but do you see the logs where the file is being downloaded and extracted? From the error message, it seems like the file isn't found and i imagine the issue is the extraction process failing for some reason.

The logs that show the extraction It should look like this: https://travis-ci.org/github/AlejandroRivera/embedded-rabbitmq/builds/463047276#L2522

If you don't see those logs, make sure to enabled DEBUG-level logs on your config (SLF4J or whatever logging library you're using).

I'd also recommend you set a breakpoint in your test right before the test finishes and the tear-down takes place and then navigating on your filesystem to see the actual extracted files and ensuring things are there.

Good luck!

@AlejandroRivera Hi. Thank you very much for your response and apologies for my delayed respond.
Now, Download and extraction is working fine after performing each operation separately as given below.

Like:

For Downloading:

  var downloaderFactory = new DownloaderFactory(config);
        var downloader = downloaderFactory.getNewInstance();
        downloader.run();

For Extracting:

   var extractorFactory = new ExtractorFactory(config);
        var extractor = extractorFactory.getNewInstance();
        extractor.run();

For Running:

 var command = new RabbitMqCommand(config, "rabbitmqctl", "start_app");
        rabbitMqProcess = command.call().getFuture();

These steps worked amazingly well last week but suddenly today this seems to be not working.

Exception:

12918 [Thread-9] INFO  i.a.o.e.r.E.Process.rabbitmqctl - Starting node rabbit@HOSTNAME ... 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - Error: unable to perform an operation on node 'rabbit@HOSTNAME'. Please see diagnostics information and suggestions below. 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - Most common reasons for this are: 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues) 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server) 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * Target node is not running 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - In addition to the diagnostics info below: 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * Consult server logs on node rabbit@HOSTNAME 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * If target node is configured to use long node names, don't forget to use --longnames with CLI tools 
13013 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - DIAGNOSTICS 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - =========== 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - attempted to contact: [rabbit@HOSTNAME] 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - rabbit@HOSTNAME: 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -   * connected to epmd (port 4369) on HOSTNAME 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -   * epmd reports: node 'rabbit' not running at all 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -                   no other nodes on HOSTNAME 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -   * suggestion: start the node 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl - Current node details: 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * node name: 'rabbitmqcli-2096-rabbit@HOSTNAME' 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * effective user's home directory: C:\Users\username 
13014 [Thread-10] WARN  i.a.o.e.r.E.Process.rabbitmqctl -  * Erlang cookie hash: 68SvG0DBCDENDv/w+jeUhpsA== 

So I decided to follow the steps given in README:

EmbeddedRabbitMq rabbitMq = new EmbeddedRabbitMq(config);
        rabbitMq.start();

Then also no luck.

io.arivera.oss.embedded.rabbitmq.helpers.StartupException: Could not confirm RabbitMQ Server initialization completed successfully within 3000ms 

Your help will be great on understanding how to resolve this.

Hi again,

Without having access to the logs from the process that's trying to start the RabbitMQ server it will be hard to know what's the issue. However, it's clear that the issue here is being able to run RabbitMQ on your host and it's not related to this library.

I'd suggest:
a) Determining if there's not already some process that was left hanging that's using the port number you're trying to use -- this is a common issue when RabbitMQ isn't properly terminated (like if your JVM instance crashes or you don't make it stop programmatically.
b) look for RabbitMQ log file. See http://www.rabbitmq.com/logging.html
c) Look for an Erlang's crash dump (erl_crash.dump ). See https://www.rabbitmq.com/troubleshooting.html#crash-dumps
d) Manually download and run the RabbitMQ server (ie. without using this library) on your system. Once you're able to run it like that, you should also be able to run it using this library.

Good luck again!