[ 
https://issues.apache.org/jira/browse/LANG-1787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030718#comment-18030718
 ] 

Gary D. Gregory edited comment on LANG-1787 at 10/17/25 6:15 PM:
-----------------------------------------------------------------

Hello [~subbu]

Thank you for providing a zip file and instructions.

Based on the files you submitted, you are running an ancient version of OSGi 
and Equinox, which is at least 10 years old!

According to [https://www.eclipse.org/forums/index.php/t/1111555/] : "Starting 
with OSGi Release 7, the OSGi framework must now support imports of java.*". 
Version 7 is from April 2018.

When I tested the steps using a recent version of Eclipse Equinox, I did not 
see a log file generated. This is the config.ini I used with [Equinox 
4.37|https://download.eclipse.org/equinox/drops/R-4.37-202509050730/index.php]:
{noformat}
#Product Runtime Configuration File

osgi.bundles.defaultStartLevel=4
osgi.framework=file:org.eclipse.osgi_3.23.200.v20250812-1847.jar
osgi.bundles=reference:file:org.apache.felix.gogo.command_1.1.2.jar,\
reference:file:org.apache.felix.gogo.runtime_1.1.6.jar,\
reference:file:org.apache.felix.gogo.shell_1.1.4.jar,\
reference:file:org.eclipse.equinox.console_1.4.1100.v20250722-0745.jar,\
reference:file:org.eclipse.core.runtime_3.34.0.v20250711-1249@start,\
reference:file:org.eclipse.equinox.common_3.20.200.v20250628-0509.jar@2:start,\
reference:file:org.eclipse.core.jobs_3.15.700.v20250725-1147.jar,\
reference:file:org.eclipse.equinox.app_1.7.500.v20250629-0337.jar,\
reference:file:org.eclipse.equinox.registry_3.12.500.v20250708-0540.jar,\
reference:file:org.eclipse.equinox.preferences_3.12.0.v20250721-0426.jar,\
reference:file:org.eclipse.core.contenttype_3.9.700.v20250720-0618.jar,\
reference:file:org.osgi.service.prefs_1.1.2.202109301733.jar,\
reference:file:commons-lang3-3.19.0.jar
{noformat}
See 
[https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module-execution.environment]
{quote}In additional to specifying the version of the execution environment via 
an osgi.ee requirement, see osgi.ee Namespace, a Bundle may also import java.* 
packages using the Import-Package header. Imports of java.* packages by a 
bundle will be used during the resolution process, see Resolving Process, to 
ensure the bundle has visibility to the requested packages by wiring the 
bundle's import of a java.* package to the export of the java.* package by the 
Framework's system bundle. However, a bundle always loads classes in java.* 
packages via parent delegation. See Parent Delegation. Therefore, a bundle is 
not required to import a java.* package to have visibility to the classes in 
the package, if the package is present in the current runtime. It only needs to 
import a java.* package to have the resolution process ensure the package is 
available from the execution environment. This can avoid a NoClassDefFoundError 
during execution of the bundle due to a missing java.* package required by the 
bundle.
{quote}

FYI, we generate our bundle metadata using a Maven plugin, to automate the 
process as much as possible.

You'll need to update your Equinox version to something more modern to avoid 
this issue.

I think this will need to be Equinox 4.12 from 2019 or later, according to 
https://stackoverflow.com/questions/19568803/which-version-of-osgi-is-implemented-by-which-version-of-eclipse-equinox

HTH





was (Author: garydgregory):
Hello [~subbu]

Thank you for providing a zip file and instructions.

Based on the files you submitted, you are running an ancient version of OSGi 
and Equinox, which is at least 10 years old!

According to [https://www.eclipse.org/forums/index.php/t/1111555/] : "Starting 
with OSGi Release 7, the OSGi framework must now support imports of java.*". 
Version 7 is from April 2018.

When I tested the steps using a recent version of Eclipse Equinox, I did not 
see a log file generated. This is the config.ini I used with [Equinox 
4.37|https://download.eclipse.org/equinox/drops/R-4.37-202509050730/index.php]:
{noformat}
#Product Runtime Configuration File

osgi.bundles.defaultStartLevel=4
osgi.framework=file:org.eclipse.osgi_3.23.200.v20250812-1847.jar
osgi.bundles=reference:file:org.apache.felix.gogo.command_1.1.2.jar,\
reference:file:org.apache.felix.gogo.runtime_1.1.6.jar,\
reference:file:org.apache.felix.gogo.shell_1.1.4.jar,\
reference:file:org.eclipse.equinox.console_1.4.1100.v20250722-0745.jar,\
reference:file:org.eclipse.core.runtime_3.34.0.v20250711-1249@start,\
reference:file:org.eclipse.equinox.common_3.20.200.v20250628-0509.jar@2:start,\
reference:file:org.eclipse.core.jobs_3.15.700.v20250725-1147.jar,\
reference:file:org.eclipse.equinox.app_1.7.500.v20250629-0337.jar,\
reference:file:org.eclipse.equinox.registry_3.12.500.v20250708-0540.jar,\
reference:file:org.eclipse.equinox.preferences_3.12.0.v20250721-0426.jar,\
reference:file:org.eclipse.core.contenttype_3.9.700.v20250720-0618.jar,\
reference:file:org.osgi.service.prefs_1.1.2.202109301733.jar,\
reference:file:commons-lang3-3.19.0.jar
{noformat}
See 
[https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module-execution.environment]
{quote}In additional to specifying the version of the execution environment via 
an osgi.ee requirement, see osgi.ee Namespace, a Bundle may also import java.* 
packages using the Import-Package header. Imports of java.* packages by a 
bundle will be used during the resolution process, see Resolving Process, to 
ensure the bundle has visibility to the requested packages by wiring the 
bundle's import of a java.* package to the export of the java.* package by the 
Framework's system bundle. However, a bundle always loads classes in java.* 
packages via parent delegation. See Parent Delegation. Therefore, a bundle is 
not required to import a java.* package to have visibility to the classes in 
the package, if the package is present in the current runtime. It only needs to 
import a java.* package to have the resolution process ensure the package is 
available from the execution environment. This can avoid a NoClassDefFoundError 
during execution of the bundle due to a missing java.* package required by the 
bundle.
{quote}

FYI, we generate our bundle metadata using a Maven plugin, so automate the 
process as much as possible.

You'll need to update your Equinox version to something more modern to avoid 
this issue.

I think this will need to be Equinox 4.12 from 2019 or later, according to 
https://stackoverflow.com/questions/19568803/which-version-of-osgi-is-implemented-by-which-version-of-eclipse-equinox

HTH




> Cannot run Lang3 3.18.0 + in osgi environment
> ---------------------------------------------
>
>                 Key: LANG-1787
>                 URL: https://issues.apache.org/jira/browse/LANG-1787
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.18.0
>            Reporter: Tharindu Dharmarathna
>            Priority: Major
>         Attachments: OSGI_TESTING.zip, image-2025-10-17-09-03-35-874.png, 
> image-2025-10-17-09-05-34-093.png, image-2025-10-17-09-07-08-050.png, 
> image-2025-10-17-09-09-15-315.png, image-2025-10-17-09-11-12-169.png, 
> image-2025-10-17-09-16-47-114.png, image-2025-10-17-09-21-29-043.png, 
> image-2025-10-17-09-24-25-832.png
>
>
> lang3 manifest contains java related import packages.
> Due to that equinox related osgi environment not able to use this jar 
> directly as bundle.
> Import-Package: java.beans,java.io,java.lang,java.lang.annotation,java.l
>  ang.invoke,java.lang.reflect,java.math,java.net,java.nio,java.nio.chars
>  et,java.nio.file,java.security,java.text,java.time,java.time.temporal,j
>  ava.util,java.util.concurrent,java.util.concurrent.atomic,java.util.con
>  current.locks,java.util.function,java.util.regex,java.util.stream
> Include-Resource: META-INF/LICENSE.txt=LICENSE.txt,META-INF/NOTICE.txt=N
>  OTICE.txt
> Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
> Tool: Bnd-7.1.0.202411251545
> Multi-Release: true



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to