Skip to content

Conversation

@Leibnizhu
Copy link
Contributor

@Leibnizhu Leibnizhu commented Jul 27, 2023

Add an agent plugin to support RESTEasy 6.x

Skywalking already supports Resteasy 3.x and 4.x. Referrers to RESTEASY-3007, Resteasy 6 has migrated from Jakarta REST 2.1 to Jakarta REST 3.0.
Therefore, when applying skywalking's Resteasy 4.x javaagent to a Resteasy 6.x application, it throws NoSuchMethodError like belows:

java.lang.NoSuchMethodError: 'javax.ws.rs.core.HttpHeaders org.jboss.resteasy.spi.HttpRequest.getHttpHeaders()'
	at org.apache.skywalking.apm.plugin.resteasy.v4.server.SynchronousDispatcherInterceptor.beforeMethod(SynchronousDispatcherInterceptor.java:50)
	at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:76)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
	at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

this PR:

  1. Add support for RESTEasy 6.x
  2. Test skywalking's RESTEasy 4.x javaagent ( Add support for RESTEasy4.x #265 ) for application with RESTEasy 5.x framework (add 5.x versions in support-version.list)
  3. Add RESTEasy 6.x tests into github workflow; according to Apache Tomcat Versions, we choose jdk17+tomcat10 for jakarta REST 3.0 supporting

@wu-sheng wu-sheng added this to the 9.0.0 milestone Jul 27, 2023
@wu-sheng wu-sheng merged commit 6baa4a7 into apache:main Jul 27, 2023
@Leibnizhu
Copy link
Contributor Author

@wu-sheng btw, when will skywalking 9.0.0 be released?

@wu-sheng
Copy link
Member

At least end of next month, the last 8.x released last month.

@Leibnizhu Leibnizhu deleted the feat/resteasy6 branch July 27, 2023 23:29
yangyulely pushed a commit to yangyulely/skywalking-java that referenced this pull request May 25, 2024

public class SynchronousDispatcherInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {

private static final String ENHANCE_CLASS = "org.jboss.resteasy.core.SynchronousDispatcher";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leibnizhu We received a report from slack that all v3/v4/v6 plugins of RESTEasy are using the same target class without witness class. It seems to have conflicts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can I find more information related to witness class ? or in other words, how should I fix it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://skywalking.apache.org/docs/skywalking-java/latest/en/setup/service-agent/java-agent/java-plugin-development-guide/#implement-plugin

Read point 4 here.

Witness class is using version specific class names or methods to separate versions in the runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it in PR #722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants