You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@skywalking.apache.org by dafang <13...@163.com> on 2022/11/01 12:30:06 UTC

Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Hi skywalking dev team:
      env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
      Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
     
 The error log:
      "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
... 25 more"


The Java Code:
"@RestController
public class BaseWebController {


    @Autowired
    private HttpServletRequest request;


    public static final String USER_AGENT = "user-agent";
    public static final String IOS = "ios";


    protected RpcProto.SourceEnum getHost() {
        
    }


    public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
       
    }
}"




I don't have any ideas. Please help me to see my problems.
Yours dafang
2022.11.1

Re:Re: Re: Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by dafang <13...@163.com>.
You mean “You are setting a static field(byte-buddy generated)” ?
The static field is created by custom coder, and It can work normally before skywalking is integrated, and then the error is reported after the skywalking is integrated.








At 2022-11-01 20:50:10, "Sheng Wu" <wu...@gmail.com> wrote:
>Have you ever read what I said? No more.
>
>Sheng Wu 吴晟
>Twitter, wusheng1108
>
>dafang <13...@163.com> 于2022年11月1日周二 20:49写道:
>>
>> It's not added by me,it works after I add javaagent:skywalking.jar.
>>
>>
>>
>>
>> At 2022-11-01 20:41:58, "Sheng Wu" <wu...@gmail.com> wrote:
>> >You are setting a static field(byte-buddy generated). I don't know why
>> >you do that, but you are doing so.
>> >
>> >Sheng Wu 吴晟
>> >Twitter, wusheng1108
>> >
>> >dafang <13...@163.com> 于2022年11月1日周二 20:40写道:
>> >>
>> >>
>> >>
>> >>
>> >> There is an error msg in my log:
>> >> Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>> >>
>> >>
>> >> it's skywalking's error
>> >> And if I remove skywalking-agent ,and then restart project, it will be started successfully.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> At 2022-11-01 20:38:03, "Sheng Wu" <wu...@gmail.com> wrote:
>> >> >I can't follow your case. Accessing a **final** field? Why do you
>> >> >think it is possible? How does this relate to SkyWalking?
>> >> >
>> >> >Sheng Wu 吴晟
>> >> >Twitter, wusheng1108
>> >> >
>> >> >dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
>> >> >>
>> >> >> Hi skywalking dev team:
>> >> >>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
>> >> >>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
>> >> >>
>> >> >>  The error log:
>> >> >>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>> >> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
>> >> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
>> >> >> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
>> >> >> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
>> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
>> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
>> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
>> >> >> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
>> >> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> >> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
>> >> >> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
>> >> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> >> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> >> >> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
>> >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
>> >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
>> >> >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
>> >> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
>> >> >> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> >> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> >> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> >> ... 25 more"
>> >> >>
>> >> >>
>> >> >> The Java Code:
>> >> >> "@RestController
>> >> >> public class BaseWebController {
>> >> >>
>> >> >>
>> >> >>     @Autowired
>> >> >>     private HttpServletRequest request;
>> >> >>
>> >> >>
>> >> >>     public static final String USER_AGENT = "user-agent";
>> >> >>     public static final String IOS = "ios";
>> >> >>
>> >> >>
>> >> >>     protected RpcProto.SourceEnum getHost() {
>> >> >>
>> >> >>     }
>> >> >>
>> >> >>
>> >> >>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
>> >> >>
>> >> >>     }
>> >> >> }"
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> I don't have any ideas. Please help me to see my problems.
>> >> >> Yours dafang
>> >> >> 2022.11.1

Re: Re: Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by Sheng Wu <wu...@gmail.com>.
Have you ever read what I said? No more.

Sheng Wu 吴晟
Twitter, wusheng1108

dafang <13...@163.com> 于2022年11月1日周二 20:49写道:
>
> It's not added by me,it works after I add javaagent:skywalking.jar.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> At 2022-11-01 20:41:58, "Sheng Wu" <wu...@gmail.com> wrote:
> >You are setting a static field(byte-buddy generated). I don't know why
> >you do that, but you are doing so.
> >
> >Sheng Wu 吴晟
> >Twitter, wusheng1108
> >
> >dafang <13...@163.com> 于2022年11月1日周二 20:40写道:
> >>
> >>
> >>
> >>
> >> There is an error msg in my log:
> >> Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
> >>
> >>
> >> it's skywalking's error
> >> And if I remove skywalking-agent ,and then restart project, it will be started successfully.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> At 2022-11-01 20:38:03, "Sheng Wu" <wu...@gmail.com> wrote:
> >> >I can't follow your case. Accessing a **final** field? Why do you
> >> >think it is possible? How does this relate to SkyWalking?
> >> >
> >> >Sheng Wu 吴晟
> >> >Twitter, wusheng1108
> >> >
> >> >dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
> >> >>
> >> >> Hi skywalking dev team:
> >> >>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
> >> >>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
> >> >>
> >> >>  The error log:
> >> >>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
> >> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
> >> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
> >> >> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
> >> >> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
> >> >> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
> >> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> >> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> >> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
> >> >> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
> >> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> >> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> >> >> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
> >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
> >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
> >> >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
> >> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
> >> >> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> >> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> >> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> >> ... 25 more"
> >> >>
> >> >>
> >> >> The Java Code:
> >> >> "@RestController
> >> >> public class BaseWebController {
> >> >>
> >> >>
> >> >>     @Autowired
> >> >>     private HttpServletRequest request;
> >> >>
> >> >>
> >> >>     public static final String USER_AGENT = "user-agent";
> >> >>     public static final String IOS = "ios";
> >> >>
> >> >>
> >> >>     protected RpcProto.SourceEnum getHost() {
> >> >>
> >> >>     }
> >> >>
> >> >>
> >> >>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
> >> >>
> >> >>     }
> >> >> }"
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> I don't have any ideas. Please help me to see my problems.
> >> >> Yours dafang
> >> >> 2022.11.1

Re:Re: Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by dafang <13...@163.com>.
It's not added by me,it works after I add javaagent:skywalking.jar.

















At 2022-11-01 20:41:58, "Sheng Wu" <wu...@gmail.com> wrote:
>You are setting a static field(byte-buddy generated). I don't know why
>you do that, but you are doing so.
>
>Sheng Wu 吴晟
>Twitter, wusheng1108
>
>dafang <13...@163.com> 于2022年11月1日周二 20:40写道:
>>
>>
>>
>>
>> There is an error msg in my log:
>> Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>>
>>
>> it's skywalking's error
>> And if I remove skywalking-agent ,and then restart project, it will be started successfully.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> At 2022-11-01 20:38:03, "Sheng Wu" <wu...@gmail.com> wrote:
>> >I can't follow your case. Accessing a **final** field? Why do you
>> >think it is possible? How does this relate to SkyWalking?
>> >
>> >Sheng Wu 吴晟
>> >Twitter, wusheng1108
>> >
>> >dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
>> >>
>> >> Hi skywalking dev team:
>> >>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
>> >>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
>> >>
>> >>  The error log:
>> >>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
>> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
>> >> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
>> >> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
>> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
>> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
>> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
>> >> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
>> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
>> >> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
>> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> >> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
>> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
>> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
>> >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
>> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
>> >> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> >> ... 25 more"
>> >>
>> >>
>> >> The Java Code:
>> >> "@RestController
>> >> public class BaseWebController {
>> >>
>> >>
>> >>     @Autowired
>> >>     private HttpServletRequest request;
>> >>
>> >>
>> >>     public static final String USER_AGENT = "user-agent";
>> >>     public static final String IOS = "ios";
>> >>
>> >>
>> >>     protected RpcProto.SourceEnum getHost() {
>> >>
>> >>     }
>> >>
>> >>
>> >>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
>> >>
>> >>     }
>> >> }"
>> >>
>> >>
>> >>
>> >>
>> >> I don't have any ideas. Please help me to see my problems.
>> >> Yours dafang
>> >> 2022.11.1

Re: Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by Sheng Wu <wu...@gmail.com>.
You are setting a static field(byte-buddy generated). I don't know why
you do that, but you are doing so.

Sheng Wu 吴晟
Twitter, wusheng1108

dafang <13...@163.com> 于2022年11月1日周二 20:40写道:
>
>
>
>
> There is an error msg in my log:
> Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>
>
> it's skywalking's error
> And if I remove skywalking-agent ,and then restart project, it will be started successfully.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> At 2022-11-01 20:38:03, "Sheng Wu" <wu...@gmail.com> wrote:
> >I can't follow your case. Accessing a **final** field? Why do you
> >think it is possible? How does this relate to SkyWalking?
> >
> >Sheng Wu 吴晟
> >Twitter, wusheng1108
> >
> >dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
> >>
> >> Hi skywalking dev team:
> >>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
> >>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
> >>
> >>  The error log:
> >>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
> >> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
> >> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
> >> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
> >> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> >> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
> >> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> >> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> >> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
> >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
> >> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
> >> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
> >> ... 25 more"
> >>
> >>
> >> The Java Code:
> >> "@RestController
> >> public class BaseWebController {
> >>
> >>
> >>     @Autowired
> >>     private HttpServletRequest request;
> >>
> >>
> >>     public static final String USER_AGENT = "user-agent";
> >>     public static final String IOS = "ios";
> >>
> >>
> >>     protected RpcProto.SourceEnum getHost() {
> >>
> >>     }
> >>
> >>
> >>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
> >>
> >>     }
> >> }"
> >>
> >>
> >>
> >>
> >> I don't have any ideas. Please help me to see my problems.
> >> Yours dafang
> >> 2022.11.1

Re:Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by dafang <13...@163.com>.


There is an error msg in my log:
Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter


it's skywalking's error
And if I remove skywalking-agent ,and then restart project, it will be started successfully.














At 2022-11-01 20:38:03, "Sheng Wu" <wu...@gmail.com> wrote:
>I can't follow your case. Accessing a **final** field? Why do you
>think it is possible? How does this relate to SkyWalking?
>
>Sheng Wu 吴晟
>Twitter, wusheng1108
>
>dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
>>
>> Hi skywalking dev team:
>>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
>>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
>>
>>  The error log:
>>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
>> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
>> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
>> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
>> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
>> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
>> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
>> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
>> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
>> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
>> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
>> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
>> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
>> ... 25 more"
>>
>>
>> The Java Code:
>> "@RestController
>> public class BaseWebController {
>>
>>
>>     @Autowired
>>     private HttpServletRequest request;
>>
>>
>>     public static final String USER_AGENT = "user-agent";
>>     public static final String IOS = "ios";
>>
>>
>>     protected RpcProto.SourceEnum getHost() {
>>
>>     }
>>
>>
>>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
>>
>>     }
>> }"
>>
>>
>>
>>
>> I don't have any ideas. Please help me to see my problems.
>> Yours dafang
>> 2022.11.1

Re: Can not set static xxx in ...InstMethodsInter field com.test.controller.BaseWebController.delegate$n04bej1 to ...ConstructorInter

Posted by Sheng Wu <wu...@gmail.com>.
I can't follow your case. Accessing a **final** field? Why do you
think it is possible? How does this relate to SkyWalking?

Sheng Wu 吴晟
Twitter, wusheng1108

dafang <13...@163.com> 于2022年11月1日周二 20:31写道:
>
> Hi skywalking dev team:
>       env:   skywalking-agent:v8.11.0,skywalking-oap:v9.1.0  Project byte-buddy version is : 1.11.22
>       Recently,we have found our skywalking-agent report error log during project starting.It happend several times.
>
>  The error log:
>       "Caused by: java.lang.IllegalArgumentException: Can not set static org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter field com.okcoin.aircraft.rest.priapi.controller.BaseWebController.delegate$n04bej1 to org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ConstructorInter
> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_321]
> at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_321]
> at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:81) ~[?:1.8.0_321]
> at java.lang.reflect.Field.set(Field.java:764) ~[?:1.8.0_321]
> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$.onLoad(LoadedTypeInitializer.java:170) ~[skywalking-agent.jar:8.11.0]
> at org.apache.skywalking.apm.dependencies.net.bytebuddy.implementation.LoadedTypeInitializer$Compound.onLoad(LoadedTypeInitializer.java:233) ~[skywalking-agent.jar:8.11.0]
> at org.apache.skywalking.apm.dependencies.net.bytebuddy.agent.builder.AgentBuilder$InitializationStrategy$SelfInjection$Dispatcher$InjectingInitializer.onLoad(AgentBuilder.java:3655) ~[skywalking-agent.jar:8.11.0]
> at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> at org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus.initialize(Nexus.java:139) ~[skywalking-agent.jar:8.11.0]
> at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) ~[?:?]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_321]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_321]
> at com.test.controller.BaseWebController.<clinit>(BaseWebController.java) ~[classes!/:1.2.2-SNAPSHOT]
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_321]
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_321]
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_321]
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_321]
> at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.20.jar!/:5.3.20]
> at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.20.jar!/:5.3.20]
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.20.jar!/:5.3.20]
> ... 25 more"
>
>
> The Java Code:
> "@RestController
> public class BaseWebController {
>
>
>     @Autowired
>     private HttpServletRequest request;
>
>
>     public static final String USER_AGENT = "user-agent";
>     public static final String IOS = "ios";
>
>
>     protected RpcProto.SourceEnum getHost() {
>
>     }
>
>
>     public BizErrorCodeEnum checkStatus(StatusEnum statusEnum) {
>
>     }
> }"
>
>
>
>
> I don't have any ideas. Please help me to see my problems.
> Yours dafang
> 2022.11.1