Help Center> ServiceStage> FAQ> Application Development> How Do I Handle a Microservice Registry Failure (Java Chassis)?

How Do I Handle a Microservice Registry Failure (Java Chassis)?

After a microservice is successfully deployed, you need to register the microservice with the service center and the configuration center to enable the microservice discovery and governance capabilities. The microservice registry fails when any of the following conditions is met:

  • The AK/SK information is not configured or is incorrectly configured.
  • The address of the service center or configuration center is incorrect.
  • The network connection is faulty.
  • The domain name resolution fails.
  • The monitoring port is already occupied.

Troubleshooting Procedure

  • If the following error message is displayed, the AK/SK information is incorrectly configured or carried in the request header.
    {"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Invalid request, header is invalid, ak sk or project is empty."}
    Checking method:
    1. Check whether the project depends on the following authentication modules (indirect dependency is permitted, for example, the project depends on the cse-solution-service-engine):
      <groupId>com.huawei.paas.cse</groupId>
      <artifactId>foundation-auth</artifactId>
    2. Check whether AK/SK in the microservice.yaml file is correct. To obtain correct AK/SK, see Access Keys.
      cse:
        credentials:
          accessKey: your access key
          secretKey: your serect key
          akskCustomCipher: default
  • If the following error message is displayed, the AK/SK information is incorrectly configured.
    {"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"validate ak sk error\"}"}

    Checking method:

    Check whether AK/SK in the microservice.yaml file is correct. To obtain correct AK/SK, see Access Keys.
    cse:
      credentials:
        accessKey: your access key
        secretKey: your serect key
        akskCustomCipher: default
  • If the following error message is displayed, the project information is incorrectly configured.
    {"errorCode":"401002","errorMessage":"Request unauthorized","detail":"Get service token from iam proxy failed,{\"error\":\"get project token from iam failed. error:http post failed, statuscode: 400\"}"}

    Checking method:

    Check whether the project information in the microservice.yaml file is correct. To obtain correct project information, see API Credentials.

    cse:
      credentials:
        accessKey: your access key
        secretKey: your serect key
        akskCustomCipher: default
        project: cn-north-1
  • If the following error message is displayed, there is no sufficient quota to add a service instance.
    {"errorCode":"400100","errorMessage":"Not enough quota","detail":"no quota to create instance, ..."}

    Checking method:

    Log in to the public cloud and view the instance quota on the Cloud Service Engine (CSE) page. If remaining quotas are displayed, check the service center address and region information configured in the code. Note that you need to check quotas of the region where the instance locates.

  • If the microservice fails to access the service center or configuration center, the following information is displayed. The microservice does not access the service center or configuration center. Therefore, no error code can be found in the service center or configuration center.
    Connection refused: no further information

    Checking method:

    1. Check whether IP addresses of the service center and configuration center in the microservice.yaml file are correct. If not, correct them.
      cse:
        service:                  //Information about the service center. The address field indicates the service center address.
          registry:
            address: https://cse.cn-north-1.myhuaweicloud.com
            instance:
              watch: false
        config:                   //Information about the configuration center. The address field indicates the configuration center address.
          client:
            serverUri: https://cse.cn-north-1.myhuaweicloud.com
            refreshMode: 1
            refresh_interval: 5000
    2. If IP addresses of the service center and configuration center are correct, run the following commands to check whether the network is normal.

      ping <servicecenter ip>

      ping <configurationcenter ip>

      If ping command execution is successful, the network connection is normal.

      If the address of the service center or configuration center is a domain name, change the address configured in the microservice.yaml file to the domain name. Then, run the ping command.

    3. If the network is normal, run the following command to obtain the IP address of the service center or configuration center.

      ping <domain name>

      If the following information is displayed, configure the obtained IP address and domain name in the local /etc/hosts file.

      10.153.78.18   cse.cn-north-1.myhuaweicloud.com
  • In addition, if a microservice port number is occupied, the microservice may fail to start. In this case, you can run the following command to check whether the service monitoring port is occupied.

    netstat -ano | findstr 8080

    If the port is occupied by another application, modify the microservice.yaml file and change the monitoring port to an unoccupied port.

    rest:
        address: 0.0.0.0:8087  //Microservice port. Ensure that the port number is unique.