diff --git a/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache b/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache index dac99e33461..40e77eff6ea 100644 --- a/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache +++ b/archetypes/archetypes/src/main/archetype/mp/common/files/src/main/resources/logging.properties.mustache @@ -20,9 +20,6 @@ java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$ # Quiet Weld org.jboss.level=WARNING -# Quiet Jersey wadl support -org.glassfish.jersey.server.wadl.level=SEVERE - # Component specific log levels #io.helidon.config.level=INFO #io.helidon.security.level=INFO diff --git a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java index 5acf12c4a75..bad1134ed5b 100644 --- a/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java +++ b/microprofile/server/src/main/java/io/helidon/microprofile/server/JaxRsService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024 Oracle and/or its affiliates. + * Copyright (c) 2022, 2025 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,6 +66,7 @@ import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ContainerResponse; import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.ContainerResponseWriter; @@ -74,6 +75,7 @@ class JaxRsService implements HttpService { * If set to {@code "true"}, Jersey will ignore responses in exceptions. */ static final String IGNORE_EXCEPTION_RESPONSE = "jersey.config.client.ignoreExceptionResponse"; + static final String DISABLE_DATASOURCE_PROVIDER = "jersey.config.server.disableDataSourceProvider"; private static final System.Logger LOGGER = System.getLogger(JaxRsService.class.getName()); private static final Type REQUEST_TYPE = (new GenericType>() { }).getType(); @@ -96,12 +98,25 @@ private JaxRsService(ResourceConfig resourceConfig, static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) { + Config config = ConfigProvider.getConfig(); + + // Silence warnings from Jersey by disabling the default data source provider. See 9019. + // To pass TCK we support a system property to control whether or not we disable the default provider + // We also support the property via MicroProfile config in case a user wants to control the property. + boolean disableDatasourceProvider = config.getOptionalValue(DISABLE_DATASOURCE_PROVIDER, Boolean.class) + .orElseGet(() -> Boolean.parseBoolean(System.getProperty(DISABLE_DATASOURCE_PROVIDER, "true"))); + if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && disableDatasourceProvider) { + resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE")); + } + if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) { + resourceConfig.addProperties(Map.of(ServerProperties.WADL_FEATURE_DISABLE, "true")); + } + InjectionManager ij = injectionManager == null ? null : new InjectionManagerWrapper(injectionManager, resourceConfig); ApplicationHandler appHandler = new ApplicationHandler(resourceConfig, new WebServerBinder(), ij); Container container = new HelidonJerseyContainer(appHandler); - Config config = ConfigProvider.getConfig(); // This configuration via system properties is for the Jersey Client API. Any // response in an exception will be mapped to an empty one to prevent data leaks diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml index 9bc8a92c62d..2a5965720fe 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/pom.xml @@ -125,6 +125,7 @@ localhost 8080 false + false true false false diff --git a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties index 82d86a2bd88..0393d07acb7 100644 --- a/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties +++ b/microprofile/tests/tck/tck-restful/tck-restful-test/src/test/resources/META-INF/microprofile-config.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Oracle and/or its affiliates. +# Copyright (c) 2023, 2025 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.