Skip to content

Commit 6f0ed46

Browse files
authored
Upgrade to Quarkus 3.19.0.CR1 (#37492)
Closes #37436 Signed-off-by: Martin Bartoš <[email protected]>
1 parent a3af12c commit 6f0ed46

File tree

33 files changed

+170
-139
lines changed

33 files changed

+170
-139
lines changed

docs/documentation/upgrading/topics/changes/changes-26_2_0.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ would now be `http://example.com`.
1313

1414
To mitigate that, either make your reverse proxy include the port in the `X-Forwarded-Host` header or configure it to set
1515
the `X-Forwarded-Port` header with the desired port.
16+
17+
=== Changes to installing Oracle JDBC driver
18+
19+
The required JAR for the Oracle JDBC driver that needs to be explicitly added to the distribution has changed.
20+
Instead of providing `ojdbc11` JAR, use `ojdbc17` JAR as stated in the https://www.keycloak.org/server/db#_installing_the_oracle_database_driver[Installing the Oracle Database driver] guide.

docs/guides/server/db.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ or skip this section if you want to connect to a different database for which th
5353

5454
To install the Oracle Database driver for {project_name}:
5555

56-
. Download the `ojdbc11` and `orai18n` JAR files from one of the following sources:
56+
. Download the `ojdbc17` and `orai18n` JAR files from one of the following sources:
5757

5858
.. *Zipped JDBC driver and Companion Jars* version ${properties["oracle-jdbc.version"]} from the https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html[Oracle driver download page].
5959

60-
.. Maven Central via `link:++https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/${properties["oracle-jdbc.version"]}/ojdbc11-${properties["oracle-jdbc.version"]}.jar++[ojdbc11]` and `link:++https://repo1.maven.org/maven2/com/oracle/database/nls/orai18n/${properties["oracle-jdbc.version"]}/orai18n-${properties["oracle-jdbc.version"]}.jar++[orai18n]`.
60+
.. Maven Central via `link:++https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc17/${properties["oracle-jdbc.version"]}/ojdbc17-${properties["oracle-jdbc.version"]}.jar++[ojdbc17]` and `link:++https://repo1.maven.org/maven2/com/oracle/database/nls/orai18n/${properties["oracle-jdbc.version"]}/orai18n-${properties["oracle-jdbc.version"]}.jar++[orai18n]`.
6161

6262
.. Installation media recommended by the database vendor for the specific database in use.
6363

64-
. When running the unzipped distribution: Place the `ojdbc11` and `orai18n` JAR files in {project_name}'s `providers` folder
64+
. When running the unzipped distribution: Place the `ojdbc17` and `orai18n` JAR files in {project_name}'s `providers` folder
6565

6666
. When running containers: Build a custom {project_name} image and add the JARs in the `providers` folder. When building a custom image for the Operator, those images need to be optimized images with all build-time options of {project_name} set.
6767
+
@@ -70,7 +70,7 @@ A minimal Containerfile to build an image which can be used with the {project_na
7070
[source,dockerfile,subs="attributes+"]
7171
----
7272
FROM quay.io/keycloak/keycloak:{containerlabel}
73-
ADD --chown=keycloak:keycloak --chmod=644 https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/${properties["oracle-jdbc.version"]}/ojdbc11-${properties["oracle-jdbc.version"]}.jar /opt/keycloak/providers/ojdbc11.jar
73+
ADD --chown=keycloak:keycloak --chmod=644 https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc17/${properties["oracle-jdbc.version"]}/ojdbc17-${properties["oracle-jdbc.version"]}.jar /opt/keycloak/providers/ojdbc17.jar
7474
ADD --chown=keycloak:keycloak --chmod=644 https://repo1.maven.org/maven2/com/oracle/database/nls/orai18n/${properties["oracle-jdbc.version"]}/orai18n-${properties["oracle-jdbc.version"]}.jar /opt/keycloak/providers/orai18n.jar
7575
# Setting the build parameter for the database:
7676
ENV KC_DB=oracle

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
<jboss.snapshots.repo.id>jboss-snapshots-repository</jboss.snapshots.repo.id>
5353
<jboss.snapshots.repo.url>https://s01.oss.sonatype.org/content/repositories/snapshots/</jboss.snapshots.repo.url>
5454

55-
<quarkus.version>3.18.3</quarkus.version>
56-
<quarkus.build.version>3.18.3</quarkus.build.version>
55+
<quarkus.version>3.19.0.CR1</quarkus.version>
56+
<quarkus.build.version>3.19.0.CR1</quarkus.build.version>
5757

5858
<project.build-time>${timestamp}</project.build-time>
5959

@@ -176,7 +176,7 @@
176176
<oracledb.version>23.5</oracledb.version>
177177
<oracledb.container>mirror.gcr.io/gvenzl/oracle-free:${oracledb.version}-slim-faststart</oracledb.container>
178178
<!-- this is the oracle driver version also used in the Quarkus BOM -->
179-
<oracle-jdbc.version>23.5.0.24.07</oracle-jdbc.version>
179+
<oracle-jdbc.version>23.6.0.24.10</oracle-jdbc.version>
180180

181181
<!-- Test -->
182182
<greenmail.version>2.1.0-alpha-1</greenmail.version>

quarkus/config-api/src/main/java/org/keycloak/config/OptionBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.stream.Collectors;
1010
import java.util.stream.Stream;
1111

12+
@SuppressWarnings({"unchecked", "OptionalUsedAsFieldOrParameterType", "rawtypes"})
1213
public class OptionBuilder<T> {
1314

1415
private static final List<String> BOOLEAN_TYPE_VALUES = List.of(Boolean.TRUE.toString(), Boolean.FALSE.toString());

quarkus/config-api/src/main/java/org/keycloak/config/database/Database.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ private String amendH2(String jdbcUrl) {
210210
"mssql"
211211
),
212212
ORACLE("oracle",
213-
"oracle.jdbc.xa.client.OracleXADataSource",
214-
"oracle.jdbc.driver.OracleDriver",
213+
"oracle.jdbc.datasource.OracleXADataSource",
214+
"oracle.jdbc.OracleDriver",
215215
"org.hibernate.dialect.OracleDialect",
216216
"jdbc:oracle:thin:@//${kc.db-url-host:localhost}:${kc.db-url-port:1521}/${kc.db-url-database:keycloak}",
217217
asList("liquibase.database.core.OracleDatabase")

quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void checkJdbcDriver(BuildProducer<JdbcDriverBuildItem> ignore) {
305305
@BuildStep
306306
@Produce(CheckMultipleDatasourcesBuildStep.class)
307307
void checkMultipleDatasourcesUseXA(TransactionManagerBuildTimeConfig transactionManagerConfig, DataSourcesBuildTimeConfig dataSourcesConfig, DataSourcesJdbcBuildTimeConfig jdbcConfig) {
308-
if (transactionManagerConfig.unsafeMultipleLastResources
308+
if (transactionManagerConfig.unsafeMultipleLastResources()
309309
.orElse(UnsafeMultipleLastResourcesMode.DEFAULT) != UnsafeMultipleLastResourcesMode.FAIL) {
310310
return;
311311
}
@@ -383,7 +383,7 @@ void configurePersistenceUnits(HibernateOrmConfig config,
383383
Properties properties = descriptor.getProperties();
384384
// register a listener for customizing the unit configuration at runtime
385385
runtimeConfigured.produce(new HibernateOrmIntegrationRuntimeConfiguredBuildItem("keycloak", descriptor.getName())
386-
.setInitListener(recorder.createUserDefinedUnitListener(properties.getProperty(AvailableSettings.DATASOURCE))));
386+
.setInitListener(recorder.createUserDefinedUnitListener(properties.getProperty(AvailableSettings.JAKARTA_JTA_DATASOURCE))));
387387
userManagedEntities.addAll(descriptor.getManagedClassNames());
388388
}
389389
}

quarkus/runtime/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<exclusions>
8282
<exclusion>
8383
<groupId>com.oracle.database.jdbc</groupId>
84-
<artifactId>ojdbc11</artifactId>
84+
<artifactId>ojdbc17</artifactId>
8585
</exclusion>
8686
<exclusion>
8787
<groupId>com.oracle.database.nls</groupId>

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import io.quarkus.arc.InstanceHandle;
2424
import io.quarkus.hibernate.orm.runtime.integration.HibernateOrmIntegrationRuntimeInitListener;
2525
import io.quarkus.runtime.RuntimeValue;
26-
import io.quarkus.runtime.ShutdownContext;
2726
import io.quarkus.runtime.annotations.Recorder;
2827
import io.vertx.core.Handler;
2928
import io.vertx.ext.web.RoutingContext;
@@ -70,9 +69,6 @@
7069
@Recorder
7170
public class KeycloakRecorder {
7271

73-
public static final String DEFAULT_HEALTH_ENDPOINT = "/health";
74-
public static final String DEFAULT_METRICS_ENDPOINT = "/metrics";
75-
7672
private static final Logger logger = Logger.getLogger(KeycloakRecorder.class);
7773

7874
public void initConfig() {
@@ -169,20 +165,11 @@ public void setDefaultUserProfileConfiguration(UPConfig configuration) {
169165
DeclarativeUserProfileProviderFactory.setDefaultConfig(configuration);
170166
}
171167

172-
public void registerShutdownHook(ShutdownContext shutdownContext) {
173-
shutdownContext.addShutdownTask(new Runnable() {
174-
@Override
175-
public void run() {
176-
QuarkusKeycloakSessionFactory.getInstance().close();
177-
}
178-
});
179-
}
180-
181168
public HibernateOrmIntegrationRuntimeInitListener createUserDefinedUnitListener(String name) {
182169
return new HibernateOrmIntegrationRuntimeInitListener() {
183170
@Override
184171
public void contributeRuntimeProperties(BiConsumer<String, Object> propertyCollector) {
185-
InstanceHandle<AgroalDataSource> instance = Arc.container().instance(
172+
try (InstanceHandle<AgroalDataSource> instance = Arc.container().instance(
186173
AgroalDataSource.class, new DataSource() {
187174
@Override public Class<? extends Annotation> annotationType() {
188175
return DataSource.class;
@@ -191,8 +178,9 @@ AgroalDataSource.class, new DataSource() {
191178
@Override public String value() {
192179
return name;
193180
}
194-
});
195-
propertyCollector.accept(AvailableSettings.DATASOURCE, instance.get());
181+
})) {
182+
propertyCollector.accept(AvailableSettings.JAKARTA_JTA_DATASOURCE, instance.get());
183+
}
196184
}
197185
};
198186
}

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/ExecutionExceptionHandler.java

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,45 @@
3232
import picocli.CommandLine;
3333
import picocli.CommandLine.ParseResult;
3434

35+
import java.util.HashMap;
36+
import java.util.Map;
37+
import java.util.function.Function;
38+
3539
public final class ExecutionExceptionHandler implements CommandLine.IExecutionExceptionHandler {
3640

37-
private Logger logger;
41+
private static Logger logger;
3842
private boolean verbose;
43+
private static Map<String, Function<Throwable, Throwable>> exceptionTransformers = new HashMap<>();
3944

4045
public ExecutionExceptionHandler() {}
4146

4247
@Override
4348
public int handleExecutionException(Exception cause, CommandLine cmd, ParseResult parseResult) {
44-
if (cause instanceof PropertyException) {
49+
var exception = handleExceptionTransformers(cause);
50+
if (exception instanceof PropertyException) {
4551
PrintWriter writer = cmd.getErr();
46-
writer.println(cmd.getColorScheme().errorText(cause.getMessage()));
47-
if (verbose && cause.getCause() != null) {
48-
dumpException(writer, cause.getCause());
52+
writer.println(cmd.getColorScheme().errorText(exception.getMessage()));
53+
if (verbose && exception.getCause() != null) {
54+
dumpException(writer, exception.getCause());
4955
}
50-
return ShortErrorMessageHandler.getInvalidInputExitCode(cause, cmd);
56+
return ShortErrorMessageHandler.getInvalidInputExitCode(exception, cmd);
5157
}
5258
error(cmd.getErr(), "Failed to run '" + parseResult.subcommands().stream()
5359
.map(ParseResult::commandSpec)
5460
.map(CommandLine.Model.CommandSpec::name)
5561
.findFirst()
56-
.orElse(Environment.getCommand()) + "' command.", cause);
62+
.orElse(Environment.getCommand()) + "' command.", exception);
5763
return cmd.getCommandSpec().exitCodeOnExecutionException();
5864
}
5965

6066
public void error(PrintWriter errorWriter, String message, Throwable cause) {
67+
var exception = handleExceptionTransformers(cause);
6168
if (message != null) {
6269
logError(errorWriter, "ERROR: " + message);
6370
}
6471

65-
if (cause != null) {
66-
dumpException(errorWriter, cause);
72+
if (exception != null) {
73+
dumpException(errorWriter, exception);
6774

6875
if (!verbose) {
6976
logError(errorWriter, "For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.");
@@ -121,7 +128,7 @@ private void logError(PrintWriter errorWriter, String errorMessage, Throwable ca
121128
}
122129
}
123130

124-
private Logger getLogger() {
131+
private static Logger getLogger() {
125132
if (logger == null) {
126133
logger = Logger.getLogger(ExecutionExceptionHandler.class);
127134
}
@@ -131,4 +138,34 @@ private Logger getLogger() {
131138
public void setVerbose(boolean verbose) {
132139
this.verbose = verbose;
133140
}
141+
142+
public static void addExceptionTransformer(Class<?> fromClass, Function<Throwable, Throwable> transformer) {
143+
if (exceptionTransformers.get(fromClass.getName()) != null) {
144+
getLogger().warnf("Transformer for the '%s' class is overridden", fromClass.getName());
145+
}
146+
exceptionTransformers.put(fromClass.getName(), transformer);
147+
}
148+
149+
public static void resetExceptionTransformers() {
150+
exceptionTransformers = new HashMap<>();
151+
}
152+
153+
private static Throwable handleExceptionTransformers(Throwable exception) {
154+
if (exception == null) {
155+
return null;
156+
}
157+
158+
if (exceptionTransformers.isEmpty()) {
159+
return exception;
160+
}
161+
162+
var stackTrace = exception.getStackTrace();
163+
for (var trace : stackTrace) {
164+
var transformer = exceptionTransformers.get(trace.getClassName());
165+
if (transformer != null) {
166+
return transformer.apply(exception);
167+
}
168+
}
169+
return exception;
170+
}
134171
}

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/ShortErrorMessageHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public int handleParseException(ParameterException ex, String[] args) {
9595
return getInvalidInputExitCode(ex, cmd);
9696
}
9797

98-
static int getInvalidInputExitCode(Exception ex, CommandLine cmd) {
98+
static int getInvalidInputExitCode(Throwable ex, CommandLine cmd) {
9999
return cmd.getExitCodeExceptionMapper() != null
100100
? cmd.getExitCodeExceptionMapper().getExitCode(ex)
101101
: cmd.getCommandSpec().exitCodeOnInvalidInput();

0 commit comments

Comments
 (0)