I’m trying to send messages from a Java service to RabbitMQ.
I’m using some Java RabbitMQ client library and trying to run the following code:
private static Client setAcceptAllSSL() throws Exception { TrustStrategy acceptingTrustStrategy = (cert, authType) -> true; SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE); requestFactory = new HttpComponentsRestTemplateConfigurator(sslsf,sslContext); return new Client(new ClientParameters().url(url).username(username).password(password).restTemplateConfigurator(requestFactory)); }
In the last line (Client objectinitialization), the following error is thrown:
java.lang.NoClassDefFoundError: org/springframework/http/converter/json/Jackson2ObjectMapperBuilder
I think I might be missing something in my pom.xml or maybe something with the version of Spring. However, I have not been able to find any missing import/library/version issues.
Please help 🙂
Advertisement
Answer
Add this jackson dependency in pom.xml:
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.databind-version}</version> </dependency>