Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-5812 HK2 Cannot Resolve OSGi on JDK 17 #5478

Merged
merged 5 commits into from
Nov 2, 2021
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
24 changes: 15 additions & 9 deletions api/payara-bom/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
~
~ Copyright (c) [2019-2020] Payara Foundation and/or its affiliates. All rights reserved.
~ Copyright (c) [2019-2021] Payara Foundation and/or its affiliates. All rights reserved.
~
~ The contents of this file are subject to the terms of either the GNU
~ General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -430,26 +430,32 @@

<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>5.0.0</version>
<artifactId>osgi.cmpn</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<artifactId>osgi.core</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<version>5.0.0</version>
<artifactId>osgi.enterprise</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId> <!-- OSGi Companion Code for org.osgi.dto Version 1.0.0. -->
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId> <!-- OSGi Companion Code for org.osgi.dto Version 1.1.0. -->
<artifactId>org.osgi.dto</artifactId>
<version>1.1.0</version>
<version>${osgi.dto.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
Expand Down
6 changes: 3 additions & 3 deletions appserver/extras/embedded/common/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* holder.
*/
-->
<!-- Portions Copyright [2018-2019] [Payara Foundation and/or its affiliates] -->
<!-- Portions Copyright [2018-2021] [Payara Foundation and/or its affiliates] -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Expand Down Expand Up @@ -97,12 +97,12 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
5 changes: 3 additions & 2 deletions appserver/extras/embedded/common/installroot-builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
-->
-->
<!-- Portions Copyright 2021 Payara Foundation and/or its affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -86,7 +87,7 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions appserver/extras/embedded/common/instanceroot-builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
-->

-->
<!-- Portions Copyright 2021 Payara Foundation and/or its affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -87,7 +87,7 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions appserver/extras/embedded/common/osgi-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
-->

-->
<!-- Portions Copyright 2021 Payara Foundation and/or its affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand All @@ -58,7 +58,7 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.

-->
-->
<!-- Portions Copyright 2021 Payara Foundation and/or its affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand All @@ -57,7 +58,7 @@ holder.
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions appserver/osgi-platforms/felix-webconsole-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->

<!-- Portions Copyright 2021 Payara Foundation and/or its affiliates -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -79,11 +79,11 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<artifactId>osgi.cmpn</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
Expand Down
4 changes: 2 additions & 2 deletions appserver/web/web-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->
<!-- Portions Copyright [2016-2019] [Payara Foundation and/or its affiliates] -->
<!-- Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates] -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -150,7 +150,7 @@
</dependency>
<dependency> <!-- for FindBugs -->
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
7 changes: 3 additions & 4 deletions appserver/web/web-naming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->
<!-- Portions Copyright [2017-2019] [Payara Foundation and/or its affiliates] -->
<!-- Portions Copyright [2017-2021] [Payara Foundation and/or its affiliates] -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -89,13 +89,12 @@
<dependency>
<!-- Needed to register URLStreamHandler -->
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation</artifactId>
<version>6.0.0</version>
<artifactId>osgi.annotation</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2017] [Payara Foundation and/or its affiliates]
// Portions Copyright [2017-2021] [Payara Foundation and/or its affiliates]

package org.apache.naming.resources;

Expand All @@ -46,6 +46,7 @@
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Properties;

Expand Down Expand Up @@ -97,13 +98,13 @@ public String toExternalForm(URL u) {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void start(BundleContext context) throws Exception {

Properties properties = new Properties();
Dictionary properties = new Properties();
properties.put(URL_HANDLER_PROTOCOL, new String[] { "jndi" });

context.registerService(
URLStreamHandlerService.class.getName(),
this,
(Hashtable) properties);
properties);
}

public void stop(BundleContext context) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion appserver/web/weld-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions nucleus/admin/rest/rest-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->
<!-- Portions Copyright [2016-2019] [Payara Foundation and/or its affiliates] -->
<!-- Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates] -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -148,7 +148,7 @@
</dependency>
<dependency> <!-- for FindBugs -->
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
6 changes: 3 additions & 3 deletions nucleus/common/common-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->
<!--"Portions Copyright [2014-2019] [Payara Foundation and/or its affiliates]" -->
<!--"Portions Copyright [2014-2021] [Payara Foundation and/or its affiliates]" -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
Expand Down Expand Up @@ -113,13 +113,13 @@
<dependency>
<!-- Needed to have a bundle activator to set up a different serialization policy-->
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<!-- Needed to have a bundle activator to set up a different serialization policy-->
<groupId>org.osgi</groupId>
<artifactId>org.osgi.enterprise</artifactId>
<artifactId>osgi.enterprise</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions nucleus/core/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
holder.

-->
<!-- Portions Copyright [2018-2019] [Payara Foundation and/or its affiliates] -->
<!-- Portions Copyright [2018-2021] [Payara Foundation and/or its affiliates] -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -132,12 +132,12 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2017-2018] [Payara Foundation and/or its affiliates]
// Portions Copyright [2017-2021] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.glassfish.bootstrap.osgi;

Expand Down Expand Up @@ -754,8 +754,10 @@ public static void main(String[] args) throws Exception {
long t0 = System.currentTimeMillis();

Framework framework = null;
Map<String, String> mm = new HashMap<>();
props.putAll(mm);
for (FrameworkFactory frameworkFactory : ServiceLoader.load(FrameworkFactory.class)) {
framework = frameworkFactory.newFramework((Hashtable)props);
framework = frameworkFactory.newFramework(mm);
System.out.println("framework = " + framework);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2017] [Payara Foundation and/or its affiliates]
// Portions Copyright [2017-2021] [Payara Foundation and/or its affiliates]


package com.sun.enterprise.glassfish.bootstrap.osgi;

import static com.sun.enterprise.glassfish.bootstrap.Constants.BUILDER_NAME_PROPERTY;
import static com.sun.enterprise.glassfish.bootstrap.Constants.PLATFORM_PROPERTY_KEY;

import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Properties;

import org.glassfish.embeddable.BootstrapProperties;
import org.glassfish.embeddable.GlassFishException;
Expand Down Expand Up @@ -81,11 +83,13 @@ public GlassFishRuntime build(BootstrapProperties bootstrapProperties) throws Gl
provisionBundles(bootstrapProperties);

GlassFishRuntime glassFishRuntime = new EmbeddedOSGiGlassFishRuntime(getBundleContext());

getBundleContext().registerService(
GlassFishRuntime.class.getName(),
glassFishRuntime,
(Hashtable) bootstrapProperties.getProperties());

Properties props = bootstrapProperties.getProperties();
Dictionary properties = new Properties();
for (final String name: props.stringPropertyNames()) {
properties.put(name, props.getProperty(name));
}
getBundleContext().registerService(GlassFishRuntime.class.getName(), glassFishRuntime, properties);

return glassFishRuntime;
}
Expand Down
Loading