Help Center> ServiceStage> Developer Guide> Java Chassis> Developer Guide> Accessing Applications to a Microservice Engine

Accessing Applications to a Microservice Engine

For ServiceComb Java chassis 2.1.3 and later versions, you can directly use the open-source software package to access the microservice engine. If ServiceComb Java chassis earlier than 2.1.3 accesses a professional microservice engine, you need to import the foundation-auth package.

Prerequisite

The AK/SK or project name can be deleted or modified. If the AK/SK or project name is changed, the microservice needs to be upgraded. Otherwise, service registration and discovery may fail. For example, if the project name is changed, the "Project ID or name does not exist" error may be generated. AK/SK information needs to be configured for only professional engines.

Access Guidance

  • 2.1.3 and later

To access a microservice engine, ensure that the following dependencies are introduced to the project:

<dependency>
    <groupId>org.apache.servicecomb</groupId>
    <artifactId>solution-basic</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.servicecomb</groupId>
    <artifactId>servicestage-environment</artifactId>
</dependency>

Alternatively, ensure that the following dependencies are introduced to the project:

<dependency>
    <groupId>org.apache.servicecomb</groupId>
    <artifactId>servicestage</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.servicecomb</groupId>
    <artifactId>servicestage-environment</artifactId>
</dependency>

The servicestage-environment software package is optional. This software package provides the environment variable mapping function. After this software package is used, you can use ServiceStage to deploy applications without modifying the application name, microservice name, microservice version, registration center address, configuration center address, and project name. The default configurations in the microservice.yaml file are overwritten by environment variables, containing the following mapping.yaml file:

CAS_APPLICATION_NAME:
  - servicecomb.service.application
CAS_COMPONENT_NAME:
  - servicecomb.service.name
CAS_INSTANCE_VERSION:
  - servicecomb.service.version
PAAS_CSE_ENDPOINT:
  - servicecomb.service.registry.address
  - servicecomb.config.client.serverUri
PAAS_CSE_SC_ENDPOINT:
  - servicecomb.service.registry.address
PAAS_CSE_CC_ENDPOINT:
  - servicecomb.config.client.serverUri
PAAS_PROJECT_NAME:
  - servicecomb.credentials.project
  • Versions earlier than 2.1.3

To access a microservice engine, ensure that the following dependencies are introduced to the project:

<dependency>
    <groupId>com.huawei.paas.cse</groupId>
    <artifactId>foundation-auth</artifactId>
</dependency>

Table 1 shows the relationship between the software package version Java chassis version.

Table 1 Version mapping between Java chassis and foundation-auth package

Java Chassis Version

foundation-auth Version

2.1.0~2.1.2

3.1.0

2.0.1~2.0.2

3.0.0

1.3.0~1.3.1

2.5.0

To use the foundation-auth software package, configure the following Mavan repository:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    <repositories>    
        <repository>    
            <snapshots>    
                <enabled>false</enabled>    
            </snapshots>    
            <id>huaweicloudsdk-releases</id>    
            <name>huaweicloudsdk</name>    
            <url>https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/</url>    
        </repository>    
    </repositories>