Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOMEE-4295] load mp-common via codesource #1105

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 All @@ -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");
Expand All @@ -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");
}
Expand Down
Loading