diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java index 83dcae0bbe5..73db580fc7b 100644 --- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java +++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java @@ -30,7 +30,6 @@ import org.apache.openejb.util.LogCategory; import org.apache.openejb.util.Logger; import org.apache.tomee.catalina.event.AfterApplicationCreated; -import org.apache.tomee.installer.Paths; import org.apache.tomee.microprofile.health.MicroProfileHealthChecksEndpoint; import org.apache.tomee.microprofile.openapi.MicroProfileOpenApiRegistration; import org.apache.tomee.microprofile.opentracing.MicroProfileOpenTracingExceptionMapper; @@ -42,7 +41,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; import java.net.URL; import java.security.CodeSource; import java.util.Collection; @@ -58,10 +56,6 @@ public class TomEEMicroProfileListener { private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB.createChild("tomcat"), TomEEMicroProfileListener.class); - private static final String[] MICROPROFILE_LIBS_IMPLS_PREFIXES = new String[]{ - "mp-common" - }; - private static final String[] MICROPROFILE_EXTENSIONS = new String[]{ "org.apache.tomee.microprofile.jwt.cdi.MPJWTCDIExtension", "org.apache.cxf.microprofile.client.cdi.RestClientExtension", @@ -72,7 +66,6 @@ public class TomEEMicroProfileListener { "io.smallrye.faulttolerance.FaultToleranceExtension", }; - @SuppressWarnings("Duplicates") public void enhanceScannableUrls(@Observes final EnhanceScannableUrlsEvent enhanceScannableUrlsEvent) { final String mpScan = SystemInstance.get().getOptions().get("tomee.mp.scan", "none"); @@ -98,17 +91,8 @@ public void enhanceScannableUrls(@Observes final EnhanceScannableUrlsEvent enhan } } - final Paths paths = new Paths(new File(System.getProperty("openejb.home"))); - for (final String prefix : MICROPROFILE_LIBS_IMPLS_PREFIXES) { - final File file = paths.findTomEELibJar(prefix); - if (file != null) { - try { - containerUrls.add(file.toURI().toURL()); - } catch (final MalformedURLException e) { - // ignored - } - } - } + // Add mp-common jar so classes like MicroProfileHealthChecksEndpoint are scanned as well + containerUrls.add(getClass().getProtectionDomain().getCodeSource().getLocation()); SystemInstance.get().setProperty("openejb.cxf-rs.cache-application", "false"); }