Skip to content

Commit

Permalink
[TOMEE-4295] load mp-common via codesource instead of scanning for li…
Browse files Browse the repository at this point in the history
…b jar
  • Loading branch information
jungm authored and rzo1 committed Feb 2, 2024
1 parent e58a966 commit 8b21596
Showing 1 changed file with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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",
Expand Down Expand Up @@ -98,17 +92,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");
}
Expand Down

0 comments on commit 8b21596

Please sign in to comment.