# RabbitMQ Connection Refused

**URL:** https://travis-ci.community/t/rabbitmq-connection-refused/3745
**Category:** Travis CI Discussions & Feedback
**Tags:** travis-build
**Created:** [June 16, 2019, 3:59am UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745 "2019-06-16T03:59:48Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![VaughnVernon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/vaughnvernon/32/1986_2.png) [@VaughnVernon](https://travis-ci.community/u/VaughnVernon)
#### Post date: [June 16, 2019, 3:59am UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/1 "2019-06-16T03:59:48Z")

</div>

I’ve been building on Travis-CI and testing with **RabbitMQ** for 6 months and today it stopped working with “Connection refused.”

Caused by: java.net.ConnectException: Connection refused (Connection refused)

I am using all the defaults per documentation:

- localhost and port -1 (choose best default; was previously working)
- 127.0.0.1 and port 5672 (fails)

Ideas?

---

<div class="post-metadata">

### Author: ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)
#### Post date: [June 16, 2019, 1:32pm UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/2 "2019-06-16T13:32:12Z")

</div>

We are switching the default Ubuntu release from Trusty to Xenial

> **[The Travis CI Blog: Ubuntu Xenial 16.04 as the default Travis CI build...](https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment)**
>
> Xenial as the default Travis CI build environment is coming up next week, starting incrementally on Tuesday April 23rd, 2019.
> 
> Since Ubuntu 14.04 reaches End of Life on April 30th, 2019, we’ll be g...

The database services no longer starts by default, so you’ll need to explicitly instruct them to start.

---

<div class="post-metadata">

### Author: ![VaughnVernon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/vaughnvernon/32/1986_2.png) [@VaughnVernon](https://travis-ci.community/u/VaughnVernon)
#### Post date: [June 16, 2019, 2:31pm UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/3 "2019-06-16T14:31:37Z")

</div>

@BanzaiMan Thanks! Is there any plan for Xenial to support RabbitMQ tests?

For readers, I added the following to the `.travis.yml` and testing with RabbitMQ now works:

```auto
os: linux
dist: trusty

```

Best,  
Vaughn

---

<div class="post-metadata">

### Author: ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)
#### Post date: [June 16, 2019, 3:12pm UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/4 "2019-06-16T15:12:11Z")

</div>

Ah, right. RabbitMQ is not pre-installed. [https://docs.travis-ci.com/user/reference/xenial#databases-and-services](https://docs.travis-ci.com/user/reference/xenial#databases-and-services)

What you need is:

```auto
dist: xenial
addons:
  packages:
    - rabbitmq-server
services:
  - rabbitmq

```

---

<div class="post-metadata">

### Author: ![VaughnVernon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/vaughnvernon/32/1986_2.png) [@VaughnVernon](https://travis-ci.community/u/VaughnVernon)
#### Post date: [June 16, 2019, 3:58pm UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/5 "2019-06-16T15:58:48Z")

</div>

@BanzaiMan Strangely that didn’t work. The tests fail when attempting to install `rabbitmq-server`.

---

<div class="post-metadata">

### Author: ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)
#### Post date: [June 17, 2019, 12:42pm UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/6 "2019-06-17T12:42:01Z")

</div>

Not sure what’s failing for you, but it works for me. [https://travis-ci.org/BanzaiMan/travis\_production\_test/builds/546726874#L308](https://travis-ci.org/BanzaiMan/travis_production_test/builds/546726874#L308)

---

<div class="post-metadata">

### Author: ![VaughnVernon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/vaughnvernon/32/1986_2.png) [@VaughnVernon](https://travis-ci.community/u/VaughnVernon)
#### Post date: [June 18, 2019, 12:15am UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/7 "2019-06-18T00:15:56Z")

</div>

Thanks, your example worked. Your previous post was missing one of the keys (`apt:`) and I don’t know the config well enough to have recognized it.

```auto
dist: xenial
addons:
  apt:
    packages:
      - rabbitmq-server
services:
  - rabbitmq

```

Thanks again.

Best,  
Vaughn

---

<div class="post-metadata">

### Author: ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)
#### Post date: [June 18, 2019, 1:51am UTC](https://travis-ci.community/t/rabbitmq-connection-refused/3745/8 "2019-06-18T01:51:34Z")

</div>

Ooops! Thanks for spotting my mistake!
