Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Agent] java.lang.NoClassDefFoundError: okhttp3/OkHttpClient #675

Closed
myoss opened this issue Dec 14, 2017 · 7 comments
Closed

[Agent] java.lang.NoClassDefFoundError: okhttp3/OkHttpClient #675

myoss opened this issue Dec 14, 2017 · 7 comments
Assignees
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug!
Milestone

Comments

@myoss
Copy link

myoss commented Dec 14, 2017

Please answer these questions before submitting your issue.

What version of sky-walking are you using?

5.0-2018-preview latest

What version of your OS?

CentOS 3+

What version of your JRE?

1.8

question

when agent start throw exception

DEBUG 2017-12-14 20:39:58 AbstractClassEnhancePluginDefine :  prepare to enhance class okhttp3.RealCall by org.apache.skywalking.apm.plugin.okhttp.v3.define.RealCallInstrumentation. 
ERROR 2017-12-14 20:39:58 SkyWalkingAgent :  Enhance class okhttp3.RealCall error. 
java.lang.NoClassDefFoundError: okhttp3/OkHttpClient
        at org.apache.skywalking.apm.plugin.okhttp.v3.define.RealCallInstrumentation$1.getConstructorMatcher(RealCallInstrumentation.java:62)
        at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine.enhanceInstance(ClassEnhancePluginDefine.java:129)
        at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine.enhance(ClassEnhancePluginDefine.java:73)
        at org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine.define(AbstractClassEnhancePluginDefine.java:75)
        at org.apache.skywalking.apm.agent.SkyWalkingAgent$3.transform(SkyWalkingAgent.java:83)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Transformer$Compound.transform(AgentBuilder.java:2335)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$Transformation$Simple$Resolution.apply(AgentBuilder.java:8902)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.doTransform(AgentBuilder.java:9306)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:9269)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.access$1300(AgentBuilder.java:9047)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:9625)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer$LegacyVmDispatcher.run(AgentBuilder.java:9575)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$Default$ExecutingTransformer.transform(AgentBuilder.java:9194)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at okhttp3.OkHttpClient.newCall(OkHttpClient.java:418)
        at org.springframework.http.client.OkHttp3ClientHttpRequest.executeInternal(OkHttp3ClientHttpRequest.java:68)
        at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
        at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
        at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:99)
        at org.springframework.cloud.sleuth.instrument.web.client.TraceRestTemplateInterceptor.response(TraceRestTemplateInterceptor.java:69)
        at org.springframework.cloud.sleuth.instrument.web.client.TraceRestTemplateInterceptor.intercept(TraceRestTemplateInterceptor.java:63)
        at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:86)
        at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:70)
        at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
        at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
        at org.springframework.web.client.RestTemplate.doExecute$original$aB9kbQPn(RestTemplate.java:652)
        at org.springframework.web.client.RestTemplate.doExecute$original$aB9kbQPn$accessor$1J54sbZ6(RestTemplate.java)
        at org.springframework.web.client.RestTemplate$auxiliary$XsyZXEwq.call(Unknown Source)
        at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:93)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:549)

project pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.7.RELEASE</version>
    </parent>

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>3.7.0</version>
        </dependency>
@ascrutae
Copy link
Member

ascrutae commented Dec 14, 2017

This version is not published, You can use the 3.2.6 version.

@wu-sheng
Copy link
Member

     @Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
             return takesArguments(OkHttpClient.class, Request.class, boolean.class);
      }

@peng-yongsheng Your codes trigger this bug. You can't use the real Class, the right way is using org.apache.skywalking.apm.agent.core.plugin.bytebuddy.takesArgumentWithType.

@myoss This is an undetected bug.

@wu-sheng wu-sheng added the bug Something isn't working and you are sure it's a bug! label Dec 14, 2017
@wu-sheng wu-sheng added this to the 5.0-2018-preview milestone Dec 14, 2017
@wu-sheng
Copy link
Member

This version is not published, You can use the 3.2.6 version.

@myoss , But still @ascrutae is saying the right things. Tag/Release 3.2.6 is the right choice to use. Maybe you can't find it for now, because ASF INFRA make some mistakes about setting this repo. Please wait one or two days, I suppose.

@wu-sheng
Copy link
Member

@myoss Please check this: #676 . @ascrutae is already trying to fix this.

@myoss
Copy link
Author

myoss commented Dec 14, 2017

it's ok

@myoss myoss closed this as completed Dec 14, 2017
@myoss myoss reopened this Dec 15, 2017
@myoss
Copy link
Author

myoss commented Dec 15, 2017

@ascrutae Tag/Release 3.2.6 has the same error

@wu-sheng
Copy link
Member

@myoss Yes, it does. #676 has been merged. This issue will be solved in 5.0.0-alpha

@myoss myoss closed this as completed Dec 15, 2017
@wu-sheng wu-sheng added the agent Language agent related. label Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug!
Projects
None yet
Development

No branches or pull requests

3 participants