No suitable ServiceConnectorCreator found trying to connect to RabbitMQ


Jason Brown
 

I'm trying to connect to RabbitMQ from our Pivotal CloudFoundry environment and I can't get it to work. The only artifact I don't have in my pom is org.cloudfoundry:auto-reconfiguration:1.7.0.RELEASE (or whatever version is current). The error I get in logs is:
2015-12-02T10:12:58.19-0700 [App/0] OUT Caused by: org.springframework.cloud.CloudException: No suitable ServiceConnectorCreator found: service id=JasonMCFTest-rabbit, service info type=org.springframework.cloud.service.common.AmqpServiceInfo, connector type=class com.rabbitmq.client.ConnectionFactory


The following classes are my config class and a simple component that tries to autowire my rabbit bean. I'm also pretty new to Spring, so feel free to bash that too.
<code>
package com.jasbro.mcftest;

import org.springframework.cloud.Cloud;
import org.springframework.cloud.CloudFactory;
import org.springframework.cloud.config.java.AbstractCloudConfig;
import org.springframework.cloud.service.common.AmqpServiceInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.rabbitmq.client.ConnectionFactory;

@Configuration
public class PivotalConfig extends AbstractCloudConfig{
@Bean
public ConnectionFactory rabbitConnectionFactory(){
CloudFactory cloudFactory = new CloudFactory();
Cloud cloud = cloudFactory.getCloud();
AmqpServiceInfo serviceInfo = (AmqpServiceInfo) cloud.getServiceInfo("JasonMCFTest-rabbit");
String serviceId = serviceInfo.getId();
return cloud.getServiceConnector(serviceId, ConnectionFactory.class, null);
}
}



package com.jasbro.mcftest.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.rabbitmq.client.ConnectionFactory;

@Component
public class FilePoller {
@Autowired
private ConnectionFactory rabbitConnectionFactory;
...
}
</code>

And here is the service listing showing (I think) that rabbit is set up and bound to my app.
C:\src\main\JasonMCFTest>cf s
Getting services in org crt / space dev as jason.c.brown...
OK

name service plan bound apps last operation
JasonMCFTest-rabbit p-rabbitmq standard JasonMCFTest create succeeded


Lastly, the list of dependencies from my pom (some of these are probably not needed, but I don't know which):
junit
spring-webmvc
javax.servlet-api
amqp-client
spring-cloud-cloudfoundry-connector
spring-cloud-spring-service-connector
spring-cloud-services-cloudfoundry-connector
spring-boot-autoconfigure
spring-boot-starter-amqp

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.