When you use Ali-Tomcat to start multiple High-speed Service Framework (HSF) applications on the same machine, temporary directory deletion failures or class loading errors may occur.
Cause
When two or more HSF processes start at the same time, they decompress into the same temporary directory. This causes file contention and class loading corruption because the processes overwrite each other's files.
Solution 1: Set JVM startup parameters
Add the following -D parameters to each HSF application's startup command. Assign unique values per instance to isolate resources and prevent conflicts.
| Parameter | Purpose | Default |
|---|---|---|
-Dcom.taobao.pandora.tmp_path= | Temporary decompression directory. Set a unique path per instance to prevent file contention and class loading errors. | N/A |
-Dhsf.server.port= | HSF service listening port. Set a unique port per instance. | 12200 |
-Dpandora.qos.port= | Pandora Quality of Service (QoS) port. Set a unique port per instance. | 12201 |
-Dproject.name= | Application name identifier. Enabled by default at startup. | N/A |
For example, if the first instance uses default ports, start a second instance with these parameters:
-Dcom.taobao.pandora.tmp_path=/tmp/hsf-instance-2 \
-Dhsf.server.port=12210 \
-Dpandora.qos.port=12211 \
-Dproject.name=my-second-appFor information about how to configure Java Virtual Machine (JVM) parameters in EDAS, see Set JVM parameters.
For details about each parameter, see Set JVM -D startup parameters.
Solution 2: Change the listening port in server.xml
You can configure ports directly in conf/server.xml in your Ali-Tomcat installation directory instead of using JVM parameters. Change the <Server> port and <Connector> port to values that do not conflict with other instances.
<Server port="8006" shutdown="TAOBAO-TOMCAT-SHUTDOWN">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="15000" redirectPort="8443" maxParameterCount="1000"
maxThreads="250" maxPostSize="2097152" acceptCount="200" useBodyEncodingForURI="true" />
</Server>For each additional instance, increment the port values. For example, use 8016 and 8180 for a second instance.