diff --git a/appserver/payara-appserver-modules/microprofile/config/src/main/java/fish/payara/microprofile/config/activation/ConfigDeployer.java b/appserver/payara-appserver-modules/microprofile/config/src/main/java/fish/payara/microprofile/config/activation/ConfigDeployer.java index cb0b29f8aa2..fc61af77b36 100644 --- a/appserver/payara-appserver-modules/microprofile/config/src/main/java/fish/payara/microprofile/config/activation/ConfigDeployer.java +++ b/appserver/payara-appserver-modules/microprofile/config/src/main/java/fish/payara/microprofile/config/activation/ConfigDeployer.java @@ -69,16 +69,18 @@ public ConfigApplicationContainer load(ConfigContainer container, // This is performed here so that the ApplicationContainer executes regardless of CDI extension state final Types types = deploymentContext.getTransientAppMetaData(Types.class.getName(), Types.class); - final Type annotationType = types.getBy(ConfigProperty.class.getName()); - final Type classType = types.getBy(Config.class.getName()); - final boolean annotationFound = annotationType != null; - final boolean classFound = classType != null; + if (types != null) { + final Type annotationType = types.getBy(ConfigProperty.class.getName()); + final Type classType = types.getBy(Config.class.getName()); + final boolean annotationFound = annotationType != null; + final boolean classFound = classType != null; - if (annotationFound || classFound) { - // Register the CDI extension - final Collection> snifferExtensions = deploymentContext.getTransientAppMetaData(WeldDeployer.SNIFFER_EXTENSIONS, Collection.class); - if (snifferExtensions != null) { - snifferExtensions.add(ConfigCdiExtension::new); + if (annotationFound || classFound) { + // Register the CDI extension + final Collection> snifferExtensions = deploymentContext.getTransientAppMetaData(WeldDeployer.SNIFFER_EXTENSIONS, Collection.class); + if (snifferExtensions != null) { + snifferExtensions.add(ConfigCdiExtension::new); + } } } diff --git a/appserver/payara-appserver-modules/microprofile/metrics/src/main/java/fish/payara/microprofile/metrics/activation/MetricsSniffer.java b/appserver/payara-appserver-modules/microprofile/metrics/src/main/java/fish/payara/microprofile/metrics/activation/MetricsSniffer.java index 749218e6498..3641f5d6d38 100644 --- a/appserver/payara-appserver-modules/microprofile/metrics/src/main/java/fish/payara/microprofile/metrics/activation/MetricsSniffer.java +++ b/appserver/payara-appserver-modules/microprofile/metrics/src/main/java/fish/payara/microprofile/metrics/activation/MetricsSniffer.java @@ -53,7 +53,6 @@ import org.glassfish.api.deployment.DeploymentContext; import org.glassfish.api.deployment.archive.ReadableArchive; import org.glassfish.hk2.api.PerLookup; -import org.glassfish.hk2.classmodel.reflect.Type; import org.glassfish.hk2.classmodel.reflect.Types; import org.jvnet.hk2.annotations.Service; @@ -90,8 +89,15 @@ public Class[] getAnnotationTypes() { public boolean handles(DeploymentContext context) { final Types types = context.getTransientAppMetaData(Types.class.getName(), Types.class); - if (types.getBy(MetricRegistry.class.getName()) != null) return true; - if (types.getBy(Metric.class.getName()) != null) return true; + if (types != null) { + if (types.getBy(MetricRegistry.class.getName()) != null) { + return true; + } + + if (types.getBy(Metric.class.getName()) != null) { + return true; + } + } return super.handles(context); }