I'm trying to get a simple clustering example working on docker of two nodes.
I've used the example broker.xml files from the examples.
Since they are running on the same host machine I've changed the port for the second instance. These ports are exposed and mapped on docker.
However when the instances startup and try to contact each other I get warnings that it cannot connect to the destinations.
node0_1 | 2020-07-11 19:49:10,775 WARN [org.apache.activemq.artemis.core.server] AMQ224091: Bridge ClusterConnectionBridge#12be5aac [name=$.artemis.internal.sf.my-cluster.93477bd0-c3af-11ea-bd98-0242ac120003, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.93477bd0-c3af-11ea-bd98-0242ac120003, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=933f3e46-c3af-11ea-a418-0242ac120002], temp=false]#63e7e9f9 targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge#12be5aac [name=$.artemis.internal.sf.my-cluster.93477bd0-c3af-11ea-bd98-0242ac120003, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.93477bd0-c3af-11ea-bd98-0242ac120003, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=933f3e46-c3af-11ea-a418-0242ac120002], temp=false]#63e7e9f9 targetConnector=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61617&host=localhost], discoveryGroupConfiguration=null]]::ClusterConnectionImpl#912966811[nodeUUID=933f3e46-c3af-11ea-a418-0242ac120002, connector=TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=localhost, address=, server=ActiveMQServerImpl::serverUUID=933f3e46-c3af-11ea-a418-0242ac120002])) [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61617&host=localhost], discoveryGroupConfiguration=null]] is unable to connect to destination. Retrying
node1_1 | 2020-07-11 19:49:10,913 WARN [org.apache.activemq.artemis.core.server] AMQ224091: Bridge ClusterConnectionBridge#1634c4b9 [name=$.artemis.internal.sf.my-cluster.933f3e46-c3af-11ea-a418-0242ac120002, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.933f3e46-c3af-11ea-a418-0242ac120002, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=93477bd0-c3af-11ea-bd98-0242ac120003], temp=false]#50c16063 targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge#1634c4b9 [name=$.artemis.internal.sf.my-cluster.933f3e46-c3af-11ea-a418-0242ac120002, queue=QueueImpl[name=$.artemis.internal.sf.my-cluster.933f3e46-c3af-11ea-a418-0242ac120002, postOffice=PostOfficeImpl [server=ActiveMQServerImpl::serverUUID=93477bd0-c3af-11ea-bd98-0242ac120003], temp=false]#50c16063 targetConnector=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=localhost], discoveryGroupConfiguration=null]]::ClusterConnectionImpl#1792384402[nodeUUID=93477bd0-c3af-11ea-bd98-0242ac120003, connector=TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61617&host=localhost, address=, server=ActiveMQServerImpl::serverUUID=93477bd0-c3af-11ea-bd98-0242ac120003])) [initialConnectors=[TransportConfiguration(name=netty-connector, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&host=localhost], discoveryGroupConfiguration=null]] is unable to connect to destination. Retrying
I've tried changing from localhost to IP address of host but this results in a bind error
Failure in initialisation: java.lang.IllegalStateException: AMQ229230: Failed to bind acceptor netty-acceptor to 192.168.0.15:61616
node0_1 | at org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor.startServerChannels(NettyAcceptor.java:688) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor.start(NettyAcceptor.java:456) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl.startAcceptors(RemotingServiceImpl.java:313) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.completeActivation(ActiveMQServerImpl.java:3023) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:78) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:599) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:526) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:70) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:84) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_232]
node0_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_232]
node0_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_232]
node0_1 | at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_232]
node0_1 | at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134) [artemis-boot.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50) [artemis-boot.jar:2.13.0]
node0_1 | Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Cannot assign requested address
I thought it might be something to do with the network interfaces as I have more than one virtual one.
If I set local-bind-address for the broadcast groups and discovery groups I get the following error:
node0_1 | 2020-07-11 20:07:07,774 ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in initialisation: java.lang.IllegalStateException: AMQ219004: Failed to initialise session factory
node0_1 | at org.apache.activemq.artemis.core.server.cluster.ClusterController.configAndAdd(ClusterController.java:204) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.cluster.ClusterController.addClusterConnection(ClusterController.java:169) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.cluster.ClusterManager.deployClusterConnection(ClusterManager.java:612) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.cluster.ClusterManager.deploy(ClusterManager.java:245) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart1(ActiveMQServerImpl.java:2854) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:68) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:599) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:526) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:70) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:84) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:153) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:101) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:128) [artemis-cli-2.13.0.jar:2.13.0]
node0_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_232]
node0_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_232]
node0_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_232]
node0_1 | at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_232]
node0_1 | at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:134) [artemis-boot.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:50) [artemis-boot.jar:2.13.0]
node0_1 | Caused by: ActiveMQInternalErrorException[errorType=INTERNAL_ERROR message=AMQ219004: Failed to initialise session factory]
node0_1 | at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.initialize(ServerLocatorImpl.java:269) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.server.cluster.ClusterController.configAndAdd(ClusterController.java:202) [artemis-server-2.13.0.jar:2.13.0]
node0_1 | ... 18 more
node0_1 | Caused by: ActiveMQInternalErrorException[errorType=INTERNAL_ERROR message=Cannot assign requested address (Error setting socket option)]
node0_1 | at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.startDiscovery(ServerLocatorImpl.java:283) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.initialize(ServerLocatorImpl.java:265) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | ... 19 more
node0_1 | Caused by: java.net.SocketException: Cannot assign requested address (Error setting socket option)
node0_1 | at java.net.PlainDatagramSocketImpl.socketSetOption0(Native Method) [rt.jar:1.8.0_232]
node0_1 | at java.net.PlainDatagramSocketImpl.socketSetOption(PlainDatagramSocketImpl.java:74) [rt.jar:1.8.0_232]
node0_1 | at java.net.AbstractPlainDatagramSocketImpl.setOption(AbstractPlainDatagramSocketImpl.java:309) [rt.jar:1.8.0_232]
node0_1 | at java.net.MulticastSocket.setInterface(MulticastSocket.java:471) [rt.jar:1.8.0_232]
node0_1 | at org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory$UDPBroadcastEndpoint.openClient(UDPBroadcastEndpointFactory.java:214) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.cluster.DiscoveryGroup.start(DiscoveryGroup.java:111) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.startDiscovery(ServerLocatorImpl.java:281) [artemis-core-client-2.13.0.jar:2.13.0]
node0_1 | ... 20 more
That being said I'm not sure I'm setting this value correctly. If I have two network interfaces, one with a 172.22.0.x for the VMs and the other a 192.168.0.x for the host machine. What value should I use?
broxer.xml 1
<?xml version="1.0"?>
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<!-- from 1.0.0 to 1.5.5 the following line should be : <core xmlns="urn:activemq:core"> -->
<core xmlns="urn:activemq:core" xsi:schemaLocation="urn:activemq:core ">
<bindings-directory>./data/bindings</bindings-directory>
<journal-directory>./data/journal</journal-directory>
<large-messages-directory>./data/largemessages</large-messages-directory>
<paging-directory>./data/paging</paging-directory>
<!-- Connectors -->
<connectors>
<connector name="netty-connector">tcp://localhost:61616</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
</acceptors>
<!-- Clustering configuration -->
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<group-address>${udp-address:231.7.7.7}</group-address>
<group-port>9876</group-port>
<broadcast-period>100</broadcast-period>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="my-discovery-group">
<group-address>${udp-address:231.7.7.7}</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group"/>
</cluster-connection>
</cluster-connections>
<!-- Other config -->
<security-settings>
<!--security for example queue-->
<security-setting match="exampleQueue">
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>
<permission roles="guest" type="deleteNonDurableQueue"/>
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
</security-settings>
<addresses>
<address name="exampleQueue">
<anycast>
<queue name="exampleQueue"/>
</anycast>
</address>
</addresses>
</core>
</configuration>
broxer.xml 2
<?xml version="1.0"?>
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<!-- from 1.0.0 to 1.5.5 the following line should be : <core xmlns="urn:activemq:core"> -->
<core xmlns="urn:activemq:core" xsi:schemaLocation="urn:activemq:core ">
<bindings-directory>./data/bindings</bindings-directory>
<journal-directory>./data/journal</journal-directory>
<large-messages-directory>./data/largemessages</large-messages-directory>
<paging-directory>./data/paging</paging-directory>
<!-- Connectors -->
<connectors>
<connector name="netty-connector">tcp://localhost:61617</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61617</acceptor>
</acceptors>
<!-- Clustering configuration -->
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<group-address>${udp-address:231.7.7.7}</group-address>
<group-port>9876</group-port>
<broadcast-period>100</broadcast-period>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="my-discovery-group">
<group-address>${udp-address:231.7.7.7}</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group"/>
</cluster-connection>
</cluster-connections>
<!-- Other config -->
<security-settings>
<!--security for example queue-->
<security-setting match="exampleQueue">
<permission roles="guest" type="createDurableQueue"/>
<permission roles="guest" type="deleteDurableQueue"/>
<permission roles="guest" type="createNonDurableQueue"/>
<permission roles="guest" type="deleteNonDurableQueue"/>
<permission roles="guest" type="consume"/>
<permission roles="guest" type="send"/>
</security-setting>
</security-settings>
<addresses>
<address name="exampleQueue">
<anycast>
<queue name="exampleQueue"/>
</anycast>
</address>
</addresses>
</core>
</configuration>
docker-compose file
version: '3.3'
services:
node0:
image: vromero/activemq-artemis:latest
volumes:
- ./node0/etc/:/var/lib/artemis/etc
environment:
ENABLE_JMX_EXPORTER: "true"
ARTEMIS_MIN_MEMORY: "1512M"
ARTEMIS_MAX_MEMORY: "2000M"
ARTEMIS_USERNAME: "artemis"
ARTEMIS_PASSWORD: "password"
ports:
- "8161:8161"
- "61616:61616"
node1:
image: vromero/activemq-artemis:latest
volumes:
- ./node1/etc/:/var/lib/artemis/etc
environment:
ENABLE_JMX_EXPORTER: "true"
ARTEMIS_MIN_MEMORY: "1512M"
ARTEMIS_MAX_MEMORY: "2000M"
ARTEMIS_USERNAME: "artemis"
ARTEMIS_PASSWORD: "password"
ports:
- "8162:8161"
- "61617:61617"
Network bridge is the default network driver used by docker and creates a virtual interface in the container that’s not available on the host but allows containers connected to the same bridge network to communicate.
The IP address of the broker used in broker.xml for the connector and the acceptor should match with the IP address of the container virtual network interface. This IP address is assigned dynamically but docker-compose allows to define a custom network with a fixed addresses, ie:
networks:
artemis-cluster-network:
ipam:
config:
- subnet: 172.20.0.0/16
The UDP multicast with the address 231.7.7.7 should work and you can check it with the following docker-compose.yml:
version: '3.0'
services:
udp-receiver:
image: alpine/socat
entrypoint: ''
command: sh -c "hostname -i ; socat UDP4-RECVFROM:6666,ip-add-membership=231.7.7.7:0.0.0.0 STDIO"
networks:
artemis-cluster-network:
ipv4_address: 172.20.0.100
udp-sender:
image: alpine/socat
depends_on:
- udp-receiver
entrypoint: ''
command: sh -c "hostname -i ; echo 'Hello World' | socat - UDP4-DATAGRAM:231.7.7.7:6666,so-broadcast"
networks:
artemis-cluster-network:
ipv4_address: 172.20.0.101
networks:
artemis-cluster-network:
ipam:
config:
- subnet: 172.20.0.0/16
Related
PROBLEM
Springboot application tries to connect local Mongo instead of a remote one.
RESEARCH
A simple example application.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>mongo-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mongo-test</name>
<description>mongo-test</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Application.java class
package com.example.mongotest;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.connection.netty.NettyStreamFactoryFactory;
import com.mongodb.reactivestreams.client.MongoClient;
import com.mongodb.reactivestreams.client.MongoClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration;
import org.springframework.data.mongodb.core.ReactiveMongoClientFactoryBean;
import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
#EnableReactiveMongoRepositories
#SpringBootApplication
public class MongoTestApplication extends AbstractReactiveMongoConfiguration {
public static void main(String[] args) {
SpringApplication.run(MongoTestApplication.class, args);
}
#Bean
public MongoClient mongoClient() {
return Clients.create(
"mongodb://user:password#11.111.111.110:27017/database?authSource=admin");
}
#Override
protected String getDatabaseName() {
return "database";
}
}
Logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.5)
2021-10-06 14:51:54.302 INFO 1034758 --- [ restartedMain] c.e.mongotest.MongoTestApplication : Starting MongoTestApplication using Java 11.0.10
2021-10-06 14:51:54.303 INFO 1034758 --- [ restartedMain] c.e.mongotest.MongoTestApplication : No active profile set, falling back to default profiles: default
2021-10-06 14:51:54.465 INFO 1034758 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Reactive MongoDB repositories in DEFAULT mode.
2021-10-06 14:51:54.493 INFO 1034758 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 26 ms. Found 2 Reactive MongoDB repository interfaces.
2021-10-06 14:51:54.706 INFO 1034758 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[11.111.111.11:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2021-10-06 14:51:54.719 INFO 1034758 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2021-10-06 14:51:54.725 INFO 1034758 --- [127.0.0.1:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 127.0.0.1:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:124) ~[mongodb-driver-core-4.2.3.jar:na]
at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129) ~[na:na]
at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219) ~[na:na]
at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.net.ConnectException: Connection is refused
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method) ~[na:na]
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252) ~[na:na]
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198) ~[na:na]
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213) ~[na:na]
at java.base/sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:306) ~[na:na]
... 1 common frames omitted
2021-10-06 14:51:54.782 INFO 1034758 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2021-10-06 14:51:54.980 INFO 1034758 --- [ restartedMain] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port 8080
2021-10-06 14:51:54.986 INFO 1034758 --- [ restartedMain] c.e.mongotest.MongoTestApplication : Started MongoTestApplication in 0.819 seconds (JVM running for 1.152)
2021-10-06 14:51:55.451 INFO 1034758 --- [22.222.22:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:289157}] to 11.111.111.11:27017
2021-10-06 14:51:55.451 INFO 1034758 --- [22.222.22:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:289158}] to 11.111.111.11:27017
2021-10-06 14:51:55.451 INFO 1034758 --- [22.222.22:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=11.111.111.11:27017, type=STANDALONE, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=325549357}
QUESTION
I don't want to connect local MongoDb on 127.0.0.1. I want to connect 11.111.111.11 remote MongoDb. How to setup the Spring Data Mongo Application to NOT connect 127.0.0.1?
The root cause was finally fixed. Although I have tried to disable various autoconfigurations:
#SpringBootApplication(
exclude = {
MongoAutoConfiguration.class,
MongoReactiveAutoConfiguration.class,
MongoDataAutoConfiguration.class,
EmbeddedMongoAutoConfiguration.class
})
this was not necessary as calling 127.0.0.1 originated from an AbstractReactiveMongoConfiguration class I had to remove:
public class MongoTestApplication extends AbstractReactiveMongoConfiguration {}
Creating an app using the very helpful Spring Initialzr
https://start.spring.io/ with dependencies: Web, Apache Camel
and version 2.1.1.RELEASE. The generated app includes Apache Camel Spring boot starter:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.23.0</version>
</dependency>
Running the generated test suite works without errors when executed from the command line with
mvn clean test
However it fails from Eclipse (version Oxygen.2 December 2017 running on MacOs) with the error:
2018-12-26 14:35:32.870 ERROR 37612 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Error processing condition on org.apache.camel.spring.boot.TypeConversionConfiguration.defaultCamelConversionService
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64) ~[spring-boot-autoconfigure-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:181) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) [spring-boot-test-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) [.cp/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.apache.camel.spring.boot.TypeConversionConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader#404b9385]
Any help is most welcome.
Tests pass when executed with the latest version of Eclipse 2018-12.
in REST API using jersey, using Maven.
Maven successfully added mox and entity jars.
I'm getting below error when trying to get JSON type result.
#Produces(MediaType.APPLICATION_JSON)
content of pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>in.alonebirddev.acs</groupId>
<artifactId>messanger</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>messanger</name>
<build>
<finalName>messanger</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<!-- uncomment this to get JSON support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.23.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-entity-filtering</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
<properties>
<jersey.version>2.23.2</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
error :
SEVERE: StandardWrapper.Throwable
java.lang.NoSuchMethodError: org.glassfish.jersey.message.filtering.EntityFilteringFeature.enabled(Ljavax/ws/rs/core/Configuration;)Z
at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:88)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:730)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:648)
at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5407)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Sep 18, 2016 6:11:14 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /messanger threw load() exception
java.lang.NoSuchMethodError: org.glassfish.jersey.message.filtering.EntityFilteringFeature.enabled(Ljavax/ws/rs/core/Configuration;)Z
at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:88)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:730)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:648)
at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5407)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
and when removed version info from pom getting below error
Sep 18, 2016 6:27:57 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/glassfish/jersey/moxy/json/internal/ConfigurableMoxyJsonProvider
at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:92)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:730)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:648)
at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Sep 18, 2016 6:27:57 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet Jersey Web Application
java.lang.NoClassDefFoundError: org/glassfish/jersey/moxy/json/internal/ConfigurableMoxyJsonProvider
at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:92)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:730)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:648)
at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
!!! SOLVED.
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.8</version>
</dependency>
this solved my problem.
Tried the following
mvn dependency:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # messanger ---
[INFO] in.alonebirddev.acs:messanger:war:0.0.1-SNAPSHOT
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.23.2:compile
[INFO] | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b05:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.23.2:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.23.2:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b05:compile
[INFO] | | | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b05:compile
[INFO] | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b05:compile
[INFO] | | +- org.glassfish.hk2:hk2-locator:jar:2.5.0-b05:compile
[INFO] | | | \- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.23.2:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:2.23.2:compile
[INFO] | | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.23.2:compile
[INFO] | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | \- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-moxy:jar:2.23.2:compile
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.6.0:compile
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.0:compile
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.0:compile
[INFO] | \- org.glassfish:javax.json:jar:1.0.4:compile
[INFO] \- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.7:compile
I checked the repo for this. The dependency you have is 2.7 and the method is not available in that revision. Have you tried adding a newer dependency to jersey-entity-filtering and tried if it works ?
I am trying to integrate JBOSS EAP6.2.0 with IBM MQ 7.5.
JBOSS servers are configured to run in a managed domain.
With JBoss 6.2, following steps are completed:
1. successfully deployed wmq.jmsra.rar file
2. Created resource adapter, connection factory and destination queue.
here is the snippet of the configuration:
<resource-adapter id="wmq.jmsra">
<archive>
wmq.jmsra.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/ivt/IVTCF" enabled="true" use-java-context="true" pool-name="IVTCF">
<config-property name="port">
2414
</config-property>
<config-property name="hostName">
localhost
</config-property>
<config-property name="channel">
SYSTEM.DEF.SVRCONN
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="queueManager">
MB7QMGR
</config-property>
<security>
<application/>
</security>
<validation>
<background-validation>false</background-validation>
</validation>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/ivt/IVTQueue" enabled="true" use-java-context="false" pool-name="ivtQueue">
<config-property name="baseQueueName">
TESTQ
</config-property>
<config-property name="baseQueueManagerName">
MB7QMGR
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
With all configuration in place, I can see in the server logs that connection factory and destination is successfully bounded:
JBAS010401: Bound JCA AdminObject [java:jboss/jms/ivt/IVTQueue] JBAS010401: Bound JCA ConnectionFactory [java:jboss/jms/ivt/IVTCF]
I am able to get this connection factory in my java code but when I am trying to create connection from the factory I am getting below error:
*
17:54:06,233 INFO [stdout] (http-/10.63.78.129:8010-1) Connection factory found !!
17:54:06,233 INFO [stdout] (http-/10.63.78.129:8010-1) Destination queue found !!
17:54:06,385 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.PoolByCri] (http-/10.63.78.129:8010-1) IJ000604: Throwable while attempting to get a new connection: null: com.ibm.mq.connector.DetailedResourceException: MQJCA1011: Failed to allocate a JMS connection., error code: MQJCA1011 An internal error caused an attempt to allocate a connection to fail. See the linked exception for details of the failure.
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:129)
at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:105)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:197)
at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createConnection(ManagedConnectionFactoryImpl.java:434)
at com.ibm.mq.connector.outbound.ManagedConnectionImpl.<init>(ManagedConnectionImpl.java:138)
at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:190)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:781)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:344)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:302)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createManagedJMSConnection(ConnectionFactoryImpl.java:194)
at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnectionInternal(ConnectionFactoryImpl.java:153)
at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:138)
at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:123)
at com.tms.ice.apns.PutMessageToQueueUsingJNDI.putMessage(PutMessageToQueueUsingJNDI.java:31) [classes:]
at com.tms.ice.apns.GenerateAPNSRequest.doPost(GenerateAPNSRequest.java:137) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)
at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSFMQ6312: An exception occurred in the Java(tm) MQI.
The Java(tm) MQI has thrown an exception describing the problem.
See the linked exception for further information.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_51]
at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_51]
at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319) [com.ibm.mq.jmqi.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233) [com.ibm.mq.jmqi.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:180) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6254) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:107) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:378) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:129) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:172)
... 46 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: Error return code received. [1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.remote.api.RemoteFAP.<init>(com.ibm.mq.jmqi.JmqiEnvironment, int)],3=Class.getConstructor0]
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:822) [com.ibm.mq.jmqi.jar:7.5.0.0 - p000-L120604]
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:666) [com.ibm.mq.jmqi.jar:7.5.0.0 - p000-L120604]
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:172) [com.ibm.mqjms.jar:7.5.0.0 - p000-L120604]
... 51 more
Caused by: java.lang.NoSuchMethodException: com.ibm.mq.jmqi.remote.api.RemoteFAP.<init>(com.ibm.mq.jmqi.JmqiEnvironment, int)
at java.lang.Class.getConstructor0(Class.java:2810) [rt.jar:1.7.0_51]
at java.lang.Class.getConstructor(Class.java:1718) [rt.jar:1.7.0_51]
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:728) [com.ibm.mq.jmqi.jar:7.5.0.0 - p000-L120604]
... 53 more
17:54:06,401 INFO [stdout] (http-/10.63.78.129:8010-1) GenerateAPNSRequest.Result for posting message in the queue MQJCA1011: Failed to allocate a JMS connection.
*
I have searched multiple forums and were able to get to related topics but any solution if provided did not worked. No FDC were generated for mqrc 2195 mentioned in the stack trace and even replacing wmq.jmsra jar files from 7.0.1.13 to 7.5.0.0 did not worked.
Request you all to have a look and suggest.
Thanks.
I solved an error like this by revising my code and make sure that every object is closed, also in all the catch structures.
The cause was that the MQ provider accepted a limited number of connections and at some point this pool got filled up. So you will have to close first all the connections to the queue and then rerun the corrected code.
I have RabbitMQ running in cloud foundry and trying to connect from config server running in local, below is what configured in application.yml file
spring
rabbitmq:
host: xxxx
vhost: xxxx
port: 5672
username: xxx
password: xxx
throws below startup exception
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:852) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283) [surefire-junit4-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) [surefire-junit4-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) [surefire-junit4-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) [surefire-junit4-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) [surefire-booter-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) [surefire-booter-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) [surefire-booter-2.18.1.jar:2.18.1]
Caused by: org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:70) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:289) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:506) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:85) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:135) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:71) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1278) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1271) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1247) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitAdmin.declareExchange(RabbitAdmin.java:126) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.declareExchange(RabbitMessageChannelBinder.java:713) ~[spring-cloud-stream-binder-rabbit-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.bindProducer(RabbitMessageChannelBinder.java:617) ~[spring-cloud-stream-binder-rabbit-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder.bindProducer(RabbitMessageChannelBinder.java:111) ~[spring-cloud-stream-binder-rabbit-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.cloud.stream.binding.ChannelBindingService.bindProducer(ChannelBindingService.java:87) ~[spring-cloud-stream-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.cloud.stream.binding.BindableProxyFactory.bindOutputs(BindableProxyFactory.java:266) ~[spring-cloud-stream-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:58) ~[spring-cloud-stream-1.0.0.BUILD-SNAPSHOT.jar:1.0.0.BUILD-SNAPSHOT]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 38 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77) ~[amqp-client-3.5.7.jar:na]
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111) ~[amqp-client-3.5.7.jar:na]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37) ~[amqp-client-3.5.7.jar:na]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367) ~[amqp-client-3.5.7.jar:na]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293) ~[amqp-client-3.5.7.jar:na]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:647) ~[amqp-client-3.5.7.jar:na]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:273) ~[spring-rabbit-1.5.3.RELEASE.jar:na]
below is the dependency in pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
I can connect to the console with the information provided in the application.yml but not sure why it throws TimeoutException, Any input would be really helpful,
spring.rabbitmq.port is for the AMQP client (defaults to 5672), not the management UI. What you have looks like a management UI port. It's not really clear from what you said where your rabbit broker is running, but it's unlikely to be on port 15672. The default is more likely to be correct.