Skip to content

Commit

Permalink
Upgrades ojdbc to the latest version of 23 as of this writing (#9441)
Browse files Browse the repository at this point in the history
* Upgrades ojdbc to the latest version of 23 as of this writing

Signed-off-by: Laird Nelson <[email protected]>

* Squashable commit; backs out all special-purpose property handling and lets the UCP take care of all validation

Signed-off-by: Laird Nelson <[email protected]>

* Squashable commit; uptakes latest 23.x artifacts

Signed-off-by: Laird Nelson <[email protected]>

* Squashable commit; added --enable-url-protocols=http to mp-2's native-image.properties in an attempt to get the test to pass, or at least to expose other errors

Signed-off-by: Laird Nelson <[email protected]>

* Squashable commit; adds reflect-config.json to mp-2 packaging test; change not needed by this PR but is necessary for the otherwise unmodified test to pass

Signed-off-by: Laird Nelson <[email protected]>

* Adds provisional reflect-config.json in jersey/server to support certain parameter conversion use cases; adds useful properties to some integration tests to permit native image tracing more easily

Signed-off-by: Laird Nelson <[email protected]>

* Adds an exclusion for ucp11 to integrations/db/ojdbc/pom.xml per team consensus

Signed-off-by: Laird Nelson <[email protected]>

* Adjusts certain archetypes to depend on ucp11, not ucp. Eliminates no-longer-needed ucp dependency in messaging/connectors/aq.

Signed-off-by: Laird Nelson <[email protected]>

* Removes spurious exclusion in integrations/db/ojdbc/pom.xml

Signed-off-by: Laird Nelson <[email protected]>

---------

Signed-off-by: Laird Nelson <[email protected]>
  • Loading branch information
ljnelson authored Nov 20, 2024
1 parent e176d75 commit 3af58fe
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ For details on an Oracle Docker image, see https://github.com/oracle/docker-imag
</map>
<map>
<value key="groupId">com.oracle.database.jdbc</value>
<value key="artifactId">ucp</value>
<value key="artifactId">ucp11</value>
<value key="scope">runtime</value>
</map>
</list>
Expand Down
4 changes: 2 additions & 2 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@
<version.lib.neo4j>5.12.0</version.lib.neo4j>
<version.lib.netty>4.1.115.Final</version.lib.netty>
<version.lib.oci>3.54.0</version.lib.oci>
<version.lib.ojdbc.family>21</version.lib.ojdbc.family>
<version.lib.ojdbc.family>23</version.lib.ojdbc.family>
<!--
UCP versions 21.10.0.0 and up throw NPEs. There is a test to catch them.
Until this bug is fixed do not upgrade past version 21.9.0.0.
-->
<version.lib.ojdbc>${version.lib.ojdbc.family}.15.0.0</version.lib.ojdbc>
<version.lib.ojdbc>${version.lib.ojdbc.family}.6.0.24.10</version.lib.ojdbc>
<version.lib.ojdbc8>${version.lib.ojdbc}</version.lib.ojdbc8>
<!-- Force upgrade okio for CVE-2023-3635. When okhttp 4.12.0 is available we can remove this -->
<version.lib.okio>3.4.0</version.lib.okio>
Expand Down
2 changes: 1 addition & 1 deletion integrations/cdi/datasource-ucp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp</artifactId>
<artifactId>ucp11</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,14 @@ private static PoolDataSource createDataSource(Instance<Object> instance,
for (PropertyDescriptor pd : pds) {
if (propertyName.equals(pd.getName())) {
// We have matched a Java Beans property on the PoolDataSource implementation class. Set it
// if we can. Note that these properties are NOT those of the PoolDataSource's *underlying*
// "real" connection factory (usually a DataSource that provides the actual connections
// ultimately pooled by the Universal Connection Pool). Those are handled in a manner
// unfortunately restricted by the limited configuration mechanism belonging to the
// PoolDataSource implementation itself via the connectionFactoryProperties object. See
// below.
// if we can. PoolDataSourceImpl Java Beans properties happen to be either String-, int-,
// long-, or boolean-typed properties only.
//
// Note that these properties are NOT those of the PoolDataSource's *underlying* "real"
// connection factory (usually a DataSource that provides the actual connections ultimately
// pooled by the Universal Connection Pool). Those are handled in a manner unfortunately
// restricted by the limited configuration mechanism belonging to the PoolDataSource
// implementation itself via the connectionFactoryProperties object. See below.
Method writeMethod = pd.getWriteMethod();
if (writeMethod != null) {
Class<?> type = pd.getPropertyType();
Expand All @@ -210,68 +212,29 @@ private static PoolDataSource createDataSource(Instance<Object> instance,
}
}
if (!handled) {
// We have found a property that is not a Java Beans property of the PoolDataSource, but is
// supposed to be a property of the connection factory that it wraps.
// We have found a property that is not a writable Java Beans property of the PoolDataSource,
// but is supposed to be a writable Java Beans property of the connection factory that it wraps.
//
// (Sadly, "serviceName" and "pdbRoles" are special properties that have significance to certain
// connection factories (such as Oracle database-oriented DataSources), and to the
// oracle.ucp.jdbc.UCPConnectionBuilder class, which underlies getConnection(user, password)
// calls, but which sadly cannot be set on a PoolDataSource except by means of some irrelevant
// XML configuration. We work around this design and special case it below, not here.)
//
// Sadly, the Universal Connection Pool lacks a mechanism to tunnel arbitrary Java
// Sadly, the Universal Connection Pool lacks a mechanism to send *arbitrarily-typed* Java
// Beans-conformant property values destined for the underlying connection factory (which is
// usually a DataSource or ConnectionPoolDataSource implementation, but may be other things)
// through to that underlying connection factory with arbitrary type information set
// properly. Because the PoolDataSource is in charge of instantiating the connection factory
// (the underlying DataSource), you can't pass a fully configured DataSource into it, nor can
// you access an unconfigured instance of it that you can work with. The only configuration the
// Universal Connection Pool supports is via a Properties object, whose values are retrieved by
// the PoolDataSource implementation, as Strings. This limits the kinds of underlying
// connection factories (DataSource implementations, usually) that can be fully configured with
// the Universal Connection Pool to Strings and those Strings which can be converted by the
// PoolDataSourceImpl#toBasicType(String, String) method.
// usually a DataSource or ConnectionPoolDataSource implementation, but may be other things) to
// that underlying connection factory. Because the PoolDataSource is in charge of instantiating
// the connection factory, you can't pass a fully configured DataSource into it, nor can you
// access an unconfigured instance of it that you can work with. The only configuration the
// Universal Connection Pool supports sending to the connection factory is via a Properties
// object, whose values are retrieved by the PoolDataSource implementation, as Strings. This
// limits the kinds of underlying connection factories (DataSource implementations, usually)
// that can be fully configured with the Universal Connection Pool to Strings and those Strings
// which can be converted by the PoolDataSourceImpl#toBasicType(String, String) method.
connectionFactoryProperties.setProperty(propertyName, properties.getProperty(propertyName));
}
}
}
Object serviceName = connectionFactoryProperties.remove("serviceName");
Object pdbRoles = connectionFactoryProperties.remove("pdbRoles");
// Used for OCI ATP Integration
// Removing this so that it is not set on connectionFactoryProperties,
// Else we get exception with getConnection using this DS, if its set.
connectionFactoryProperties.remove("tnsNetServiceName");
if (!connectionFactoryProperties.stringPropertyNames().isEmpty()) {
// We found some String-typed properties that are destined for the underlying connection factory to
// hopefully fully configure it. Apply them here.
// hopefully fully configure it. Apply them here.
returnValue.setConnectionFactoryProperties(connectionFactoryProperties);
}
// Set the PoolDataSource's serviceName property so that it appears to the PoolDataSource to have been set
// via the undocumented XML configuration that the PoolDataSource can apparently be configured with in
// certain (irrelevant for Helidon) application server cases.
if (serviceName instanceof String) {
try {
Method m = returnValue.getClass().getDeclaredMethod("setServiceName", String.class);
if (m.trySetAccessible()) {
m.invoke(returnValue, serviceName);
}
} catch (NoSuchMethodException ignoreOnPurpose) {

}
}
// Set the PoolDataSource's pdbRoles property so that it appears to the PoolDataSource to have been set via
// the undocumented XML configuration that the PoolDataSource can apparently be configured with in certain
// (irrelevant for Helidon) application server cases.
if (pdbRoles instanceof Properties) {
try {
Method m = returnValue.getClass().getDeclaredMethod("setPdbRoles", Properties.class);
if (m.trySetAccessible()) {
m.invoke(returnValue, pdbRoles);
}
} catch (NoSuchMethodException ignoreOnPurpose) {

}
}
}
if (returnValue.getConnectionPoolName() == null) {
String proposedConnectionPoolName = dataSourceName.value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ private void onStartup(@Observes @Initialized(ApplicationScoped.class) final Obj
}

private void configure(@Observes @Named("test") final PoolDataSource pds) throws SQLException {
assertThat(pds.getServiceName(), is("fred"));
assertThat(pds.getDescription(), nullValue());
assertThat(pds.getClass().isSynthetic(), is(false));
pds.setDescription("A test datasource");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019, 2022 Oracle and/or its affiliates.
# Copyright (c) 2019, 2024 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.
Expand All @@ -22,7 +22,6 @@ oracle:
connectionFactoryClassName: org.h2.jdbcx.JdbcDataSource
password: "${EMPTY}"
user: sa
serviceName: fred
PoolXADataSource:
testxa:
URL: jdbc:h2:mem:test
Expand Down
2 changes: 1 addition & 1 deletion integrations/db/ojdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<exclusions>
<exclusion>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp</artifactId>
<artifactId>ucp11</artifactId>
</exclusion>
<exclusion>
<!-- Contains JAXP impl, so we exclude it to not interfere -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"name": "java.lang.Boolean",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Byte",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Double",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Float",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Integer",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Long",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.Short",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.String" ] }
]
},
{
"name": "java.lang.String",
"methods": [
{ "name": "<init>", "parameterTypes": [ "java.lang.String" ] },
{ "name": "valueOf", "parameterTypes": [ "java.lang.Object" ] }
]
}
]
4 changes: 0 additions & 4 deletions messaging/connectors/aq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
<groupId>io.helidon.integrations.db</groupId>
<artifactId>ojdbc</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp</artifactId>
</dependency>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/packaging/mp-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<name>Helidon Tests Integration Packaging MP2</name>

<properties>
<angus.activation.native-image.trace>false</angus.activation.native-image.trace>
<helidon.native.reflection.trace>false</helidon.native.reflection.trace>
<helidon.native.reflection.trace-parsing>false</helidon.native.reflection.trace-parsing>
<mainClass>io.helidon.tests.integration.packaging.mp2.Mp2Main</mainClass>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</properties>
Expand Down Expand Up @@ -145,6 +148,11 @@
<id>build-native-image</id>
<configuration>
<quickBuild>true</quickBuild>
<systemProperties>
<angus.activation.native-image.trace>${angus.activation.native-image.trace}</angus.activation.native-image.trace>
<helidon.native.reflection.trace>${helidon.native.reflection.trace}</helidon.native.reflection.trace>
<helidon.native.reflection.trace-parsing>${helidon.native.reflection.trace-parsing}</helidon.native.reflection.trace-parsing>
</systemProperties>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
# limitations under the License.
#

Args=--initialize-at-build-time=io.helidon.tests.integration.packaging.mp2
Args=--initialize-at-build-time=io.helidon.tests.integration.packaging.mp2 \
--enable-url-protocols=http
8 changes: 8 additions & 0 deletions tests/integration/packaging/mp-3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
</description>

<properties>
<angus.activation.native-image.trace>false</angus.activation.native-image.trace>
<helidon.native.reflection.trace>false</helidon.native.reflection.trace>
<helidon.native.reflection.trace-parsing>false</helidon.native.reflection.trace-parsing>
<mainClass>io.helidon.tests.integration.packaging.mp3.Mp3Main</mainClass>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</properties>
Expand Down Expand Up @@ -83,6 +86,11 @@
<artifactId>native-maven-plugin</artifactId>
<configuration>
<quickBuild>true</quickBuild>
<systemProperties>
<angus.activation.native-image.trace>${angus.activation.native-image.trace}</angus.activation.native-image.trace>
<helidon.native.reflection.trace>${helidon.native.reflection.trace}</helidon.native.reflection.trace>
<helidon.native.reflection.trace-parsing>${helidon.native.reflection.trace-parsing}</helidon.native.reflection.trace-parsing>
</systemProperties>
</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit 3af58fe

Please sign in to comment.