diff --git a/functional_test/build.gradle b/functional_test/build.gradle index 26f5067eee..1b80118e21 100644 --- a/functional_test/build.gradle +++ b/functional_test/build.gradle @@ -62,8 +62,7 @@ dependencies { testImplementation("com.sun.jersey:jersey-core:1.9.1") testImplementation("javax.xml:jaxrpc-api:1.1") - // Removed from the JDK starting in Java 11 - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("org.apache.derby:derby:10.10.1.1") testImplementation("org.apache.struts:struts-core:1.3.5") diff --git a/instrumentation/akka-http-2.11_2.4.5/build.gradle b/instrumentation/akka-http-2.11_2.4.5/build.gradle index dfc76e60f9..c1cce0ede1 100644 --- a/instrumentation/akka-http-2.11_2.4.5/build.gradle +++ b/instrumentation/akka-http-2.11_2.4.5/build.gradle @@ -21,7 +21,7 @@ dependencies { testImplementation(project(":instrumentation:akka-2.2")) { transitive = false } testImplementation(project(":instrumentation:scala-2.9.3")) { transitive = false } testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } verifyInstrumentation { diff --git a/instrumentation/akka-http-2.13_10.1.8/build.gradle b/instrumentation/akka-http-2.13_10.1.8/build.gradle index 54f654be28..6a0885c26b 100644 --- a/instrumentation/akka-http-2.13_10.1.8/build.gradle +++ b/instrumentation/akka-http-2.13_10.1.8/build.gradle @@ -20,7 +20,7 @@ dependencies { testImplementation(project(":instrumentation:akka-2.2")) { transitive = false } testImplementation(project(":instrumentation:scala-2.13.0")) { transitive = false } testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } verifyInstrumentation { diff --git a/instrumentation/cxf-2.7/build.gradle b/instrumentation/cxf-2.7/build.gradle index 6fbca16058..30171ee6a5 100644 --- a/instrumentation/cxf-2.7/build.gradle +++ b/instrumentation/cxf-2.7/build.gradle @@ -1,8 +1,7 @@ dependencies { implementation(project(":agent-bridge")) - implementation("org.apache.cxf:cxf-api:2.7.11") - implementation("org.apache.cxf:cxf-rt-bindings-soap:2.7.11") + implementation("org.apache.cxf:cxf-rt-bindings-soap:3.5.3") } jar { @@ -10,7 +9,7 @@ jar { } verifyInstrumentation { - passes 'org.apache.cxf:cxf-rt-bindings-soap:[2.1.3,)' + passesOnly 'org.apache.cxf:cxf-rt-bindings-soap:[2.1.3,)' } site { diff --git a/instrumentation/cxf-2.7/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java b/instrumentation/cxf-2.7/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java index 65084f2a60..fbbcafa87f 100644 --- a/instrumentation/cxf-2.7/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java +++ b/instrumentation/cxf-2.7/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java @@ -12,7 +12,6 @@ import com.newrelic.api.agent.weaver.Weaver; import com.nr.agent.instrumentation.cxf27.CxfSoapUtils; import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.interceptor.Fault; @Weave public class SoapOutInterceptor { diff --git a/instrumentation/ejb-3.0/build.gradle b/instrumentation/ejb-3.0/build.gradle index b8539ffa08..f39a6d47cc 100644 --- a/instrumentation/ejb-3.0/build.gradle +++ b/instrumentation/ejb-3.0/build.gradle @@ -1,7 +1,7 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax:javaee-api:6.0") + implementation("jakarta.platform:jakarta.jakartaee-api:8.0.0") } jar { @@ -11,9 +11,10 @@ jar { verifyInstrumentation { excludeRegex '.*-RC[0-9]+$' passesOnly 'javax:javaee-api:[6.0,)' + passesOnly 'jakarta.platform:jakarta.jakartaee-api:[8.0.0,9.0.0)' } site { title 'EJB' type 'Framework' -} \ No newline at end of file +} diff --git a/instrumentation/glassfish-3/build.gradle b/instrumentation/glassfish-3/build.gradle index d2c658a2f7..b39b0ad221 100644 --- a/instrumentation/glassfish-3/build.gradle +++ b/instrumentation/glassfish-3/build.gradle @@ -1,9 +1,9 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:javax.servlet-api:3.0.1") - implementation("org.glassfish.main.web:web-core:3.1.2") - implementation("org.eclipse.persistence:javax.persistence:2.0.5") + implementation("jakarta.servlet:jakarta.servlet-api:4.0.4") + implementation("org.glassfish.main.web:web-core:5.1.0") + implementation("org.eclipse.persistence:javax.persistence:2.2.1") } jar { @@ -23,6 +23,14 @@ verifyInstrumentation { passes 'org.glassfish.main.web:web-core:5.0' passes 'org.glassfish.main.web:web-core:5.0.1' passes 'org.glassfish.main.web:web-core:5.1.0' + fails 'org.glassfish.main.web:web-core:6.0.0' + fails 'org.glassfish.main.web:web-core:6.1.0' + fails 'org.glassfish.main.web:web-core:6.2.0' + fails 'org.glassfish.main.web:web-core:6.2.1' + fails 'org.glassfish.main.web:web-core:6.2.2' + fails 'org.glassfish.main.web:web-core:6.2.3' + fails 'org.glassfish.main.web:web-core:6.2.4' + fails 'org.glassfish.main.web:web-core:6.2.5' } site { diff --git a/instrumentation/jax-rs-1.0/build.gradle b/instrumentation/jax-rs-1.0/build.gradle index 8fe53b8f07..05e8286475 100644 --- a/instrumentation/jax-rs-1.0/build.gradle +++ b/instrumentation/jax-rs-1.0/build.gradle @@ -1,10 +1,11 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.ws.rs:javax.ws.rs-api:2.1") + implementation("jakarta.ws.rs:jakarta.ws.rs-api:2.1.6") + implementation ("org.glassfish.jersey.inject:jersey-hk2:2.28") - testImplementation("org.glassfish.jersey.containers:jersey-container-servlet:2.16") - testImplementation("org.glassfish.jersey.test-framework:jersey-test-framework-core:2.16") - testImplementation("org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:2.16") + testImplementation("org.glassfish.jersey.containers:jersey-container-servlet:2.28") + testImplementation("org.glassfish.jersey.test-framework:jersey-test-framework-core:2.28") + testImplementation("org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:2.28") testImplementation(project(":instrumentation:jersey-2")) } diff --git a/instrumentation/jboss-7/build.gradle b/instrumentation/jboss-7/build.gradle index 18b04b4fcf..41ede06403 100644 --- a/instrumentation/jboss-7/build.gradle +++ b/instrumentation/jboss-7/build.gradle @@ -7,9 +7,8 @@ repositories { dependencies { implementation(project(":agent-bridge")) - - implementation("org.jboss.web:jbossweb:7.0.0.Final") - implementation("javax.servlet:javax.servlet-api:3.0.1") + implementation("org.jboss.web:jbossweb:7.5.10.Final") + implementation("jakarta.servlet:jakarta.servlet-api:4.0.4") } jar { @@ -18,7 +17,7 @@ jar { verifyInstrumentation { passes('org.jboss.web:jbossweb:[7.0,)') { - compile("javax.servlet:javax.servlet-api:3.0.1") + compile("jakarta.servlet:jakarta.servlet-api:4.0.4") } excludeRegex(".*(Alpha|Beta|CR).*") exclude("org.jboss.web:jbossweb:7.5.6.Final") // this appears to be a bad release that was excluded from multiple repos diff --git a/instrumentation/jersey-2/build.gradle b/instrumentation/jersey-2/build.gradle index 13c8aa5043..44d47a3564 100644 --- a/instrumentation/jersey-2/build.gradle +++ b/instrumentation/jersey-2/build.gradle @@ -1,22 +1,26 @@ dependencies { implementation(project(":agent-bridge")) implementation(project(":newrelic-api")) - implementation("org.glassfish.jersey.core:jersey-server:2.0-m13-3") + implementation("org.glassfish.jersey.core:jersey-server:2.28") testImplementation("com.jayway.restassured:rest-assured:2.7.0") testImplementation("org.eclipse.jetty:jetty-server:9.4.6.v20170531") testImplementation("org.eclipse.jetty:jetty-servlet:9.4.6.v20170531") - testImplementation("org.glassfish.jersey.core:jersey-server:2.25.1") - testImplementation("org.glassfish.jersey.containers:jersey-container-servlet-core:2.25.1") - testImplementation("org.glassfish.jersey.containers:jersey-container-jetty-http:2.25.1") - testImplementation("org.glassfish.jersey.containers:jersey-container-servlet:2.25.1") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("org.glassfish.jersey.core:jersey-server:2.28") + testImplementation("org.glassfish.jersey.containers:jersey-container-servlet-core:2.28") + testImplementation("org.glassfish.jersey.containers:jersey-container-jetty-http:2.28") + testImplementation("org.glassfish.jersey.containers:jersey-container-servlet:2.28") + testImplementation('org.glassfish.jersey.inject:jersey-hk2:2.28') + testImplementation("jakarta.xml.bind:jakarta.xml.bind-api:2.3.3") + } jar { manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.jersey-2' } } +// org.glassfish.jersey.core 2.28 version starts pulling in jakarata jar named dependencies. +// Version 3.0.0-M1 starts pulling in jakarata with renamed jar and packages verifyInstrumentation { passesOnly 'org.glassfish.jersey.core:jersey-server:[2.0,3.0.0-M1)' exclude 'org.glassfish.jersey.core:jersey-server:[2.0-m05-2,2.0)' diff --git a/instrumentation/jersey-client-2.26/build.gradle b/instrumentation/jersey-client-2.26/build.gradle index d838b0e20b..0f8184011b 100644 --- a/instrumentation/jersey-client-2.26/build.gradle +++ b/instrumentation/jersey-client-2.26/build.gradle @@ -1,9 +1,11 @@ dependencies { implementation(project(":agent-bridge")) implementation(project(":newrelic-api")) - implementation("org.glassfish.jersey.core:jersey-client:2.26") - testImplementation("org.glassfish.jersey.inject:jersey-hk2:2.26") - testImplementation("org.glassfish.jersey.core:jersey-common:2.26") + implementation("org.glassfish.jersey.core:jersey-client:2.28") + + testImplementation("org.glassfish.jersey.inject:jersey-hk2:2.28") + testImplementation("org.glassfish.jersey.core:jersey-common:2.28") + } jar { diff --git a/instrumentation/jetty-10/build.gradle b/instrumentation/jetty-10/build.gradle new file mode 100644 index 0000000000..069a234c87 --- /dev/null +++ b/instrumentation/jetty-10/build.gradle @@ -0,0 +1,31 @@ + +dependencies { + implementation(project(":agent-bridge")) + + implementation("org.eclipse.jetty:jetty-server:10.0.11") +} + +jar { + manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.jetty-10' } +} + +verifyInstrumentation { + passesOnly 'org.eclipse.jetty:jetty-server:[10.0.0-alpha1,11.0.0-alpha0)' +} + +site { + title 'Jetty' + type 'Appserver' +} + +// Jetty Server 10 is only compatible with Java 11+ +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } +} + +compileJava { + options.fork = true + options.bootstrapClasspath = null +} diff --git a/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/AsyncListenerFactory.java b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/AsyncListenerFactory.java new file mode 100644 index 0000000000..35d090bd5e --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/AsyncListenerFactory.java @@ -0,0 +1,55 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package com.nr.agent.instrumentation.jetty10; + +import com.newrelic.agent.bridge.AgentBridge; +import org.eclipse.jetty.server.HttpChannelState; + +import javax.servlet.AsyncEvent; +import javax.servlet.AsyncListener; +import java.io.IOException; + +public final class AsyncListenerFactory { + + /* + * The public enum Action was added in 9.1 and does not exist in 9.0.*. So declaring a variable of this type is + * sufficient to prevent this instrumentation module from loading in 9.0.*. + */ + public static HttpChannelState.Action isPostJetty90 = null; + + private AsyncListenerFactory() { + } + + private static final AsyncListener ASYNC_LISTENER = new AsyncListener() { + + @Override + public void onComplete(AsyncEvent asyncEvent) throws IOException { + AgentBridge.asyncApi.completeAsync(asyncEvent.getAsyncContext()); + } + + @Override + public void onTimeout(AsyncEvent asyncEvent) throws IOException { + // do nothing + } + + @Override + public void onError(AsyncEvent asyncEvent) throws IOException { + AgentBridge.asyncApi.errorAsync(asyncEvent.getAsyncContext(), asyncEvent.getThrowable()); + } + + @Override + public void onStartAsync(AsyncEvent asyncEvent) throws IOException { + // do nothing + } + + }; + + public static AsyncListener getAsyncListener() { + return ASYNC_LISTENER; + } +} diff --git a/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyRequest.java b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyRequest.java new file mode 100644 index 0000000000..9c26b4df94 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyRequest.java @@ -0,0 +1,88 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package com.nr.agent.instrumentation.jetty10; + +import com.newrelic.api.agent.ExtendedRequest; +import com.newrelic.api.agent.HeaderType; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; + +public class JettyRequest extends ExtendedRequest { + private final HttpServletRequest request; + + public JettyRequest(HttpServletRequest request) { + super(); + this.request = request; + } + + @Override + public String getRequestURI() { + return request.getRequestURI(); + } + + @Override + public String getHeader(String name) { + return request.getHeader(name); + } + + @Override + public String getRemoteUser() { + return request.getRemoteUser(); + } + + @Override + public Enumeration getParameterNames() { + return request.getParameterNames(); + } + + @Override + public String[] getParameterValues(String name) { + return request.getParameterValues(name); + } + + @Override + public Object getAttribute(String name) { + return request.getAttribute(name); + } + + @Override + public String getCookieValue(String name) { + Cookie[] cookies = request.getCookies(); + if (cookies != null) { + for (Cookie cookie : cookies) { + if (name.equals(cookie.getName())) { + return cookie.getValue(); + } + } + } + return null; + } + + @Override + public HeaderType getHeaderType() { + return HeaderType.HTTP; + } + + @Override + public String getMethod() { + return request.getMethod(); + } + + @Override + public List getHeaders(String name) { + Enumeration headers = request.getHeaders(name); + if (headers == null) { + return Collections.emptyList(); + } + return Collections.list(headers); + } +} diff --git a/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyResponse.java b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyResponse.java new file mode 100644 index 0000000000..77bb20abdf --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/JettyResponse.java @@ -0,0 +1,47 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package com.nr.agent.instrumentation.jetty10; + +import com.newrelic.api.agent.HeaderType; +import com.newrelic.api.agent.Response; + +import javax.servlet.http.HttpServletResponse; + +public class JettyResponse implements Response { + + private final HttpServletResponse delegate; + + public JettyResponse(HttpServletResponse response) { + this.delegate = response; + } + + @Override + public int getStatus() throws Exception { + return delegate.getStatus(); + } + + @Override + public String getStatusMessage() throws Exception { + return null; + } + + @Override + public void setHeader(String name, String value) { + delegate.setHeader(name, value); + } + + @Override + public String getContentType() { + return delegate.getContentType(); + } + + @Override + public HeaderType getHeaderType() { + return HeaderType.HTTP; + } +} diff --git a/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/ServerHelper.java b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/ServerHelper.java new file mode 100644 index 0000000000..1b834359c8 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/com/nr/agent/instrumentation/jetty10/ServerHelper.java @@ -0,0 +1,62 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package com.nr.agent.instrumentation.jetty10; + +import com.newrelic.agent.bridge.AgentBridge; +import org.eclipse.jetty.server.AsyncContextEvent; +import org.eclipse.jetty.server.Request; + +import javax.servlet.DispatcherType; +import javax.servlet.http.HttpServletResponse; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.logging.Level; + +public class ServerHelper { + + private static final AtomicBoolean HAS_CONTEXT_HANDLER = new AtomicBoolean(false); + + /** + * If there is a #ContextHandler, then Jetty is not embedded. + * + * @return true if there is a Jetty #ContextHandler. + */ + public static boolean hasContextHandler() { + return HAS_CONTEXT_HANDLER.get(); + } + + public static void contextHandlerFound() { + if (!HAS_CONTEXT_HANDLER.getAndSet(true)) { + AgentBridge.getAgent().getLogger().log(Level.FINE, "Detected Jetty ContextHandler"); + } + } + + public static void preHandle(Request request, HttpServletResponse response) { + if (request.getDispatcherType() == DispatcherType.ASYNC) { + /* + * We have to go through the HttpChannelState here to get the AsyncContext because calling + * request.getAsyncContext() when the dispatcherType is ASYNC throws an IllegalStateException (Boo, Jetty!) + */ + AsyncContextEvent asyncContextEvent = request.getHttpChannelState().getAsyncContextEvent(); + if (asyncContextEvent == null) { + AgentBridge.getAgent().getLogger().log(Level.FINE, "AsyncContextEvent is null for request: {0}.", request); + return; + } + AgentBridge.asyncApi.resumeAsync(asyncContextEvent.getAsyncContext()); + } else { + AgentBridge.getAgent().getTransaction(true).requestInitialized(new JettyRequest(request), + new JettyResponse(response)); + } + } + + public static void postHandle(Request request) { + if (request.isAsyncStarted()) { + AgentBridge.asyncApi.suspendAsync(request.getAsyncContext()); + } + AgentBridge.getAgent().getTransaction().requestDestroyed(); + } +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpChannel_Instrumentation.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpChannel_Instrumentation.java new file mode 100644 index 0000000000..9aea7a115a --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpChannel_Instrumentation.java @@ -0,0 +1,27 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server; + +import com.newrelic.api.agent.NewRelic; +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import org.eclipse.jetty.http.MetaData; +import org.eclipse.jetty.util.Callback; + +import java.nio.ByteBuffer; + +@Weave(type = MatchType.ExactClass, originalName = "org.eclipse.jetty.server.HttpChannel") +public abstract class HttpChannel_Instrumentation { + + protected boolean sendResponse(MetaData.Response response, ByteBuffer content, boolean complete, final Callback callback) { + NewRelic.getAgent().getTransaction().addOutboundResponseHeaders(); + return Weaver.callOriginal(); + } + +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpTransport.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpTransport.java new file mode 100644 index 0000000000..deac9e941f --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/HttpTransport.java @@ -0,0 +1,27 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server; + +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import org.eclipse.jetty.http.MetaData; +import org.eclipse.jetty.util.Callback; + +import java.nio.ByteBuffer; + +@Weave(type = MatchType.Interface, originalName = "org.eclipse.jetty.server.HttpTransport") +public abstract class HttpTransport { + + // This method signature was changed in Jetty Server 10. Only weaving this to prevent this module from applying + // to Jetty 9 and causing double instrumentation via the jetty-9.3 and jetty-10 instrumentation modules. + public void send(MetaData.Request request, MetaData.Response response, ByteBuffer content, boolean lastContent, Callback callback) { + Weaver.callOriginal(); + } + +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/JettySampler.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/JettySampler.java new file mode 100644 index 0000000000..a4819f2c02 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/JettySampler.java @@ -0,0 +1,80 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server; + +import com.newrelic.agent.bridge.AgentBridge; +import com.newrelic.api.agent.NewRelic; +import org.eclipse.jetty.util.thread.ThreadPool; + +import java.text.MessageFormat; + +public class JettySampler implements Runnable { + + private final org.eclipse.jetty.server.Server server; + + public JettySampler(org.eclipse.jetty.server.Server server) { + this.server = server; + + AgentBridge.publicApi.setServerInfo("jetty", org.eclipse.jetty.server.Server.getVersion()); + + reportServerPort(server); + } + + private void reportServerPort(Server server) { + for (Connector connector : server.getConnectors()) { + if (connector instanceof NetworkConnector) { + AgentBridge.publicApi.setAppServerPort(((NetworkConnector) connector).getPort()); + return; + } + } + } + + @Override + public void run() { + + // we probably don't need to compute this each sample period + int acceptorThreadCount = 0; + for (Connector connector : server.getConnectors()) { + if (connector instanceof AbstractConnector) { + acceptorThreadCount += ((AbstractConnector) connector).getAcceptors(); + } + } + + final ThreadPool threadPool = server.getThreadPool(); + if (threadPool != null) { + final String name = threadPool.getClass().getSimpleName(); + + int totalThreads, busyThreads; + + int threadCount = threadPool.getThreads(); + int idleCount = threadPool.getIdleThreads(); + + // Jetty9 ExecutorThreadPool doesn't expose getMaxThreads(), so just approximate usage + int maxThreadCount = threadCount; + + totalThreads = maxThreadCount; + busyThreads = threadCount - idleCount; + + totalThreads -= acceptorThreadCount; + busyThreads -= acceptorThreadCount; + + String metricName = MessageFormat.format("RequestThreads/{0}/total", name); + NewRelic.recordMetric(metricName, totalThreads); + + metricName = MessageFormat.format("RequestThreads/{0}/busy", name); + NewRelic.recordMetric(metricName, busyThreads); + + float instanceBusy = 0; + if (totalThreads > 0) { + instanceBusy = ((float) busyThreads) / ((float) totalThreads); + } + metricName = "Instance/Busy"; + NewRelic.recordMetric(metricName, instanceBusy); + } + } +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Request.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Request.java new file mode 100644 index 0000000000..345129a258 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Request.java @@ -0,0 +1,50 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server; + +import com.newrelic.agent.bridge.AgentBridge; +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import com.nr.agent.instrumentation.jetty10.AsyncListenerFactory; + +import javax.servlet.AsyncContext; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.util.logging.Level; + +@Weave(type = MatchType.ExactClass, originalName = "org.eclipse.jetty.server.Request") +public abstract class Request implements HttpServletRequest { + + @Override + public AsyncContext startAsync(ServletRequest request, ServletResponse response) { + AsyncContext asyncContext = Weaver.callOriginal(); + + asyncContext.addListener(AsyncListenerFactory.getAsyncListener()); + AgentBridge.getAgent().getLogger().log(Level.FINER, "Added async listener"); + + return asyncContext; + } + + @Override + public AsyncContext startAsync() { + + AsyncContext asyncContext = Weaver.callOriginal(); + + asyncContext.addListener(AsyncListenerFactory.getAsyncListener()); + AgentBridge.getAgent().getLogger().log(Level.FINER, "Added async listener"); + + return asyncContext; + } + + public abstract HttpChannelState getHttpChannelState(); + + public abstract Response getResponse(); + +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Server.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Server.java new file mode 100644 index 0000000000..67596aa993 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/Server.java @@ -0,0 +1,53 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server; + +import com.newrelic.agent.bridge.AgentBridge; +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import com.nr.agent.instrumentation.jetty10.ServerHelper; +import org.eclipse.jetty.util.thread.ThreadPool; + +import java.util.concurrent.TimeUnit; + +@Weave(type = MatchType.ExactClass, originalName = "org.eclipse.jetty.server.Server") +public abstract class Server { + + public abstract Connector[] getConnectors(); + + public abstract ThreadPool getThreadPool(); + + protected void doStart() { + AgentBridge.privateApi.addSampler(new JettySampler(this), 1, TimeUnit.MINUTES); + Weaver.callOriginal(); + } + + public void handle(HttpChannel connection) { + Request request = connection.getRequest(); + boolean isStarted = AgentBridge.getAgent().getTransaction().isStarted(); + // if there is a #ContextHolder, then this is not embedded Jetty, so the transaction should start there + boolean hasContextHolder = ServerHelper.hasContextHandler(); + boolean startTransaction = request != null && !isStarted && !hasContextHolder; + + if (startTransaction) { + ServerHelper.preHandle(request, request.getResponse()); + } + try { + Weaver.callOriginal(); + } finally { + if (startTransaction) { + ServerHelper.postHandle(request); + } + } + } + + public static String getVersion() { + return Weaver.callOriginal(); + } +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java new file mode 100644 index 0000000000..9731e9d523 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -0,0 +1,49 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server.handler; + +import com.newrelic.agent.bridge.AgentBridge; +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import com.nr.agent.instrumentation.jetty10.ServerHelper; +import org.eclipse.jetty.server.Request; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Weave(type = MatchType.ExactClass, originalName = "org.eclipse.jetty.server.handler.ContextHandler") +public abstract class ContextHandler { + + public ContextHandler() { + ServerHelper.contextHandlerFound(); + } + + /** + * This should be the Transaction start point if Jetty is not embedded. It's a fix for JAVA-877: Agent can block + * finishing a transaction in Jetty. When the transaction start point was in #Server handle, the Agent could block + * in #HttpInput read when finishing the transaction. Starting the transaction in #ContextHandler fixed the problem. + */ + public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + boolean isStarted = AgentBridge.getAgent().getTransaction().isStarted(); + + if (request != null && !isStarted) { + ServerHelper.preHandle(baseRequest, response); + } + + try { + Weaver.callOriginal(); + } finally { + if (request != null && !isStarted) { + ServerHelper.postHandle(baseRequest); + } + } + } + + public abstract String getContextPath(); +} diff --git a/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java new file mode 100644 index 0000000000..4c9a7216d2 --- /dev/null +++ b/instrumentation/jetty-10/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java @@ -0,0 +1,36 @@ +/* + * + * * Copyright 2022 New Relic Corporation. All rights reserved. + * * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.eclipse.jetty.server.handler; + +import com.newrelic.api.agent.NewRelic; +import com.newrelic.api.agent.weaver.MatchType; +import com.newrelic.api.agent.weaver.NewField; +import com.newrelic.api.agent.weaver.Weave; +import com.newrelic.api.agent.weaver.Weaver; +import org.eclipse.jetty.server.Request; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Weave(type = MatchType.ExactClass, originalName = "org.eclipse.jetty.server.handler.ErrorHandler") +public abstract class ErrorHandler { + @NewField + private static final String EXCEPTION_ATTRIBUTE_NAME = "javax.servlet.error.exception"; + + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { + final Throwable throwable = (Throwable) request.getAttribute(EXCEPTION_ATTRIBUTE_NAME); + + // call the original implementation + Weaver.callOriginal(); + + if (throwable != null) { + NewRelic.noticeError(throwable); + } + } + +} diff --git a/instrumentation/jetty-9.3/src/main/java/com/nr/agent/instrumentation/jetty93/AsyncListenerFactory.java b/instrumentation/jetty-9.3/src/main/java/com/nr/agent/instrumentation/jetty93/AsyncListenerFactory.java index 7e20150927..77d8df91e6 100644 --- a/instrumentation/jetty-9.3/src/main/java/com/nr/agent/instrumentation/jetty93/AsyncListenerFactory.java +++ b/instrumentation/jetty-9.3/src/main/java/com/nr/agent/instrumentation/jetty93/AsyncListenerFactory.java @@ -18,7 +18,7 @@ public final class AsyncListenerFactory { - /* + /* * The public enum Action was added in 9.1 and does not exist in 9.0.*. So declaring a variable of this type is * sufficient to prevent this instrumentation module from loading in 9.0.*. */ diff --git a/instrumentation/jetty-servlet-9/build.gradle b/instrumentation/jetty-servlet-9/build.gradle index aa5a33da2e..37beb95e73 100644 --- a/instrumentation/jetty-servlet-9/build.gradle +++ b/instrumentation/jetty-servlet-9/build.gradle @@ -1,11 +1,28 @@ - dependencies { implementation(project(":agent-bridge")) - - implementation("org.eclipse.jetty:jetty-servlet:9.0.3.v20130506") + implementation("org.eclipse.jetty:jetty-servlet:9.0.6.v20130930") } jar { manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.jetty-servlet-9' } } + +verifyInstrumentation { + // For newer versions of Jetty this instrumentation has moved to the jetty-9.x and jetty-10.x modules + passesOnly 'org.eclipse.jetty:jetty-servlet:[7.0.0.v20091005,9.0.7.v20131107)' + + excludeRegex ".*(RC|M).*" + + // Old versions with weave violations + exclude 'org.eclipse.jetty:jetty-servlet:8.2.0.v20160908' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.22.v20160922' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.21.v20160908' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.20.v20160902' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.19.v20160209' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.18.v20150929' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.17.v20150415' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.16.v20140903' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.15.v20140411' + exclude 'org.eclipse.jetty:jetty-servlet:8.1.14.v20131031' +} diff --git a/instrumentation/jms-1.1/build.gradle b/instrumentation/jms-1.1/build.gradle index 425706cff1..76494ba430 100644 --- a/instrumentation/jms-1.1/build.gradle +++ b/instrumentation/jms-1.1/build.gradle @@ -1,11 +1,12 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.jms:jms-api:1.1-rev-1") + implementation 'jakarta.jms:jakarta.jms-api:2.0.3' - testImplementation("org.apache.activemq:activemq-broker:5.8.0") - testImplementation("org.hornetq:hornetq-core-client:2.3.0.Final") - testImplementation("org.hornetq:hornetq-jms-client:2.3.0.Final") - testImplementation("org.hornetq:hornetq-jms-server:2.3.0.Final") { + // org.apache.activemq:activemq-broker:5.17.0 and above requires Java 11 + testImplementation('org.apache.activemq:activemq-broker:5.16.5') + testImplementation("org.hornetq:hornetq-core-client:2.4.9.Final") + testImplementation("org.hornetq:hornetq-jms-client:2.4.9.Final") + testImplementation("org.hornetq:hornetq-jms-server:2.4.9.Final") { exclude(group: "org.jboss.naming", module: "jnpserver") } } @@ -14,8 +15,13 @@ jar { manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.jms-1.1' } } +verifyInstrumentation { + passesOnly 'javax.jms:jms-api:[1.1-rev-1,)' + passesOnly 'jakarta.jms:jakarta.jms-api:[2.0.2,3.0.0-RC1)' +} + site { title 'JMS' type 'Messaging' - versionOverride '[1.1,)' -} \ No newline at end of file + versionOverride '[1.1,3.0.0)' +} diff --git a/instrumentation/jsp-2.4/build.gradle b/instrumentation/jsp-2.4/build.gradle index d7cd69903e..95e8d17bd1 100644 --- a/instrumentation/jsp-2.4/build.gradle +++ b/instrumentation/jsp-2.4/build.gradle @@ -1,16 +1,26 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:jsp-api:2.0") - implementation("javax.servlet:servlet-api:2.4") + implementation("jakarta.servlet.jsp:jakarta.servlet.jsp-api:2.3.6") + implementation("jakarta.servlet:jakarta.servlet-api:4.0.4") } jar { manifest { attributes 'Implementation-Title': 'com.newrelic.instrumentation.jsp-2.4' } } +verifyInstrumentation { + passesOnly 'javax.servlet:jsp-api:[2.0,)' + passesOnly 'javax.servlet.jsp:jsp-api:[2.0,)' + passesOnly 'jakarta.servlet.jsp:jakarta.servlet.jsp-api:[2.3.4,3.0.0-M1)' + + exclude 'javax.servlet:jsp-api:2.0.public_draft' + // this version seems to have a bad metadata descriptor + exclude 'javax.servlet.jsp:jsp-api:2.1.2' +} + site { title 'JSP' type 'Other' - versionOverride '[2.0,2.2)' -} \ No newline at end of file + versionOverride '[2.0,3.0)' +} diff --git a/instrumentation/play-2.6.13/build.gradle b/instrumentation/play-2.6.13/build.gradle index a4f3c2e751..c4d0b46a8e 100644 --- a/instrumentation/play-2.6.13/build.gradle +++ b/instrumentation/play-2.6.13/build.gradle @@ -32,7 +32,7 @@ dependencies { testImplementation("com.typesafe.play:play-test_2.11:2.6.13") testImplementation("com.typesafe.play:play-java_2.11:2.6.13") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } jar { diff --git a/instrumentation/play-2.6/build.gradle b/instrumentation/play-2.6/build.gradle index 11f85c39a5..bf1b4f37d2 100644 --- a/instrumentation/play-2.6/build.gradle +++ b/instrumentation/play-2.6/build.gradle @@ -32,7 +32,7 @@ dependencies { testImplementation("com.typesafe.play:play-test_2.11:2.6.0") testImplementation("com.typesafe.play:play-java_2.11:2.6.0") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } jar { diff --git a/instrumentation/play-2.7/build.gradle b/instrumentation/play-2.7/build.gradle index b1a8b43483..5f2900bb7d 100644 --- a/instrumentation/play-2.7/build.gradle +++ b/instrumentation/play-2.7/build.gradle @@ -32,7 +32,7 @@ dependencies { testImplementation("com.typesafe.play:play-test_2.11:2.7.0-M2") testImplementation("com.typesafe.play:play-java_2.11:2.7.0-M2") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } jar { diff --git a/instrumentation/servlet-2.4/build.gradle b/instrumentation/servlet-2.4/build.gradle index 8b088d8418..c8dcd347ca 100644 --- a/instrumentation/servlet-2.4/build.gradle +++ b/instrumentation/servlet-2.4/build.gradle @@ -1,7 +1,6 @@ - dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:servlet-api:2.4") + implementation('jakarta.servlet:jakarta.servlet-api:4.0.4') } jar { @@ -9,13 +8,12 @@ jar { } verifyInstrumentation { - passesOnly 'javax.servlet:servlet-api:[2.4,)' - + passesOnly 'jakarta.servlet:jakarta.servlet-api:[4.0.2,5.0.0-M1)' exclude 'javax.servlet:servlet-api:2.4.public_draft' } site { title 'Servlet' type 'Framework' -} \ No newline at end of file +} diff --git a/instrumentation/servlet-user/build.gradle b/instrumentation/servlet-user/build.gradle index e32584035b..1cd7b98e97 100644 --- a/instrumentation/servlet-user/build.gradle +++ b/instrumentation/servlet-user/build.gradle @@ -1,7 +1,7 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:servlet-api:2.4") + implementation('jakarta.servlet:jakarta.servlet-api:4.0.4') } jar { @@ -9,9 +9,8 @@ jar { } verifyInstrumentation { - passesOnly 'javax.servlet:servlet-api:[2.3,)' - + passesOnly 'jakarta.servlet:jakarta.servlet-api:[4.0.2,5.0.0-M1)' exclude 'javax.servlet:servlet-api:2.4.public_draft' } diff --git a/instrumentation/spray-http-1.3.1/build.gradle b/instrumentation/spray-http-1.3.1/build.gradle index 32e76688af..c55d1c527a 100644 --- a/instrumentation/spray-http-1.3.1/build.gradle +++ b/instrumentation/spray-http-1.3.1/build.gradle @@ -18,7 +18,7 @@ dependencies { testImplementation(project(":instrumentation:akka-2.2")) { transitive = false } testImplementation(project(":instrumentation:scala-2.9.3")) { transitive = false } testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.spray:spray-can_2.10:1.3.3") } diff --git a/instrumentation/spring-jms-2/build.gradle b/instrumentation/spring-jms-2/build.gradle index 72193b3cb7..e6a08641ed 100644 --- a/instrumentation/spring-jms-2/build.gradle +++ b/instrumentation/spring-jms-2/build.gradle @@ -1,8 +1,8 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.jms:jms-api:1.1-rev-1") - implementation("org.springframework:spring-jms:2.0") + implementation("jakarta.jms:jakarta.jms-api:2.0.3") + implementation("org.springframework:spring-jms:5.3.21") } jar { @@ -10,20 +10,13 @@ jar { } verifyInstrumentation { - // we'll verify against spring-jms 2.0 anyway, but we can't verify against the classpath (yet) because - // classpath verification adds jms-1.1 project to the classpath and the weaver doesn't allow redefining - // existing classes - it only allows weaving them - so these utility classes throw some API violations: - // WeaveViolation{type=ILLEGAL_CLASS_NAME, clazz=com/nr/agent/instrumentation/jms11/JmsMetricUtil} - // WeaveViolation{type=ILLEGAL_CLASS_NAME, clazz=com/nr/agent/instrumentation/jms11/InboundWrapper} - // ...I think this is desired, but we may want to revisit in the future. for now set verifyClasspath=false - verifyClasspath = false - exclude 'org.springframework:spring-jms:3.2.0.BUILD' - // This is a bad artifact on artifactory - excludeRegex 'org.springframework:spring-jms:5.0.0.(RC)[0-9]*$' passesOnly 'org.springframework:spring-jms:[0,)' + exclude 'org.springframework:spring-jms:3.2.0.BUILD' + // This is a bad artifact on artifactory + excludeRegex 'org.springframework:spring-jms:5.0.0.(RC)[0-9]*$' } site { title 'Spring JMS' type 'Messaging' -} \ No newline at end of file +} diff --git a/instrumentation/spring-ws-2.0/build.gradle b/instrumentation/spring-ws-2.0/build.gradle index b3f5edb7bc..7cbddced7c 100644 --- a/instrumentation/spring-ws-2.0/build.gradle +++ b/instrumentation/spring-ws-2.0/build.gradle @@ -1,11 +1,10 @@ dependencies { implementation(project(":agent-bridge")) - implementation("org.springframework.ws:spring-ws-core:2.2.0.RELEASE") - implementation("org.apache.ws.commons.axiom:axiom-api:1.2.14") + implementation("org.springframework.ws:spring-ws-core:3.1.3") + implementation("org.apache.ws.commons.axiom:axiom-api:1.4.0") // This is needed to allow tests to run on JDK 11 (since javax.xml was removed in JDK 11) - testImplementation("javax.xml.soap:javax.xml.soap-api:1.4.0") - + testImplementation("jakarta.xml.soap:jakarta.xml.soap-api:1.4.2") } jar { @@ -14,11 +13,10 @@ jar { verifyInstrumentation { passesOnly('org.springframework.ws:spring-ws-core:[1.5.7,)'){ - compile("org.apache.ws.commons.axiom:axiom-api:1.2.14") + compile("org.apache.ws.commons.axiom:axiom-api:1.4.0") } // version 3.1.0 fails but then 3.1.1 passes again exclude('org.springframework.ws:spring-ws-core:3.1.0') - // instrumentation does not work in 3.0.11. It was likely a bad release, 3.0.12 was released 2 days later. exclude('org.springframework.ws:spring-ws-core:3.0.11.RELEASE') } @@ -32,4 +30,4 @@ test { site { title 'Spring Web Services' type 'Framework' -} \ No newline at end of file +} diff --git a/instrumentation/tomcat-8.5.2/build.gradle b/instrumentation/tomcat-8.5.2/build.gradle index d4d4730370..b59248bb4b 100644 --- a/instrumentation/tomcat-8.5.2/build.gradle +++ b/instrumentation/tomcat-8.5.2/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation(project(":agent-bridge")) - implementation("org.apache.tomcat.embed:tomcat-embed-core:8.5.2") + implementation("org.apache.tomcat.embed:tomcat-embed-core:9.0.64") } jar { @@ -9,11 +9,10 @@ jar { verifyInstrumentation { passesOnly 'org.apache.tomcat.embed:tomcat-embed-core:[8.5.2,10.0.0-M1)' - excludeRegex 'org.apache.tomcat.embed:tomcat-embed-core:9.0.0.M.*' } site { title 'Apache Tomcat' type 'Appserver' -} \ No newline at end of file +} diff --git a/instrumentation/tomcat-request-listener/build.gradle b/instrumentation/tomcat-request-listener/build.gradle index fd91e0955e..f56574c89e 100644 --- a/instrumentation/tomcat-request-listener/build.gradle +++ b/instrumentation/tomcat-request-listener/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation(project(":agent-bridge")) - implementation("org.apache.tomcat.embed:tomcat-embed-core:7.0.59") + implementation("org.apache.tomcat.embed:tomcat-embed-core:9.0.64") } jar { diff --git a/instrumentation/vertx-web-3.2.0/build.gradle b/instrumentation/vertx-web-3.2.0/build.gradle index 4eac2fe318..a398f5323c 100644 --- a/instrumentation/vertx-web-3.2.0/build.gradle +++ b/instrumentation/vertx-web-3.2.0/build.gradle @@ -14,7 +14,7 @@ dependencies { testImplementation("io.vertx:vertx-sql-common:3.2.0") testImplementation("io.vertx:vertx-jdbc-client:3.2.0") testImplementation("org.hsqldb:hsqldb:2.3.4") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") } verifyInstrumentation { diff --git a/instrumentation/vertx-web-3.3.0/build.gradle b/instrumentation/vertx-web-3.3.0/build.gradle index 423065016a..96343a5146 100644 --- a/instrumentation/vertx-web-3.3.0/build.gradle +++ b/instrumentation/vertx-web-3.3.0/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.3.0") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.4.2") testImplementation("io.vertx:vertx-sql-common:3.4.2") diff --git a/instrumentation/vertx-web-3.5.0/build.gradle b/instrumentation/vertx-web-3.5.0/build.gradle index ce7c66759d..bb4c90861f 100644 --- a/instrumentation/vertx-web-3.5.0/build.gradle +++ b/instrumentation/vertx-web-3.5.0/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.5.0") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.5.0") testImplementation("io.vertx:vertx-sql-common:3.5.0") diff --git a/instrumentation/vertx-web-3.5.1/build.gradle b/instrumentation/vertx-web-3.5.1/build.gradle index 6cd445d0e0..e66e3fb11b 100644 --- a/instrumentation/vertx-web-3.5.1/build.gradle +++ b/instrumentation/vertx-web-3.5.1/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.5.1") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.5.1") testImplementation("io.vertx:vertx-sql-common:3.5.1") diff --git a/instrumentation/vertx-web-3.5.2/build.gradle b/instrumentation/vertx-web-3.5.2/build.gradle index 7f9febd048..af8d9c0b99 100644 --- a/instrumentation/vertx-web-3.5.2/build.gradle +++ b/instrumentation/vertx-web-3.5.2/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.5.2") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.5.2") testImplementation("io.vertx:vertx-sql-common:3.5.2") diff --git a/instrumentation/vertx-web-3.6.0/build.gradle b/instrumentation/vertx-web-3.6.0/build.gradle index e204531e55..753b04802e 100644 --- a/instrumentation/vertx-web-3.6.0/build.gradle +++ b/instrumentation/vertx-web-3.6.0/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.6.0") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.7.0") testImplementation("io.vertx:vertx-sql-common:3.7.0") diff --git a/instrumentation/vertx-web-3.8.0/build.gradle b/instrumentation/vertx-web-3.8.0/build.gradle index 12e9ee9e31..7e275d031d 100644 --- a/instrumentation/vertx-web-3.8.0/build.gradle +++ b/instrumentation/vertx-web-3.8.0/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.8.0") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.8.0") testImplementation("io.vertx:vertx-sql-common:3.8.0") diff --git a/instrumentation/vertx-web-3.8.3/build.gradle b/instrumentation/vertx-web-3.8.3/build.gradle index bca1911e7a..fa3c3d495d 100644 --- a/instrumentation/vertx-web-3.8.3/build.gradle +++ b/instrumentation/vertx-web-3.8.3/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation("io.vertx:vertx-web:3.8.3") testImplementation("com.jayway.restassured:rest-assured:2.7.0") - testImplementation("javax.xml.bind:jaxb-api:2.3.0") + testImplementation("jakarta.xml.ws:jakarta.xml.ws-api:2.3.3") testImplementation("io.vertx:vertx-web:3.8.3") testImplementation("io.vertx:vertx-sql-common:3.8.3") diff --git a/instrumentation/websphere-liberty-profile-8.5.5.5/build.gradle b/instrumentation/websphere-liberty-profile-8.5.5.5/build.gradle index d061f5f228..56d3d40bf9 100644 --- a/instrumentation/websphere-liberty-profile-8.5.5.5/build.gradle +++ b/instrumentation/websphere-liberty-profile-8.5.5.5/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:javax.servlet-api:3.0.1") + implementation('jakarta.servlet:jakarta.servlet-api:4.0.4') implementation(fileTree(include: ["*.jar"], dir: "lib")) } @@ -25,4 +25,4 @@ site { title 'WebSphere Liberty' type 'Appserver' versionOverride '[8.5,)' -} \ No newline at end of file +} diff --git a/instrumentation/wildfly-8-CAT/build.gradle b/instrumentation/wildfly-8-CAT/build.gradle index f764ace04d..fcc6455229 100644 --- a/instrumentation/wildfly-8-CAT/build.gradle +++ b/instrumentation/wildfly-8-CAT/build.gradle @@ -1,7 +1,6 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:javax.servlet-api:3.0.1") - implementation("io.undertow:undertow-core:1.0.0.Final") + implementation("io.undertow:undertow-core:2.2.18.Final") implementation("org.jboss.logging:jboss-logging:3.1.0.GA") } @@ -17,4 +16,4 @@ site { title 'Wildfly' type 'Appserver' versionOverride '[8.0.0.Final,)' -} \ No newline at end of file +} diff --git a/instrumentation/wildfly-8-CAT/src/main/java/io/undertow/server/HttpServerExchange.java b/instrumentation/wildfly-8-CAT/src/main/java/io/undertow/server/HttpServerExchange.java index 83f7ce23dc..b59b27931f 100644 --- a/instrumentation/wildfly-8-CAT/src/main/java/io/undertow/server/HttpServerExchange.java +++ b/instrumentation/wildfly-8-CAT/src/main/java/io/undertow/server/HttpServerExchange.java @@ -7,7 +7,6 @@ package io.undertow.server; -import com.newrelic.agent.bridge.AgentBridge; import com.newrelic.api.agent.NewRelic; import com.newrelic.api.agent.weaver.Weave; import com.newrelic.api.agent.weaver.Weaver; diff --git a/instrumentation/wildfly-8-PORT/build.gradle b/instrumentation/wildfly-8-PORT/build.gradle index 8881d33434..77270f8d0b 100644 --- a/instrumentation/wildfly-8-PORT/build.gradle +++ b/instrumentation/wildfly-8-PORT/build.gradle @@ -7,13 +7,12 @@ repositories { dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:javax.servlet-api:3.0.1") - implementation("org.wildfly:wildfly-undertow:8.0.0.Final") { + implementation("org.wildfly:wildfly-undertow:26.1.1.Final") { exclude(group: "org.jacorb", module: "jacorb") } - implementation("org.jboss.xnio:xnio-api:3.2.0.Final") - implementation("org.jboss.logging:jboss-logging:3.1.0.GA") - implementation("org.jboss.msc:jboss-msc:1.2.0.Final") + implementation("org.jboss.xnio:xnio-api:3.8.7.Final") + implementation("org.jboss.logging:jboss-logging:3.5.0.Final") + implementation("org.jboss.msc:jboss-msc:1.4.13.Final") } jar { @@ -29,4 +28,4 @@ site { title 'Wildfly' type 'Appserver' versionOverride '[8.0.0.Final,)' -} \ No newline at end of file +} diff --git a/instrumentation/wildfly-8/build.gradle b/instrumentation/wildfly-8/build.gradle index 1300af7a68..5fc8d95217 100644 --- a/instrumentation/wildfly-8/build.gradle +++ b/instrumentation/wildfly-8/build.gradle @@ -1,11 +1,10 @@ dependencies { implementation(project(":agent-bridge")) - implementation("javax.servlet:javax.servlet-api:3.0.1") - // 1.0 Final for the 8.0 wildfly release - implementation("io.undertow:undertow-servlet:1.0.0.Final") - implementation("io.undertow:undertow-core:1.0.0.Final") - implementation("org.jboss.logging:jboss-logging:3.1.0.GA") + implementation("jakarta.servlet:jakarta.servlet-api:4.0.4") + implementation("io.undertow:undertow-servlet:2.2.18.Final") + implementation("io.undertow:undertow-core:2.2.18.Final") + implementation("org.jboss.logging:jboss-logging:3.5.0.Final") } jar { @@ -20,4 +19,4 @@ site { title 'Wildfly' type 'Appserver' versionOverride '[8.0.0.Final,)' -} \ No newline at end of file +} diff --git a/instrumentation/wildfly-8/src/main/java/com/nr/agent/instrumentation/wildfly8/AsyncListenerFactory.java b/instrumentation/wildfly-8/src/main/java/com/nr/agent/instrumentation/wildfly8/AsyncListenerFactory.java index 66982dec3a..5b7fbdc50c 100644 --- a/instrumentation/wildfly-8/src/main/java/com/nr/agent/instrumentation/wildfly8/AsyncListenerFactory.java +++ b/instrumentation/wildfly-8/src/main/java/com/nr/agent/instrumentation/wildfly8/AsyncListenerFactory.java @@ -13,7 +13,6 @@ import javax.servlet.AsyncListener; import com.newrelic.agent.bridge.AgentBridge; -import com.newrelic.agent.bridge.Transaction; import com.newrelic.api.agent.weaver.CatchAndLog; public final class AsyncListenerFactory { diff --git a/settings.gradle b/settings.gradle index db8568bc74..10062a43f5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -185,6 +185,7 @@ include 'instrumentation:jetty-9' include 'instrumentation:jetty-9.0.4' include 'instrumentation:jetty-9.1' include 'instrumentation:jetty-9.3' +include 'instrumentation:jetty-10' include 'instrumentation:jetty-jmx-7' include 'instrumentation:jetty-servlet-9' include 'instrumentation:jms-1.1' @@ -343,3 +344,4 @@ include 'instrumentation:vertx-core-3.6.0' include 'instrumentation:vertx-core-3.8.0' include 'instrumentation:vertx-core-3.9.0' include 'instrumentation:zio' +