I'm trying to run a vert.x java app inside a docker container. The app connects to a zookeeper instance running on another host. Connectivity to the zookeeper instance has been tested from the host and container. The app runs fine when I run it directly on the host. However, when I try to run the jar file inside the container it throws an error stating the following:
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
2018-01-15 11:05:15.126 INFO 7 --- [ main] c.b.vertxdemo.VertxdemoApplication : Starting VertxdemoApplication v0.0.1-SNAPSHOT on de43fb40ccba with PID 7 (/tradingengine/vertxdemo-0.0.1-SNAPSHOT.jar started by root in /tradingengine)
2018-01-15 11:05:15.131 INFO 7 --- [ main] c.b.vertxdemo.VertxdemoApplication : No active profile set, falling back to default profiles: default
2018-01-15 11:05:15.223 INFO 7 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#4b9af9a9: startup date [Mon Jan 15 11:05:15 GMT 2018]; root of context hierarchy
Vertx Options PORT - 0
Vertx Options PUBLICPORT - -1
2018-01-15 11:05:15.992 INFO 7 --- [worker-thread-0] i.v.s.c.z.ZookeeperClusterManager : Zookeeper hosts set to 10.1.0.199:2181
2018-01-15 11:05:16.131 INFO 7 --- [worker-thread-0] o.a.c.f.imps.CuratorFrameworkImpl : Starting
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:host.name=de43fb40ccba
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.version=1.8.0_151
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.vendor=Oracle Corporation
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.home=/usr/lib/jvm/java-1.8-openjdk/jre
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.class.path=vertxdemo-0.0.1-SNAPSHOT.jar
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.library.path=/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=/tmp
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler=<NA>
2018-01-15 11:05:16.151 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Linux
2018-01-15 11:05:16.152 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=amd64
2018-01-15 11:05:16.152 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:os.version=3.10.0-693.5.2.el7.x86_64
2018-01-15 11:05:16.152 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:user.name=root
2018-01-15 11:05:16.152 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:user.home=/root
2018-01-15 11:05:16.152 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=/tradingengine
2018-01-15 11:05:16.153 INFO 7 --- [worker-thread-0] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=10.1.0.199:2181 sessionTimeout=20000 watcher=org.apache.curator.ConnectionState#34191123
2018-01-15 11:05:16.184 INFO 7 --- [0.1.0.199:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server 10.1.0.199/10.1.0.199:2181. Will not attempt to authenticate using SASL (unknown error)
2018-01-15 11:05:16.201 INFO 7 --- [0.1.0.199:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established to 10.1.0.199/10.1.0.199:2181, initiating session
2018-01-15 11:05:16.220 INFO 7 --- [0.1.0.199:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server 10.1.0.199/10.1.0.199:2181, sessionid = 0x160e3de5a400082, negotiated timeout = 20000
2018-01-15 11:05:16.230 INFO 7 --- [d-0-EventThread] o.a.c.f.state.ConnectionStateManager : State change: CONNECTED
2018-01-15 11:05:16.353 INFO 7 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-15 11:05:16.371 INFO 7 --- [ main] c.b.vertxdemo.VertxdemoApplication : Started VertxdemoApplication in 1.622 seconds (JVM running for 2.123)
2018-01-15 11:05:17.020 ERROR 7 --- [ntloop-thread-0] io.vertx.core.impl.VertxImpl : Failed to start event bus
java.net.BindException: Address not available
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_151]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_151]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_151]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[na:1.8.0_151]
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:558) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1283) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:501) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:486) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:989) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:254) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:365) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[netty-common-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) ~[netty-transport-4.1.15.Final.jar!/:4.1.15.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[netty-common-4.1.15.Final.jar!/:4.1.15.Final]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]
Vertx Failed
Here is my code that I am trying to run:
package com.myapp.vertxdemo;
import java.util.UUID;
import javax.annotation.PostConstruct;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.json.JsonObject;
#SpringBootApplication
#ComponentScan(basePackages = "com.myapp")
#EnableAutoConfiguration
public class VertxdemoApplication implements CommandLineRunner {
#Value("${zookeeper.host}")
String zookeeperHost;
#Value("${zookeeper.cluster.host}")
String zookeeperClusterHost;
#Value("${zookeeper.cluster.port}")
int zookeeperClusterPort;
#Autowired
DemoVerticle demovertical;
public static void main(String[] args) {
SpringApplication.run(VertxdemoApplication.class, args);
}
#Override
public void run(String... arg0) throws Exception {
// TODO Auto-generated method stub
}
#PostConstruct
private void Deploy() {
JsonObject zkConfig = new JsonObject();
zkConfig.put("zookeeperHosts", zookeeperHost);
zkConfig.put("rootPath", "io.vertxdemo1");
zkConfig.put("retry", new JsonObject().put("initialSleepTime", 3000).put("maxTimes", 3));
ClusterManager mgr = new ZookeeperClusterManager(zkConfig);
VertxOptions options = new VertxOptions()
.setClustered(true)
.setClusterHost(zookeeperClusterHost)
//.setClusterPort(zookeeperClusterPort)
.setClusterManager(mgr);
System.out.println("Vertx Options PORT - " + options.getClusterPort());
System.out.println("Vertx Options PUBLICPORT - " + options.getClusterPublicPort());
String guid = UUID.randomUUID().toString();
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
vertx.deployVerticle(demovertical);
vertx.setPeriodic(5000, id -> {
vertx.eventBus().publish("PRICE_FEED", guid);
});
System.out.println("Vertx Deployed");
} else {
System.out.println("Vertx Failed");
}
});
}
}
when you run the docker instance
docker run --network host
The problem is the interface (and the address) you are trying to bind to is not available inside the docker (inside the container it's usually 172.17.x.x)
when you specify the the host type networking (read here for more info https://docs.docker.com/network/#scope-of-this-topic) the container can use the ip of the host
Your exception indicates that binding fails, I'm pretty sure the values you set for your zookeeper config are either not set or invalid.
Debug the values of ${zookeeper.host}, ${zookeeper.cluster.host} and ${zookeeper.cluster.port}and if they're not set configure them properly
Related
I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect timed out; nested exception is java.net.SocketTimeoutException: Connect timed out
2021-11-24 10:17:30.642 INFO [,,,] 7872 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.2.RELEASE)
2021-11-24 10:17:31.942 INFO [service,,,] 7872 --- [ restartedMain] ServiceApplication : No active profile set, falling back to default profiles: default
2021-11-24 10:17:35.956 INFO [service,,,] 7872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2021-11-24 10:17:36.883 INFO [service,,,] 7872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 901ms. Found 27 JPA repository interfaces.
2021-11-24 10:17:38.737 INFO [service,,,] 7872 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=f090e4ad-27c8-34fa-89ba-eeeccacd1fd9
2021-11-24 10:17:42.104 INFO [service,,,] 7872 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9194 (http)
2021-11-24 10:17:42.149 INFO [service,,,] 7872 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-24 10:17:42.150 INFO [service,,,] 7872 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2021-11-24 10:17:42.661 INFO [service,,,] 7872 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-24 10:17:42.662 INFO [service,,,] 7872 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 10646 ms
2021-11-24 10:17:43.074 INFO [service,,,] 7872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-11-24 10:17:43.494 INFO [service,,,] 7872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-11-24 10:17:43.517 INFO [service,,,] 7872 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:postgresql://localhost:5432/codeis'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/Hp/.m2/repository/org/springframework/spring-core/5.2.8.RELEASE/spring-core-5.2.8.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-11-24 10:17:46.238 WARN [school-erp-service,,,] 7872 --- [ restartedMain] o.s.c.s.zipkin2.ZipkinAutoConfiguration : Check result of the [org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender#41a2805a] contains an error [CheckResult{ok=false, error=org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect timed out; nested exception is java.net.SocketTimeoutException: Connect timed out}]
What mistake I make?
I am not using the Zipkin server.
Why throw such type of error how to resolve it?
I am using zuul API gateway.
Check your build dependency tree, there must be an entry for spring-cloud-starter-sleuth. In case you are planning not to use it, then remove it.
The firewall is not turned off
$ systemctl stop firewalld
I have set up DB2 as NoSQL storage (following https://www.ibm.com/developerworks/data/library/techarticle/dm-1306nosqlforjson4/index.html). The premise by IBM is that any application talking to MongoDB can switch to DB2 if we add the Wire Listener in between.
The layout is: Client app ----> Wire listener ----> DB2
Wire listener is started with the following command:
wlpListener -start -mongoPort 27017 -userid <user> -password <password> -dbName jsondb -logPath c:/temp/logs -host 10.0.0.6:50000
The solution works fine with a simple Python client:
from pymongo import MongoClient
client = MongoClient('10.0.0.6', 27017)
database = client['jsondb']
coll = database.mycollection
coll.insert_one({"name":"Jerry","age":5})
print(coll.find_one({"name": "Jerry"}))
However, when I use a Spring Boot application designed for MongoDB (using Spring Data JPA) I get the following exception during initialization:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.2)
2021-02-14 11:13:28.629 INFO 11820 --- [ main] c.i.a.n.generator.gen.MainGenerator : Starting MainGenerator using Java 1.8.0 on SP-NIT09160021 with PID 11820 (C:\Users\user\Documents\Workspaces\nosql-poc-db2-wirednosql\target\classes started by user in C:\Users\user\Documents\Workspaces\nosql-poc-db2-wirednosql)
2021-02-14 11:13:28.635 INFO 11820 --- [ main] c.i.a.n.generator.gen.MainGenerator : No active profile set, falling back to default profiles: default
2021-02-14 11:13:29.375 INFO 11820 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2021-02-14 11:13:29.450 INFO 11820 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 69 ms. Found 3 MongoDB repository interfaces.
2021-02-14 11:13:30.006 INFO 11820 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-02-14 11:13:30.016 INFO 11820 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-14 11:13:30.016 INFO 11820 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-02-14 11:13:30.132 INFO 11820 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-14 11:13:30.132 INFO 11820 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1414 ms
2021-02-14 11:13:30.304 INFO 11820 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[10.0.0.6:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2021-02-14 11:13:30.380 INFO 11820 --- [-10.0.0.6:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 10.0.0.6:27017
com.mongodb.MongoException: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type DOUBLE
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:157) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.1.1.jar:na]
at java.lang.Thread.run(Thread.java:785) [na:1.8.0-internal]
Caused by: org.bson.BsonInvalidOperationException: Value expected to be of type INT32 is of unexpected type DOUBLE
at org.bson.BsonValue.throwIfInvalidType(BsonValue.java:419) ~[bson-4.1.1.jar:na]
at org.bson.BsonValue.asInt32(BsonValue.java:94) ~[bson-4.1.1.jar:na]
at org.bson.BsonDocument.getInt32(BsonDocument.java:555) ~[bson-4.1.1.jar:na]
at com.mongodb.internal.connection.DescriptionHelper.getMaxWireVersion(DescriptionHelper.java:104) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.DescriptionHelper.createConnectionDescription(DescriptionHelper.java:63) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:117) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62) ~[mongodb-driver-core-4.1.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:144) ~[mongodb-driver-core-4.1.1.jar:na]
... 3 common frames omitted
As if there was an incompatibility between the Mongo driver and what the Wire Listener expects.
Versions:
Host system: Windows 10
Database server: DB2/LINUXX8664 11.5.5.0 (using the Docker container from https://hub.docker.com/r/ibmcom/db2 )
IBM DB2 NoSQL WireListener 1.4.0.0 build 1.4.118
IBM DB2 NoSQL JSON 1.1.0.0 build 1.4.249
Java application (1.8 jdk), Spring Boot 2.4.2, [Mongodb.bson, mongodb-driver-core, mongodb-driver-sync] 4.1.1.
This is a bug in the Wire Listener.
The MongoDB driver expects an Int:
private static int getMinWireVersion(final BsonDocument isMasterResult) {
return isMasterResult.getInt32("minWireVersion", new BsonInt32(getDefaultMinWireVersion())).getValue();
}
private static int getMaxWireVersion(final BsonDocument isMasterResult) {
return isMasterResult.getInt32("maxWireVersion", new BsonInt32(getDefaultMaxWireVersion())).getValue();
}
But the Wire Listener is reporting a Double.
I would suggest to get latest IBM DB2 NoSQL WireListener from IBM Support that contains fix of this issue.
If you have no issue in downloading quick fix from github, you can download and use this file: https://github.com/ibmdb/db2drivers/blob/main/db2NoSQLWireListener1.4.119.zip
it contains fix of this issue. Thanks.
i need help with the options for remote debug on intell J IDE, i have successfully connection with my remote host provided by Digital Oceans VM, but i cant start debugging from my IDE.
Here is an image that shows the correct connection on local machine (Ubuntu 18.04):
previously i set the VM execution of my Spring Boot on remote host (Ubuntu 18.04):
.../target# java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar balak-cliente-rest-0.0.1-SNAPSHOT.jar
Listening for transport dt_socket at address: 5005
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
2019-09-22 18:22:55.904 INFO 11937 --- [ main] c.t.s.app.ClienteRestApplication : Starting ClienteRestApplication v0.0.1-SNAPSHOT on desarrollosfelipeinostroza with PID 11937 (/desarrollos/balak/tudicom-ws-rest/target/balak-cliente-rest-0.0.1-SNAPSHOT.jar started by root in /desarrollos/balak/tudicom-ws-rest/target)
2019-09-22 18:22:55.922 INFO 11937 --- [ main] c.t.s.app.ClienteRestApplication : No active profile set, falling back to default profiles: default
2019-09-22 18:23:02.905 INFO 11937 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$5e2153d6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-22 18:23:03.531 INFO 11937 --- [ main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2019-09-22 18:23:04.897 INFO 11937 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 7171 (http)
2019-09-22 18:23:05.135 INFO 11937 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-22 18:23:05.137 INFO 11937 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-09-22 18:23:05.614 INFO 11937 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-22 18:23:05.618 INFO 11937 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 9280 ms
2019-09-22 18:23:07.371 INFO 11937 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-22 18:23:08.479 WARN 11937 --- [ main] o.s.x.transform.TransformerFactoryUtils : http://javax.xml.XMLConstants/property/accessExternalDTD property not supported by org.apache.xalan.processor.TransformerFactoryImpl
2019-09-22 18:23:08.479 WARN 11937 --- [ main] o.s.x.transform.TransformerFactoryUtils : http://javax.xml.XMLConstants/property/accessExternalStylesheet property not supported by org.apache.xalan.processor.TransformerFactoryImpl
2019-09-22 18:23:08.844 INFO 11937 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 7171 (http) with context path ''
2019-09-22 18:23:08.853 INFO 11937 --- [ main] c.t.s.app.ClienteRestApplication : Started ClienteRestApplication in 16.567 seconds (JVM running for 18.499)
Then i send the request from my Postman to the endpoint for start debugging but nothing happens with the app on remote server neither in my IDE.
I test without the VM arguments for transport to verify the call from postman and the app responds, but when i put those arguments postman cant arrived with his request.
Important things to know:
Local Machine run openjdk version "1.8.0_222" (Ubuntu 18.04)
Options for remote debbug
On Debugger menu this are my options (local m.):
Remote Machine openjdk version "11.0.4" (Ubuntu 18.04)
UPDATE ADDING MORE INFORMATION:
Java debbug from remote host https://pastebin.com/nn13rU0J
Java debug from Local host https://pastebin.com/gRBZaKET
Log through IDE (IntellJ) with options activated (-Didea.debugger.trace=ALL) https://pastebin.com/mRtYDf2d
On my Firewall settings from Digital Ocean VM
I Solved the issue with adding more RULES to my VM on Network Section:
HTTP (80) for listen from HTTP request from SOAP UI
ICMP for ping stuff
Custom Open port (7171 in my case) because spring boot controllers are configured on those ports, but i don't think that is very useful because with 80 port open is enough.
Custom Open port (5005 in my case) for connection between IntellJ and remote host.
In my IDE (intellJ) on right-side section on Maven slap, i mark clean & install options because i need to be sure that is the same code version that i have on my local and remote host, then from my local target folder i took my .jar and put on the remote host, then i ran that .jar with the commands and those arguments and yea! when i send the request to the remote host on my local IDE arrived and the break point was activated.
thanks to the community, see you!
I have a spring boot application , where is deployed on multiple nodes.
I want to write a mongo listener inside my spring boot application to do this, as I listen to db events and burst my inmemory cache.
The problem is when I write a listener as below, my tomcat startup does not happen at all, only event listener starts:
#Component
public class MongoListener {
#PostConstruct
public void listenProduct() {
MongoClient mongoClient = new MongoClient(new MongoClientURI("mongodb://localhost:27017"));
MongoDatabase database = mongoClient.getDatabase("test");
MongoCollection<Document> collection = database.getCollection("products");
Block<ChangeStreamDocument<Document>> printBlock = new Block<ChangeStreamDocument<Document>>() {
#Override
public void apply(final ChangeStreamDocument<Document> changeStreamDocument) {
System.out.println(" primary key is : " + changeStreamDocument.getDocumentKey() + " operation name:"
+ changeStreamDocument.getOperationType() + "change document" + changeStreamDocument);
}
};
collection
.watch(Arrays.asList(Aggregates
.match(Filters.in("operationType", Arrays.asList("update","delete")))))
.fullDocument(FullDocument.UPDATE_LOOKUP).forEach(printBlock);
}
}
If I comment out #Component annotation then my tomcat starts up properly.
How do I ensure my tomcat is started as well as my listener?
Below are my tomcat logs, notice there are no errors , it just doesnt move forward after listener starts
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.13.RELEASE)
[2019-04-22T20:35:28:660Z] INFO --- [main] com.MyProject : Starting MyProject on abclocal with PID 87098 (/Users/abclocal/MyProject/target/classes started by abc in /Users/abclocal/MyProject)
[2019-04-22T20:35:28:662Z] DEBUG --- [main] com.MyProject : Running with Spring Boot v1.5.13.RELEASE, Spring v4.3.17.RELEASE
[2019-04-22T20:35:28:663Z] INFO --- [main] com.MyProject : The following profiles are active: dev
[2019-04-22T20:35:28:711Z] INFO --- [main] o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#70b0b186: startup date [Mon Apr 22 20:35:28 IST 2019]; root of context hierarchy
[2019-04-22T20:35:29:518Z] INFO --- [main] o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$2024e1d6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[2019-04-22T20:35:29:951Z] INFO --- [main] o.s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
[2019-04-22T20:35:29:976Z] INFO --- [main] o.a.catalina.core.StandardService : Starting service [Tomcat]
[2019-04-22T20:35:29:977Z] INFO --- [main] o.a.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.31
[2019-04-22T20:35:30:073Z] INFO --- [localhost-startStop-1] o.a.c.c.C.[.[localhost].[/v1] : Initializing Spring embedded WebApplicationContext
[2019-04-22T20:35:30:073Z] INFO --- [localhost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1365 ms
[2019-04-22T20:35:30:230Z] INFO --- [localhost-startStop-1] o.s.b.w.s.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
[2019-04-22T20:35:30:234Z] INFO --- [localhost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
[2019-04-22T20:35:30:235Z] INFO --- [localhost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
[2019-04-22T20:35:30:235Z] INFO --- [localhost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
[2019-04-22T20:35:30:235Z] INFO --- [localhost-startStop-1] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
[2019-04-22T20:35:30:771Z] INFO --- [main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
[2019-04-22T20:35:30:892Z] INFO --- [cluster-ClusterId{value='5cbdd83a72f7790491c14c9c', description='null'}-127.0.0.1:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:26}] to 127.0.0.1:27017
[2019-04-22T20:35:30:897Z] INFO --- [cluster-ClusterId{value='5cbdd83a72f7790491c14c9c', description='null'}-127.0.0.1:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=127.0.0.1:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 6]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=3905086, setName='rs0', canonicalAddress=localhost:27017, hosts=[localhost:27017], passives=[], arbiters=[], primary='localhost:27017', tagSet=TagSet{[]}, electionId=7fffffff0000000000000003, setVersion=1, lastWriteDate=Mon Apr 22 20:35:24 IST 2019, lastUpdateTimeNanos=45738116405786}
[2019-04-22T20:35:31:262Z] INFO --- [main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
[2019-04-22T20:35:31:268Z] INFO --- [cluster-ClusterId{value='5cbdd83b72f7790491c14c9d', description='null'}-localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:27}] to localhost:27017
[2019-04-22T20:35:31:270Z] INFO --- [cluster-ClusterId{value='5cbdd83b72f7790491c14c9d', description='null'}-localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 0, 6]}, minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=1316621, setName='rs0', canonicalAddress=localhost:27017, hosts=[localhost:27017], passives=[], arbiters=[], primary='localhost:27017', tagSet=TagSet{[]}, electionId=7fffffff0000000000000003, setVersion=1, lastWriteDate=Mon Apr 22 20:35:24 IST 2019, lastUpdateTimeNanos=45738489844647}
[2019-04-22T20:35:31:324Z] INFO --- [main] org.mongodb.driver.connection : Opened connection [connectionId{localValue:3, serverValue:28}] to localhost:27017
I'm trying to get working the SOAP web consumer example given in spring doc
spring doc
However, I keep getting the following when I try to run the Applicaiton class as Spring Boot App.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2016-10-14 10:58:08.193 INFO 4496 --- [ main] hello.Application : Starting Application on bumblebee with PID 4496 (C:\Users\menuka\workspace\monkey-api-netbeans\gs-consuming-web-service-complete\target\classes started by menuka in C:\Users\menuka\workspace\monkey-api-netbeans\gs-consuming-web-service-complete)
2016-10-14 10:58:08.196 INFO 4496 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2016-10-14 10:58:08.244 INFO 4496 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#37918c79: startup date [Fri Oct 14 10:58:08 PDT 2016]; root of context hierarchy
2016-10-14 10:58:08.808 INFO 4496 --- [ main] o.s.oxm.jaxb.Jaxb2Marshaller : Creating JAXBContext with context path [hello.wsdl]
2016-10-14 10:58:08.900 INFO 4496 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
2016-10-14 10:58:08.902 DEBUG 4496 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl]
2016-10-14 10:58:09.067 INFO 4496 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-10-14 10:58:09.076 INFO 4496 --- [ main] hello.WeatherClient : Requesting forecast for 94304
2016-10-14 10:58:09.083 DEBUG 4496 --- [ main] o.s.ws.client.core.WebServiceTemplate : Opening [org.springframework.ws.transport.http.HttpUrlConnection#2fc6f97f] to [http://wsf.cdyne.com/WeatherWS/Weather.asmx]
2016-10-14 10:58:09.155 DEBUG 4496 --- [ main] o.s.ws.client.MessageTracing.sent : Sent request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.633 DEBUG 4496 --- [ main] o.s.ws.client.MessageTracing.received : Received response [SaajSoapMessage {http://schemas.xmlsoap.org/soap/envelope/}Fault] for request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.633 DEBUG 4496 --- [ main] o.s.ws.client.core.WebServiceTemplate : Received Fault message for request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.637 INFO 4496 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2016-10-14 10:58:21.643 ERROR 4496 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at hello.Application.main(Application.java:15) [classes/:na]
Caused by: org.springframework.ws.soap.client.SoapFaultClientException: Server was unable to process request. ---> Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at hello.WeatherClient.getCityForecastByZip(WeatherClient.java:29) ~[classes/:na]
at hello.Application.lambda$lookup$0(Application.java:26) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
... 6 common frames omitted
2016-10-14 10:58:21.644 INFO 4496 --- [ main] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#37918c79: startup date [Fri Oct 14 10:58:08 PDT 2016]; root of context hierarchy
2016-10-14 10:58:21.646 INFO 4496 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
What is going on here? Can anybody advise here me?
This SOAP action is not available at the moment.
You can try it yourself on a browser: http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityForecastByZIP
If you enter 94304 and hit "Invoke" you get error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)