You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/03/13 15:14:07 UTC

[skywalking] branch master updated: RestTemplate async plugin ClassCastException (#4507)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new d5efc97  RestTemplate async plugin ClassCastException (#4507)
d5efc97 is described below

commit d5efc97c803d3ea249a157751d6aa7af8b0fcc9b
Author: cngdkxw <cn...@gmail.com>
AuthorDate: Fri Mar 13 23:13:51 2020 +0800

    RestTemplate async plugin ClassCastException (#4507)
    
    * ClassCastException
    
    * resttemplate 4.x scenario
    
    * add support versions & fix expectedData format-
    
    Co-authored-by: 吴晟 Wu Sheng <wu...@foxmail.com>
---
 .github/workflows/plugins-test.yaml                |   4 +-
 .../resttemplate/async/FutureGetInterceptor.java   |   5 +-
 .../config/expectedData.yaml                       | 148 +++++++++++++++++++++
 .../resttemplate-4.x-scenario/configuration.yml    |  18 +++
 .../scenarios/resttemplate-4.x-scenario/pom.xml    |  79 +++++++++++
 .../testcase/resttemplate/BackController.java      |  37 ++++++
 .../testcase/resttemplate/FrontController.java     |  74 +++++++++++
 .../resttemplate/ResttemplateConfiguration.java    |  38 ++++++
 .../src/main/resource/log4j2.xml                   |  31 +++++
 .../src/main/webapp/WEB-INF/spring-mvc-servlet.xml |  30 +++++
 .../src/main/webapp/WEB-INF/web.xml                |  35 +++++
 .../resttemplate-4.x-scenario/support-version.list |  72 ++++++++++
 12 files changed, 568 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/plugins-test.yaml b/.github/workflows/plugins-test.yaml
index b8f2091..7c97933 100644
--- a/.github/workflows/plugins-test.yaml
+++ b/.github/workflows/plugins-test.yaml
@@ -278,7 +278,7 @@ jobs:
       - name: Run finagle 17.10.0-20.1.0
         run: bash test/plugin/run.sh finagle-17.10.x-scenario
 
-  Spring41x_SolrJ-Http:
+  Spring41x_Resttemplate-SolrJ-Http:
     runs-on: ubuntu-18.04
     timeout-minutes: 90
     strategy:
@@ -306,6 +306,8 @@ jobs:
         run: ./mvnw --batch-mode -f test/plugin/pom.xml clean package -DskipTests docker:build -DBUILD_NO=local >/dev/null
       - name: Run spring 4.1.x-4.2.x (20)
         run: bash test/plugin/run.sh spring-4.1.x-scenario
+      - name: Run resttemplate 4.0.0.RELEASE-4.3.26.RELEASE (57)
+        run: bash test/plugin/run.sh resttemplate-4.x-scenario
       - name: Run solrj 7.x (12)
         run: bash test/plugin/run.sh solrj-7.x-scenario
       - name: Run httpclient 2.0-3.1 (5)
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
index 88d3228..e9bea41 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
@@ -24,14 +24,15 @@ import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.plugin.spring.commons.EnhanceCacheObjects;
 
 public class FutureGetInterceptor implements InstanceMethodsAroundInterceptor {
 
     @Override
     public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
         MethodInterceptResult result) throws Throwable {
-        Object[] cacheValues = (Object[]) objInst.getSkyWalkingDynamicField();
-        ContextManager.createLocalSpan("future/get:" + cacheValues[0]);
+        EnhanceCacheObjects cacheValues = (EnhanceCacheObjects) objInst.getSkyWalkingDynamicField();
+        ContextManager.createLocalSpan("future/get:" + cacheValues.getOperationName());
     }
 
     @Override
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..43d57d3
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml
@@ -0,0 +1,148 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+registryItems:
+  services:
+    - {resttemplate-4.x-scenario: nq 0}
+  instances:
+    - {resttemplate-4.x-scenario: 1}
+  operationNames:
+    - resttemplate-4.x-scenario: [/resttemplate-4.x-scenario/resttemplate/asyncback, /resttemplate-4.x-scenario/resttemplate/case/resttemplate,
+                                  /resttemplate-4.x-scenario/resttemplate/syncback]
+  heartbeat: []
+segmentItems:
+  - serviceName: resttemplate-4.x-scenario
+    segmentSize: ge 4
+    segments:
+      - segmentId: not null
+        spans:
+          - operationName: /resttemplate-4.x-scenario/resttemplate/case/healthcheck
+            operationId: 0
+            parentSpanId: -1
+            spanId: 0
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Entry
+            peer: ''
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/case/healthcheck'}
+              - {key: http.method, value: HEAD}
+      - segmentId: not null
+        spans:
+          - operationName: /resttemplate-4.x-scenario/resttemplate/asyncback
+            operationId: 0
+            parentSpanId: -1
+            spanId: 0
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Entry
+            peer: ''
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/asyncback'}
+              - {key: http.method, value: GET}
+            refs:
+              - {parentEndpointId: 0, parentEndpoint: /resttemplate-4.x-scenario/resttemplate/case/resttemplate,
+                 networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1,
+                 parentTraceSegmentId: not null, parentServiceInstanceId: 1,
+                 networkAddress: 'localhost:8080', entryEndpoint: /resttemplate-4.x-scenario/resttemplate/case/resttemplate,
+                 entryServiceInstanceId: 1}
+      - segmentId: not null
+        spans:
+          - operationName: /resttemplate-4.x-scenario/resttemplate/syncback
+            operationId: 0
+            parentSpanId: -1
+            spanId: 0
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Entry
+            peer: ''
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/syncback'}
+              - {key: http.method, value: GET}
+            refs:
+              - {parentEndpointId: 0, parentEndpoint: /resttemplate-4.x-scenario/resttemplate/case/resttemplate,
+                 networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 3,
+                 parentTraceSegmentId: not null, parentServiceInstanceId: 1,
+                 networkAddress: 'localhost:8080', entryEndpoint: /resttemplate-4.x-scenario/resttemplate/case/resttemplate,
+                 entryServiceInstanceId: 1}
+      - segmentId: not null
+        spans:
+          - operationName: /resttemplate-4.x-scenario/resttemplate/asyncback
+            operationId: 0
+            parentSpanId: 0
+            spanId: 1
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Exit
+            peer: localhost:8080
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/asyncback'}
+              - {key: http.method, value: GET}
+          - {operationName: 'future/get:/resttemplate-4.x-scenario/resttemplate/asyncback',
+             operationId: 0, parentSpanId: 0, spanId: 2, spanLayer: Unknown, startTime: nq 0,
+             endTime: nq 0, componentId: 0, componentName: '', isError: false, spanType: Local,
+             peer: '', peerId: 0}
+          - operationName: /resttemplate-4.x-scenario/resttemplate/syncback
+            operationId: 0
+            parentSpanId: 0
+            spanId: 3
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Exit
+            peer: localhost:8080
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/syncback'}
+              - {key: http.method, value: GET}
+          - operationName: /resttemplate-4.x-scenario/resttemplate/case/resttemplate
+            operationId: 0
+            parentSpanId: -1
+            spanId: 0
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: not null
+            componentName: ''
+            isError: false
+            spanType: Entry
+            peer: ''
+            peerId: 0
+            tags:
+              - {key: url, value: 'http://localhost:8080/resttemplate-4.x-scenario/resttemplate/case/resttemplate'}
+              - {key: http.method, value: GET}
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/configuration.yml b/test/plugin/scenarios/resttemplate-4.x-scenario/configuration.yml
new file mode 100644
index 0000000..37bb74b
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/configuration.yml
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+type: tomcat
+entryService: http://localhost:8080/resttemplate-4.x-scenario/resttemplate/case/resttemplate
+healthCheck: http://localhost:8080/resttemplate-4.x-scenario/resttemplate/case/healthcheck
+framework: resttemplate
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/pom.xml b/test/plugin/scenarios/resttemplate-4.x-scenario/pom.xml
new file mode 100644
index 0000000..24ecf4d
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.skywalking</groupId>
+    <artifactId>resttemplate-4.x-scenario</artifactId>
+    <version>6.5.0</version>
+    <packaging>war</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <compiler.version>1.8</compiler.version>
+        <test.framework.version>4.3.0.RELEASE</test.framework.version>
+        <docker.image.version>${test.framework.version}</docker.image.version>
+        <log4j.version>2.8.1</log4j.version>
+    </properties>
+
+    <name>skywalking-resttemplate-4.x-scenario</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+            <version>${test.framework.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>${log4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>resttemplate-4.x-scenario</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.6.0</version>
+                <configuration>
+                    <source>${compiler.version}</source>
+                    <target>${compiler.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/BackController.java b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/BackController.java
new file mode 100644
index 0000000..28b791c
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/BackController.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.testcase.resttemplate;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/resttemplate")
+public class BackController {
+    @RequestMapping(value = "/syncback", method = RequestMethod.GET)
+    public String syncBack() {
+        return "Hello back";
+    }
+
+    @RequestMapping(value = "/asyncback", method = RequestMethod.GET)
+    public String asyncBack() {
+        return "Hello back";
+    }
+}
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/FrontController.java b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/FrontController.java
new file mode 100644
index 0000000..5798cc5
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/FrontController.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.testcase.resttemplate;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.concurrent.ListenableFuture;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.AsyncRestTemplate;
+import org.springframework.web.client.RestTemplate;
+
+@RestController
+@RequestMapping("/resttemplate/case")
+public class FrontController {
+
+    private static Logger logger = LogManager.getLogger(FrontController.class);
+
+    @Autowired
+    private AsyncRestTemplate asyncRestTemplate;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @RequestMapping(value = "/healthcheck")
+    public String healthcheck() {
+        return "Success";
+    }
+
+    @RequestMapping(value = "/resttemplate", method = RequestMethod.GET)
+    public String front() {
+        asyncRequest("http://localhost:8080/resttemplate-4.x-scenario/resttemplate/asyncback");
+        syncRequest("http://localhost:8080/resttemplate-4.x-scenario/resttemplate/syncback");
+        return "Success";
+    }
+
+    private String asyncRequest(String url) {
+
+        ListenableFuture<ResponseEntity<String>> forEntity = asyncRestTemplate.getForEntity(url, String.class);
+
+        try {
+            forEntity.get();
+        } catch (Exception e) {
+            logger.error("exception:", e);
+        }
+
+        return "Success";
+    }
+
+    private String syncRequest(String url) {
+        restTemplate.getForObject(url, String.class);
+
+        return "Success";
+    }
+}
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/ResttemplateConfiguration.java b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/ResttemplateConfiguration.java
new file mode 100644
index 0000000..8c37a39
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/java/org/apache/skywalking/testcase/resttemplate/ResttemplateConfiguration.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.testcase.resttemplate;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.AsyncRestTemplate;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class ResttemplateConfiguration {
+
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+
+    @Bean
+    public AsyncRestTemplate asyncRestTemplate() {
+        return new AsyncRestTemplate();
+    }
+}
\ No newline at end of file
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/resource/log4j2.xml b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/resource/log4j2.xml
new file mode 100644
index 0000000..985bd03
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/resource/log4j2.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<Configuration status="WARN">
+    <Appenders>
+        <Console name="Console" target="SYSTEM_ERR">
+            <PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="WARN">
+            <AppenderRef ref="Console"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml
new file mode 100644
index 0000000..1ede76a
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                           http://www.springframework.org/schema/context
+                           http://www.springframework.org/schema/context/spring-context-3.0.xsd
+                           http://www.springframework.org/schema/mvc
+                           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
+    <context:component-scan base-package="org.apache.skywalking.testcase.resttemplate"/>
+    <mvc:annotation-driven/>
+</beans>
\ No newline at end of file
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..7cbbd0e
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,35 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+		 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
+         version="3.1">
+    <display-name>skywalking-resttemplate-4.x-scenario</display-name>
+
+    <servlet>
+        <servlet-name>spring-mvc</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>spring-mvc</servlet-name>
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/support-version.list b/test/plugin/scenarios/resttemplate-4.x-scenario/support-version.list
new file mode 100644
index 0000000..c6c0eb9
--- /dev/null
+++ b/test/plugin/scenarios/resttemplate-4.x-scenario/support-version.list
@@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+4.0.0.RELEASE
+4.0.1.RELEASE
+4.0.2.RELEASE
+4.0.3.RELEASE
+4.0.4.RELEASE
+4.0.5.RELEASE
+4.0.6.RELEASE
+4.0.7.RELEASE
+4.0.8.RELEASE
+4.0.9.RELEASE
+4.1.0.RELEASE
+4.1.2.RELEASE
+4.1.3.RELEASE
+4.1.4.RELEASE
+4.1.5.RELEASE
+4.1.6.RELEASE
+4.1.7.RELEASE
+4.1.8.RELEASE
+4.1.9.RELEASE
+4.2.0.RELEASE
+4.2.1.RELEASE
+4.2.2.RELEASE
+4.2.3.RELEASE
+4.2.4.RELEASE
+4.2.5.RELEASE
+4.2.6.RELEASE
+4.2.7.RELEASE
+4.2.8.RELEASE
+4.2.9.RELEASE
+4.3.0.RELEASE
+4.3.1.RELEASE
+4.3.2.RELEASE
+4.3.3.RELEASE
+4.3.4.RELEASE
+4.3.5.RELEASE
+4.3.6.RELEASE
+4.3.7.RELEASE
+4.3.8.RELEASE
+4.3.8.RELEASE
+4.3.9.RELEASE
+4.3.10.RELEASE
+4.3.11.RELEASE
+4.3.12.RELEASE
+4.3.13.RELEASE
+4.3.14.RELEASE
+4.3.15.RELEASE
+4.3.16.RELEASE
+4.3.17.RELEASE
+4.3.18.RELEASE
+4.3.19.RELEASE
+4.3.20.RELEASE
+4.3.21.RELEASE
+4.3.22.RELEASE
+4.3.23.RELEASE
+4.3.24.RELEASE
+4.3.25.RELEASE
+4.3.26.RELEASE
\ No newline at end of file