Running Mode

Currently, ServiceComb microservice framework support two kind of deploy mode: standalone mode and web container mode. You are advised to to use standalone to to start your services.

Standalone Mode

A standalone container is loaded with a simple Main to start Spring. Because the service usually does not need the Web container feature, such as Tomcat/JBoss.

It is not necessary to unload services using the Web container. The microservice framework provides the standalone deployment mode.

The service container is only a simple Main method, and a simple Spring container is loaded to expose services.


  • Step 1 Compile the Main function to initialize logs and load service configurations. The contents are as follows:

     public class MainServer {
       public static void main(String[] args) throws Exception {
       γ€€Log4jUtils.init(); #Log initialization
       γ€€BeanUtils.init(); # Spring bean initialization
         // other codes omitted
  • Step 2 Run MainServer to start process and expose services.

    NOTE: If the rest network is used, change transparent in the POM file to the cse-transport-rest-vertx package.

WEB Container Mode

If you need to load the microservice to the web container, create a sersvlet project package. You do not need to write or write a small number of boot codes as needed.

Development Example

Step 1 Create a servlet project and modify the web.xml file as follows:


  • Step 2 Modify the POM file


  1. The Restful call must be separated from other static resources (such as HTML and js) in the web container. The next segment of webroot should have a keyword, such as rest in this example (/test/rest) in web.xml
  2. The Tomcat is used as an example. Each WAR package has unique webroot, which must be a basePath prefix. For example , if webroot is test, all the API definitions of the microservice must start with /test.
  3. When the microservice is loaded to the web container and the HTTP and HTTPS ports are opened using the web container, which must meet requirements for the web container rules.