Error when sending e-mail from Keycloak with StartTLS option enabled - smtp

Keycloak run in Kubernetes via helm chart. With disabled SSL and enables StartTLS (it's our mail server requests) there is error:
14:26:54,545 ERROR [stderr] (default task-8) ... 84 more
14:26:54,545 ERROR [stderr] (default task-8) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.validator.Validator.validate(Validator.java:264)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:222)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
14:26:54,545 ERROR [stderr] (default task-8) at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:629)
14:26:54,545 ERROR [stderr] (default task-8) ... 98 more
14:26:54,545 ERROR [stderr] (default task-8) Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
14:26:54,546 ERROR [stderr] (default task-8) at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
14:26:54,546 ERROR [stderr] (default task-8) at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
14:26:54,546 ERROR [stderr] (default task-8) at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
14:26:54,546 ERROR [stderr] (default task-8) at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
14:26:54,546 ERROR [stderr] (default task-8) ... 104 more
14:26:54,547 ERROR [org.keycloak.services.resources.admin.RealmAdminResource] (default task-8) Failed to send email
javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Most probably the reason is, that the Java Virtual Machine (JVM) is not trusting your Mailservers Certificate (maybe self-signed?)
A solution can be to manually create a truststore containing this certificate
see multiple answers about creating a filling a truststore
e.g. How to import a .cer certificate into a java keystore?
This keystore now need to mounted into keycloak container and passed to the JVM as JAVA_OPTS parameter.
-Djavax.net.ssl.trustStore=/loc/in/container/truststore.jks
-Djavax.net.ssl.trustStorePassword=changeit
Depending on the helm chart you are using the solution varies.
E.g. with Codecentric-Keycloak Chart you set the JVM settings here
https://github.com/codecentric/helm-charts/tree/master/charts/keycloak#jvm-settings
and mount the keystore with help of extraVolumeMounts/extraVolumes

Related

Consul HA ACL init fail on OpenShift

I try to install Consul HA to configure my Vault HA on OpenShift platform. I am first using Consul Helm chart to install it and I can successfully install it using some SCC for my client and server serviceAccounts.
Later on, I wanted to deploy consul with ACL init through this helm but I am facing an error.
First installing consul with helm :
helm upgrade -i consul-ha --namespace vault consul/ --set ui.enabled=true --set global.acls.manageSystemACLs=true
Then my pods quickly go into error :
oc get pods
NAME READY STATUS RESTARTS AGE
consul-ha-consul-622vr 0/1 Init:0/1 0 43s
consul-ha-consul-kxj4n 0/1 Init:0/1 0 43s
consul-ha-consul-server-0 0/1 Running 0 43s
consul-ha-consul-server-1 0/1 ContainerCreating 0 43s
consul-ha-consul-server-2 0/1 Pending 0 43s
consul-ha-consul-server-acl-init-8jf44 0/1 Error 0 33s
consul-ha-consul-server-acl-init-cleanup-dg5dk 0/1 ContainerCreating 0 14s
consul-ha-consul-server-acl-init-cleanup-xfq4m 0/1 Error 0 42s
consul-ha-consul-server-acl-init-l86r6 0/1 Error 0 43s
consul-ha-consul-wz4mf 0/1 Init:0/1 0 43s
I get this error on describing acl-init pod :
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned vault/consul-ha-consul-server-acl-init-hrsk2 to compute-1
Warning Failed 2m12s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:46:12Z" level=warning msg="signal: killed"
time="2020-10-05T07:46:12Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:449: container init caused \\\"read init-p: connection reset by peer\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"read init-p: connection reset by peer\""
Warning Failed 2m3s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:46:22Z" level=warning msg="signal: killed"
time="2020-10-05T07:46:22Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:365: sending config to init process caused \\\"write init-p: broken pipe\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:365: sending config to init process caused \"write init-p: broken pipe\""
Warning Failed 114s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:46:31Z" level=fatal msg="join_namespaces:542 nsenter: failed to open /proc/1372777/ns/ipc: No such file or directory"
time="2020-10-05T07:46:31Z" level=fatal msg="nsexec:724 nsenter: failed to sync with child: next state: Invalid argument"
time="2020-10-05T07:46:31Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:319: getting the final child's pid from pipe caused \\\"EOF\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\""
Warning Failed 103s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:46:42Z" level=warning msg="signal: killed"
time="2020-10-05T07:46:42Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:449: container init caused \\\"read init-p: connection reset by peer\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"read init-p: connection reset by peer\""
Warning Failed 94s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:46:51Z" level=warning msg="signal: killed"
time="2020-10-05T07:46:51Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:365: sending config to init process caused \\\"write init-p: broken pipe\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:365: sending config to init process caused \"write init-p: broken pipe\""
Warning Failed 81s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:47:04Z" level=fatal msg="join_namespaces:542 nsenter: failed to open /proc/1376195/ns/ipc: No such file or directory"
time="2020-10-05T07:47:04Z" level=fatal msg="nsexec:724 nsenter: failed to sync with child: next state: Invalid argument"
time="2020-10-05T07:47:04Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:319: getting the final child's pid from pipe caused \\\"EOF\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\""
Warning Failed 73s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:47:12Z" level=fatal msg="join_namespaces:542 nsenter: failed to open /proc/1377778/ns/ipc: No such file or directory"
time="2020-10-05T07:47:12Z" level=fatal msg="nsexec:724 nsenter: failed to sync with child: next state: Invalid argument"
time="2020-10-05T07:47:12Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:319: getting the final child's pid from pipe caused \\\"EOF\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\""
Normal SandboxChanged 62s (x8 over 2m12s) kubelet, compute-1 Pod sandbox changed, it will be killed and re-created.
Warning Failed 62s kubelet, compute-1 Error: container create failed: time="2020-10-05T07:47:23Z" level=warning msg="signal: killed"
time="2020-10-05T07:47:23Z" level=error msg="container_linux.go:349: starting container process caused \"process_linux.go:449: container init caused \\\"read init-p: connection reset by peer\\\"\""
container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"read init-p: connection reset by peer\""
Normal Pulled 56s (x9 over 2m19s) kubelet, compute-1 Container image "hashicorp/consul-k8s:0.18.1" already present on machine
I can't figure out what's going on. Any idea on this ?

Docker container crashes on start: java.net.NoRouteToHostException: No route to host

In recent days, my Docker container (SonarQube) crashes a couple seconds after being started. It seems that it cannot connect the database container anymore. How can I reconnect them together?
MySQL container run command:
docker run -d --name mysql-sonarqube-container \
-e MYSQL_ROOT_PASSWORD=root \
-p 3307:3306 \
-v /etc/mysql:/etc/mysql/conf.d \
mysql:latest
MySQL user creation:
use sonar;
CREATE USER 'sonar'#'DOCKER_BRIDGE_IP_ADDRESS' IDENTIFIED BY 'sonar';
GRANT ALL PRIVILEGES ON *.* TO 'sonar'#'DOCKER_BRIDGE_IP_ADDRESS' WITH GRANT OPTION;
SonarQube container run command:
docker run -d --name sonarqube-container \
--link mysql-sonarqube-container:mysql \
-p 9000:9000 -p 9092:9092 \
-e SONARQUBE_JDBC_USERNAME=sonar \
-e SONARQUBE_JDBC_PASSWORD=sonar \
-e SONARQUBE_JDBC_URL="jdbc:mysql://SERVER_IP_ADDRESS:3307/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" \
-e SONARQUBE_HOST_URL="http://DOCKER_BRIDGE_IP_ADDRESS:9000" \
sonarqube:latest
And here are the Docker logs:
15:31:25.022 [main] WARN org.sonar.application.JdbcSettings - JDBC URL is recommended to have the property 'useConfigs=maxPerformance'
2016.12.05 15:31:25 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2016.12.05 15:31:25 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonarqube/temp -javaagent:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonarqube/temp/sq-process7139915507080636494properties
2016.12.05 15:31:25 INFO es[][o.s.p.ProcessEntryPoint] Starting es
2016.12.05 15:31:25 INFO es[][o.s.s.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2016.12.05 15:31:25 INFO es[][o.elasticsearch.node] [sonarqube] version[2.3.3], pid[21], build[218bdf1/2016-05-17T15:40:04Z]
2016.12.05 15:31:25 INFO es[][o.elasticsearch.node] [sonarqube] initializing ...
2016.12.05 15:31:25 INFO es[][o.e.plugins] [sonarqube] modules [], plugins [], sites []
2016.12.05 15:31:25 INFO es[][o.elasticsearch.env] [sonarqube] using [1] data paths, mounts [[/opt/sonarqube/data (/dev/mapper/centos_rns170lv-root)]], net usable_space [22.4gb], net total_space [33.8gb], spins? [possibly], types [xfs]
2016.12.05 15:31:25 INFO es[][o.elasticsearch.env] [sonarqube] heap size [990.7mb], compressed ordinary object pointers [true]
2016.12.05 15:31:27 INFO es[][o.elasticsearch.node] [sonarqube] initialized
2016.12.05 15:31:27 INFO es[][o.elasticsearch.node] [sonarqube] starting ...
2016.12.05 15:31:27 INFO es[][o.e.transport] [sonarqube] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2016.12.05 15:31:27 INFO es[][o.e.discovery] [sonarqube] sonarqube/IxxWMoHCRhevseLUIhO9tw
2016.12.05 15:31:30 INFO es[][o.e.cluster.service] [sonarqube] new_master {sonarqube}{IxxWMoHCRhevseLUIhO9tw}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube, master=true}, reason: zen-disco-join(elected_as_master, [0] joins received)
2016.12.05 15:31:30 INFO es[][o.elasticsearch.node] [sonarqube] started
2016.12.05 15:31:30 INFO es[][o.e.gateway] [sonarqube] recovered [0] indices into cluster_state
2016.12.05 15:31:30 INFO app[][o.s.p.m.Monitor] Process[es] is up
2016.12.05 15:31:30 INFO app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -Djava.io.tmpdir=/opt/sonarqube/temp -javaagent:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/management-agent.jar -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/mysql/mysql-connector-java-5.1.39.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process614082345862607988properties
2016.12.05 15:31:31 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2016.12.05 15:31:31 INFO web[][o.s.s.a.TomcatContexts] Webapp directory: /opt/sonarqube/web
2016.12.05 15:31:31 INFO web[][o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.12.05 15:31:31 INFO web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2016.12.05 15:31:31 INFO web[][o.e.plugins] [Obituary] modules [], plugins [], sites []
2016.12.05 15:31:32 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2016.12.05 15:31:32 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.1 / dc148a71a1c184ccad588b66251980c994879dff
2016.12.05 15:31:32 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:mysql://SERVER_IP_ADDRESS:3307/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
2016.12.05 15:31:33 ERROR web[][o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.web.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:104) ~[sonar-db-6.1.jar:na]
...
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
...
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:102) ~[sonar-db-6.1.jar:na]
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_102]
...
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[commons-dbcp-1.4.jar:1.4]
...
Caused by: java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_102]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_102]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_102]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_102]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_102]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_102]
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211) ~[mysql-connector-java-5.1.39.jar:5.1.39]
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300) ~[mysql-connector-java-5.1.39.jar:5.1.39]
...
2016.12.05 15:31:33 ERROR web[][o.a.c.c.StandardContext] One or more listeners failed to start. Full details will be found in the appropriate container log file
2016.12.05 15:31:33 ERROR web[][o.a.c.c.StandardContext] Context [] startup failed due to previous errors
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][[timer]]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Thread.sleep(Native Method)
org.elasticsearch.threadpool.ThreadPool$EstimatedTimeThread.run(ThreadPool.java:719)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][scheduler][T#1]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.lang.Thread.run(Thread.java:745)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#1]{New I/O worker #1}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#2]{New I/O worker #2}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#3]{New I/O worker #3}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#4]{New I/O worker #4}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#5]{New I/O worker #5}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#6]{New I/O worker #6}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#7]{New I/O worker #7}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_worker][T#8]{New I/O worker #8}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_boss][T#1]{New I/O boss #9}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][transport_client_timer][T#1]{Hashed wheel timer #1}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Thread.sleep(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[Obituary][generic][T#1]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
2016.12.05 15:31:33 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
2016.12.05 15:31:33 INFO web[][o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.12.05 15:31:33 INFO web[][o.s.s.a.TomcatAccessLog] Web server is started
2016.12.05 15:31:33 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2016.12.05 15:31:33 WARN web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.IllegalStateException: Webapp did not start
at org.sonar.server.app.EmbeddedTomcat.isUp(EmbeddedTomcat.java:84) ~[sonar-server-6.1.jar:na]
2016.12.05 15:31:33 INFO web[][o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.12.05 15:31:34 INFO web[][o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.12.05 15:31:34 INFO web[][o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.12.05 15:31:34 INFO web[][o.s.s.a.TomcatAccessLog] Web server is stopped
2016.12.05 15:31:35 INFO app[][o.s.p.m.Monitor] Process[es] is stopping
2016.12.05 15:31:35 INFO es[][o.s.p.StopWatcher] Stopping process
2016.12.05 15:31:35 INFO es[][o.elasticsearch.node] [sonarqube] stopping
2016.12.05 15:31:35 INFO es[][o.elasticsearch.node] [sonarqube] stopped
2016.12.05 15:31:35 INFO es[][o.elasticsearch.node] [sonarqube] closing
2016.12.05 15:31:35 INFO es[][o.elasticsearch.node] [sonarqube] closed
2016.12.05 15:31:36 INFO app[][o.s.p.m.Monitor] Process[es] is stopped
Even if I create whole new containers from scratch, the SonarQube container crashes.
An hypothesis of mine is that my SERVER_IP_ADDRESS and my BRIDGE_IP_ADDRESSES are not proxy-bypassed, but I did not succeed by modifying the $no_proxy environment variable.
For the env property SONARQUBE_JDBC_URL, instead of SERVER_IP_ADDRESS, use alias name of the linked container( in your case it is mysql). So, your command would be
docker run -d --name sonarqube-container \
--link mysql-sonarqube-container:mysql \
-p 9000:9000 -p 9092:9092 \
-e SONARQUBE_JDBC_USERNAME=sonar \
-e SONARQUBE_JDBC_PASSWORD=sonar \
-e SONARQUBE_JDBC_URL="jdbc:mysql://mysql:3307/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" \
-e SONARQUBE_HOST_URL="http://DOCKER_BRIDGE_IP_ADDRESS:9000" \
sonarqube:latest
I finally used a PostgreSQL database instead of a MySQL database and it worked.
I used docker-compose with a yml file that describes both services in the same network: the database and Sonarqube.
For other containers encountering the "No route to host" problem, I had to use the DOCKER_BRIDGE_IP_ADDRESS within application settings instead of the SERVER_IP_ADDRESS (which was not recognised from inside the containers).

Unable to execute selenium tests on chrome browser

Local:-
I am trying to run selenium tests on chrome browser.
Currently, another chrome browser is running and then running a test on chrome browser by opening new profile and getting the following error:-
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'lima', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
at
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'test', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 42 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 43 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 56 more
Chrome driver configuration:-
ChromeOptions options = new ChromeOptions();
URL resource = getClass().getClassLoader().getResource("chromedriver");
setPermissiontoFile(resource);
System.setProperty("webdriver.chrome.driver",
Paths.get(resource.toURI()).toString());
options.addArguments("start-maximized");
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(caps);
If I close the existing running chrome browser and then I run the selenium tests on chrome browser ,it works.
Jenkins:-
When I try to running on jenkins. I am getting the following error:-
Exception org.openqa.selenium.remote.UnreachableBrowserException
Message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14' System info: host: 'jenkins, ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85' Driver info: driver.version: ChromeDriver
Stacktrace:
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'jenkins-sandbox.qa.us-west-2.aws.vrv', ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 42 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 43 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 56 more
What is the problem here, Can anyone help me to solve this ?
I am able run selenium tests on chrome browser with already existing chrome browser running. I did upgrading selenium-java from 2.48.0 to 2.48.1
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.1</version>
</dependency>
Refer here https://github.com/seleniumhq/selenium/issues/1123

Facing an issue while executing Sqoop import command in Hadoop 2.6.0

I am using MAC Osx for Hadoop Stack and using MySQL as the database for it.I am trying to execute a Sqoop import command:
sqoop import --connect jdbc:mysql://127.0.0.1/emp --table employee --username root --password reality --m 1 --target-dir /sqoop_import
But I am facing below-mentioned issue while executing it. Even in /etc/hosts, localhost is at 127.0.0.1.host file screenshot. I have tried pinging localhost and it works but the error of host is down, still prevails. Please help.
2016-02-06 17:42:38,267 INFO [main] mapreduce.Job: Job job_1454152643692_0010 failed with state FAILED due to: Application application_1454152643692_0010 failed 2 times due to Error launching appattempt_1454152643692_0010_000002. Got exception: java.io.IOException: Failed on local exception: java.net.SocketException: Host is down; Host Details : local host is: "Mohits-MacBook-Pro.local/192.168.0.103"; destination host is: "192.168.0.105":38183;
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:772)
at org.apache.hadoop.ipc.Client.call(Client.java:1472)
at org.apache.hadoop.ipc.Client.call(Client.java:1399)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232)
at com.sun.proxy.$Proxy32.startContainers(Unknown Source)
at org.apache.hadoop.yarn.api.impl.pb.client.ContainerManagementProtocolPBClientImpl.startContainers(ContainerManagementProtocolPBClientImpl.java:96)
at org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncher.launch(AMLauncher.java:119)
at org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncher.run(AMLauncher.java:254)
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)
Caused by: java.net.SocketException: Host is down
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:192)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:530)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:494)
at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:607)
at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:705)
at org.apache.hadoop.ipc.Client$Connection.access$2800(Client.java:368)
at org.apache.hadoop.ipc.Client.getConnection(Client.java:1521)
at org.apache.hadoop.ipc.Client.call(Client.java:1438)
... 9 more
. Failing the application.
2016-02-06 17:42:38,304 INFO [main] mapreduce.Job: Counters: 0
2016-02-06 17:42:38,321 WARN [main] mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
2016-02-06 17:42:38,326 INFO [main] mapreduce.ImportJobBase: Transferred 0 bytes in 125.7138 seconds (0 bytes/sec)
2016-02-06 17:42:38,349 WARN [main] mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
2016-02-06 17:42:38,350 INFO [main] mapreduce.ImportJobBase: Retrieved 0 records.
2016-02-06 17:42:38,351 ERROR [main] tool.ImportTool: Error during import: Import job failed!
I see that you are having network issues. From the log above it says that local host translates to Mohits-MacBook-Pro.local/192.168.0.103 in you unix system and destination which it is trying to connect is "192.168.0.105":38183. Please go to unix system and see /etc/hosts file and make sure you change localhost to 127.0.0.1.

JDBC connection is not working in tomcat even after moving mysql-connector-java-5.1.25-bin.jar

I am using Tomcat installed on Cent OS for creating JSP pages, but JDBC is not working.
I also moved mysql-connector-java-5.1.25-bin.jar into lib directory. The error in page shows:
Type Exception report
message javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.androidtest.db_005flogin.reg_jsp._jspService(reg_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:190)
org.apache.jsp.androidtest.db_005flogin.reg_jsp._jspService(reg_jsp.java:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)