eventuate-examples / eventuate-examples-java-customers-and-orders

Java version of the Customers and Orders event sourcing example from my presentations
391 stars 204 forks source link

orders-service is giving tcp socket rejection during gradle build #23

Open Kirthana14 opened 6 years ago

Kirthana14 commented 6 years ago

gradle build of orders-service is giving the tcp socket rejection error.

Error

Creating ordersservice_customercommandside_1 ... done Will use 172.17.0.1 (network bridge) as host of customercommandside Probing TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused)) Waiting for TCP socket on 172.17.0.1:8081 of service 'customercommandside_1' (Connection refused (Connection refused))

cer commented 6 years ago

It does take several attempts for the service to startup and accept connections. However, if it never works then two things to check:

  1. Is the docker container customercommandside_1 running? What does docker ps -a how? What is the docker logs of that container?

  2. If there container is running/listening then it could be a networking configuration problem. Please describe your environment; docker version, windows or mac etc? There is code in the Docker plugin - see https://github.com/avast/gradle-docker-compose-plugin/blob/master/src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy#L111 that is trying to figure out how to access your service?

Also, more generally: what have you set DOCKER_HOST_IP to? Try running https://github.com/eventuate-local-docker-images/eventuateio-docker-networking-diagnostics to verify

Kirthana14 commented 6 years ago

Actually not all the services are up. Only kafka, zookeeper, mysql, cdc-service, mongodb are up. Remaining services are up for few seconds and then they are down.

Docker Version:

Docker version 17.12.1-ce, build 7390fc6

OS:

Ubuntu

HOST_IP:

I set the DOCKER_HOST_IP with the IP address of the system

docker ps -a:

__70842f71b74f eventuateexamplesjavacustomersandorders_customercommandside "/bin/sh -c 'java ${…" 11 minutes ago Exited (1) 10 minutes ago eventuateexamplesjavacustomersandorders_customercommandside1_

When I ran docker ps -a I got the above statement for the service customercommanside with it's previous container id(before it got down).

cer commented 6 years ago

Thanks for the information

I think the problem is that the build requires has certain requirements for command line options and for environment variables.

Specifically, if you want to build the Eventuate Local version then you need the following:

  1. ./gradlew -P eventuateDriver=local ..
  2. You also need to set certain environment variables:

The various build-and-test-all-...sh script specify these options.

Kirthana14 commented 6 years ago

Actually the main issue is that all the services are not up.Only kafka, zookeeper, mysql, cdc-service, mongodb are up. Remaining services are up for few seconds and then they are down even after exporting the environment variables. issue1

Kirthana14 commented 6 years ago

Can the possible reason for service down be the bean datasource issue?

Error in customer service using container-id:


APPLICATION FAILED TO START


Description:

Parameter 1 of method eventuateJdbcAccess in io.eventuate.local.java.jdbckafkastore.EventuateLocalConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.

Any possible solution for the above error?

cer commented 6 years ago

As noted above, you need to set certain parameters for gradlew build to work correctly.q I suspect that because those are set the services are built incorrectly and won't start.

Let's take a step back. What are you trying to accomplish exactly? For example, if you want to just build and run the services without running the tests then use gradlew assemble as described in the README.

cer commented 6 years ago

A few more questions/requests

Kirthana14 commented 6 years ago

Actually first I wanted to build and run the application using eventuate locale I ran ./gradlew assemble -P eventuateDriver=local Build was successful.

export DOCKER_HOST_IP=Ip address of the system

docker-compose -f docker-compose-eventuate-local.yml up -d All the 8 services were up and then after few seconds 3 services went down.

Then I forcefully attached the container to docker using docker attach container id then it lead to bean datasource error.

Yes, pull is the latest one. No changes were made locally.

Yesterday I received my API ID and API SECRET. Even I tried to build the application in SaaS platform but the same issue continued.

cer commented 6 years ago

It's possible that the the problem is that the images are not getting rebuild: Try running one of the following:

BTW docker-compose-eventuate-local.yml isn't present in the very latest version of the project. Its been replaced by docker-compose-eventuate-local-mysql.yml

Kirthana14 commented 6 years ago

docker-compose -f docker-compose-eventuate-local.yml build Gave Build success. docker-compose -f docker-compose-eventuate-local.yml up -d --build Made the services up for few seconds and brought down the customer, order services.

docker-compose-eventuate-local-mysql.yml Also giving the same issue.

Kirthana14 commented 6 years ago

customercommandside_1 | at io.eventuate.local.java.kafka.consumer.EventuateKafkaConsumer.verifyTopicExistsBeforeSubscribing(EventuateKafkaConsumer.java:48) customercommandside_1 | at io.eventuate.local.java.kafka.consumer.EventuateKafkaConsumer.start(EventuateKafkaConsumer.java:70) customercommandside_1 | ... 30 common frames omitted customercommandside_1 | Caused by: org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata

ordercommandside_1 | at io.eventuate.local.java.kafka.consumer.EventuateKafkaConsumer.start(EventuateKafkaConsumer.java:70) ordercommandside_1 | ... 30 common frames omitted ordercommandside_1 | Caused by: org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata eventuateexamplesjavacustomersandorders_ordercommandside_1 exited with code 1

cer commented 6 years ago

Well that is promising. Looks like the image is built correctly. Now you have a networking problem - see #24