Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.jdbc/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ instrument.disabled: true
com.ibm.ws.container.service;version=latest,\
com.ibm.ws.javaee.dd.common;version=latest,\
com.ibm.ws.serialization;version=latest, \
com.ibm.ws.org.osgi.annotation.versioning;version=latest
com.ibm.ws.org.osgi.annotation.versioning;version=latest, \
com.ibm.ws.kernel.boot.core;version=latest

-testpath: \
../build.sharedResources/lib/junit/old/junit.jar;version=file, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.ibm.ws.jdbc.internal.JDBCDriverService;
import com.ibm.ws.jdbc.internal.JDBCDrivers;
import com.ibm.ws.jdbc.internal.PropertyService;
import com.ibm.ws.kernel.productinfo.ProductInfo;
import com.ibm.ws.resource.ResourceFactory;
import com.ibm.ws.resource.ResourceFactoryBuilder;
import com.ibm.ws.rsadapter.AdapterUtil;
Expand Down Expand Up @@ -487,6 +488,11 @@ private final String updateWithLibraries(BundleContext bundleContext,

// Do not check for privateLibraryRef for java:global data source definitions, applicationName is null when java:global is used
if (applicationName != null) {
Object overrideLibraryRef = ProductInfo.getBetaEdition() ? classloaderProps.get("overrideLibraryRef") : null;
if (overrideLibraryRef != null && overrideLibraryRef instanceof String[])
for (String pid : (String[]) overrideLibraryRef)
libraryFilter.append(FilterUtils.createPropertyFilter(Constants.SERVICE_PID, pid));

Object privateLibraryRef = classloaderProps.get("privateLibraryRef");
if (privateLibraryRef != null && privateLibraryRef instanceof String[])
for (String pid : (String[]) privateLibraryRef)
Expand Down
1 change: 1 addition & 0 deletions dev/com.ibm.ws.jdbc_fat/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<classpathentry kind="src" path="test-applications/dsdfat/src"/>
<classpathentry kind="src" path="test-applications/setupfat/src"/>
<classpathentry kind="src" path="test-applications/dsdfat_global_lib/src"/>
<classpathentry kind="src" path="test-applications/dsdfat_override_lib/src"/>
<classpathentry kind="src" path="test-resource/loginmodule/src"/>
<classpathentry exported="true" kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="output" path="bin"/>
Expand Down
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.jdbc_fat/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ src: \
test-applications/basicfat/src,\
test-applications/dsdfat/src,\
test-applications/setupfat/src,\
test-applications/dsdfat_global_lib/src
test-applications/dsdfat_global_lib/src,\
test-applications/dsdfat_override_lib/src

fat.project: true
tested.features: databaseRotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2024 IBM Corporation and others.
* Copyright (c) 2019, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -78,6 +78,7 @@ public class ConfigTest extends FATServletClient {
private static final String jdbcapp = "jdbcapp";
private static final String dsdfat = "dsdfat";
private static final String dsdfat_global_lib = "dsdfat_global_lib";
private static final String dsdfat_override_lib = "dsdfat_override_lib";

//Server used for ConfigTest.java and DataSourceTest.java
@Server("com.ibm.ws.jdbc.fat")
Expand Down Expand Up @@ -158,6 +159,7 @@ public static void setUp() throws Exception {
// Default app - dsdfat.war and dsdfat_global_lib.war
ShrinkHelper.defaultApp(server, dsdfat, dsdfat);
ShrinkHelper.defaultApp(server, dsdfat_global_lib, dsdfat_global_lib);
ShrinkHelper.defaultApp(server, dsdfat_override_lib, dsdfat_override_lib);

// Default app - jdbcapp.ear [basicfat.war, application.xml]
WebArchive basicfatWAR = ShrinkHelper.buildDefaultApp(basicfat, basicfat);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 IBM Corporation and others.
* Copyright (c) 2019, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -57,6 +57,7 @@ public class DataSourceTest extends FATServletClient {
private static final String basicfat = "basicfat";
private static final String dsdfat = "dsdfat";
private static final String dsdfat_global_lib = "dsdfat_global_lib";
private static final String dsdfat_override_lib = "dsdfat_override_lib";

@ClassRule
public static final JdbcDatabaseContainer<?> testContainer = DatabaseContainerFactory.create();
Expand Down Expand Up @@ -88,9 +89,10 @@ public static void setUp() throws Exception {
// Dropin app - setupfat.war
ShrinkHelper.defaultDropinApp(server, setupfat, "setupfat");

// Default app - dsdfat.war and dsdfat_global_lib.war
// Default app - dsdfat.war, dsdfat_global_lib.war and dsdfat_override_lib.war
ShrinkHelper.defaultApp(server, dsdfat, dsdfat);
ShrinkHelper.defaultApp(server, dsdfat_global_lib, dsdfat_global_lib);
ShrinkHelper.defaultApp(server, dsdfat_override_lib, dsdfat_override_lib);

// Default app - jdbcapp.ear [basicfat.war, application.xml]
WebArchive basicfatWAR = ShrinkHelper.buildDefaultApp(basicfat, basicfat);
Expand Down Expand Up @@ -358,6 +360,12 @@ public void testDataSourceDefGlobalLib() throws Exception {
runTest(server, dsdfat_global_lib, testName);
}

@Test
@OnlyIfDataSourceProperties(DERBY_EMBEDDED)
public void testDataSourceDefOverrideLib() throws Exception {
runTest(server, dsdfat_override_lib, testName);
}

/**
* Test for PI23168 - two data sources with nested libraries with no IDs.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Dcom.ibm.ws.beta.edition=true
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2019, 2021 IBM Corporation and others.
Copyright (c) 2025 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
Expand Down Expand Up @@ -247,6 +247,10 @@
-->
</application>

<application type="war" id="dsdfat_override_lib" location="dsdfat_override_lib.war">
<classloader overrideLibraryRef="DerbyLib" privateLibraryRef="empty"/>
</application>
<library id="empty"/>
<!-- ### Permissions ### -->
<!-- Note that until using a nested <file> works the following ACEs will be thrown: createClassLoader,
java.util.PropertyPermission, javax.management.MBeanPermission -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/*******************************************************************************
* Copyright (c) 2019 IBM Corporation and others.
* Copyright (c) 2019, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package dsdfat_global_lib;

import java.sql.Connection;

import javax.annotation.Resource;
import javax.annotation.sql.DataSourceDefinition;
import javax.sql.DataSource;
Expand All @@ -32,7 +34,9 @@ public class DSDGlobalLibTestServlet extends FATServlet {
DataSource xmlDS;

public void testDataSourceDefGlobalLib() throws Exception {
annoDS.getConnection().close();
xmlDS.getConnection().close();
try (Connection con = annoDS.getConnection()) {
}
try (Connection con = xmlDS.getConnection()) {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd"
id="WebApp_ID">

<servlet id="Default">
<servlet-class>dsdfat_override_lib.DSDOverrideLibTestServlet</servlet-class>
<load-on-startup></load-on-startup>
</servlet>

<servlet-mapping id="ServletMapping_Default">
<url-pattern>/*</url-pattern>
</servlet-mapping>

<data-source>
<name>java:app/jdbc/xmlDSOverride</name>
<class-name>org.apache.derby.jdbc.EmbeddedXADataSource40</class-name>
<database-name>memory:dsdfat_override_lib</database-name>
<property><name>createDatabase</name><value>create</value></property>
</data-source>
</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package dsdfat_override_lib;

import java.sql.Connection;

import javax.annotation.Resource;
import javax.annotation.sql.DataSourceDefinition;
import javax.sql.DataSource;

import componenttest.app.FATServlet;

@SuppressWarnings("serial")
@DataSourceDefinition(name = "java:comp/env/jdbc/annoDSOverride",
className = "org.apache.derby.jdbc.EmbeddedXADataSource40",
databaseName = "memory:dsdfat_override_lib",
properties = { "createDatabase=create" })
public class DSDOverrideLibTestServlet extends FATServlet {

@Resource(lookup = "java:comp/env/jdbc/annoDSOverride")
DataSource annoDS;

@Resource(lookup = "java:app/jdbc/xmlDSOverride")
DataSource xmlDS;

public void testDataSourceDefOverrideLib() throws Exception {
try (Connection con = annoDS.getConnection()) {
}
try (Connection con = xmlDS.getConnection()) {
}
}
}
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.jsp/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,5 @@ instrument.classesExcludes: com/ibm/ws/jsp/resources/*.class
com.ibm.ws.javaee.version;version=latest, \
io.openliberty.jakarta.servlet.jsp.jstl.2.0.internal;version=latest, \
io.openliberty.jakarta.servlet.jsp.tags.3.0.internal;version=latest, \
io.openliberty.el.internal.cdi;version=latest
io.openliberty.el.internal.cdi;version=latest, \
com.ibm.ws.kernel.boot.core;version=latest
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.ibm.ws.container.service.app.deploy.ContainerInfo;
import com.ibm.ws.container.service.app.deploy.NestedConfigHelper;
import com.ibm.ws.container.service.app.deploy.extended.ExtendedApplicationInfo;
import com.ibm.ws.kernel.productinfo.ProductInfo;
import com.ibm.wsspi.adaptable.module.AdaptableModuleFactory;
import com.ibm.wsspi.adaptable.module.Container;
import com.ibm.wsspi.adaptable.module.UnableToAdaptException;
Expand Down Expand Up @@ -137,7 +138,10 @@ public SharedLibClassesContainerInfo adapt(Container root, OverlayContainer root
Configuration cfg = classloaderConfigs[0];
Dictionary<String, Object> props = cfg.getProperties();
if (props != null) {
String[] libraryPIDs = (String[]) props.get("privateLibraryRef");
String[] libraryPIDs = ProductInfo.getBetaEdition() ? (String[]) props.get("overrideLibraryRef") : null;
processLibraryPIDs(sharedLibContainers, libraryPIDs);

libraryPIDs = (String[]) props.get("privateLibraryRef");
processLibraryPIDs(sharedLibContainers, libraryPIDs);

libraryPIDs = (String[]) props.get("commonLibraryRef");
Expand Down