Skip to content
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,10 @@ xref:reference-manual.adoc#multimode[`multimode`]::
xref:reference-manual.adoc#osgi[`osgi`]::
Delegates the command line to the Apache Felix Gogo remote shell for
the execution of OSGi shell commands. For procedural information in
this guide, see xref:overview.adoc#to-run-apache-felix-gogo-remote-shell-commands[To Run Apache Felix Gogo
Remote Shell Commands].
xref:reference-manual.adoc#osgi-shell[`osgi-shell`]::
Provides interactive access to the Apache Felix Gogo remote shell for
the execution of OSGi shell commands. For procedural information in
this guide, see xref:overview.adoc#to-run-apache-felix-gogo-remote-shell-commands[To Run Apache Felix Gogo
Remote Shell Commands].
the execution of OSGi shell commands.
xref:reference-manual.adoc#set[`set`]::
Sets the values of one or more configurable attributes. For procedural
information in this guide, see xref:monitoring.adoc#configuring-monitoring[Configuring
Expand Down
3 changes: 0 additions & 3 deletions docs/administration-guide/src/main/asciidoc/loe.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ prev=toc.adoc

* xref:overview.adoc#gkvay[1-1 Determining if the DAS Requires Restart]
* xref:overview.adoc#gkvba[1-2 Determining if an Instance Requires Restart]
* xref:overview.adoc#GSADG1053[1-3 Listing Apache Felix Gogo Remote Shell Commands]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be kept, do not remove this, this functionality works

* xref:overview.adoc#GSADG1054[1-4 Running a Remote Shell Command]
* xref:overview.adoc#gjkrh[1-5 Determining the Services That an OSGi Bundle Provides]
* xref:general-administration.adoc#giwdr[2-1 Running an asadmin Utility Subcommand in Single Mode]
* xref:general-administration.adoc#giwbf[2-2 Specifying an asadmin
Utility Option With a Subcommand in Single Mode]
Expand Down
305 changes: 0 additions & 305 deletions docs/administration-guide/src/main/asciidoc/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ The following {productName} administration tools are described here:
* <<Administration Console>>
* <<asadmin-utility,`asadmin` Utility>>
* <<REST Interfaces>>
* <<OSGi Module Management Subsystem>>
* <<keytool-utility,`keytool` Utility>>
* <<Java Monitoring and Management Console (JConsole)>>

Expand Down Expand Up @@ -800,310 +799,6 @@ add-on components. For more information, see
xref:general-administration.adoc#using-rest-interfaces-to-administer-glassfish-server[Using REST Interfaces to
Administer {productName}].

[[osgi-module-management-subsystem]]

==== OSGi Module Management Subsystem

The OSGi module management subsystem that is provided with {productName} is the http://felix.apache.org/[Apache Felix OSGi framework] . To
administer this framework, use the either of the following tools:

* http://felix.apache.org/documentation/subprojects/apache-felix-remote-shell.html[Apache
Felix Gogo] remote shell. This shell is provided with {productName}.
The shell uses the Felix Gogo shell service to interact with the OSGi
module management subsystem.
* GlassFish OSGi Administration Console. This console is distributed as
an add-on component for {productName} or as a set of files from the
Maven GlassFish repository. In both distributions, the GlassFish OSGi
Web Console is provided as an extension to the Administration Console
and as a standalone web application. The GlassFish OSGi Administration
Console is a customized version of the
http://felix.apache.org/documentation/subprojects/apache-felix-web-console.html[Apache
Felix Web Console].

These tools enable you to perform administrative tasks on OSGi bundles
such as:

* Browsing installed OSGi bundles
* Viewing the headers of installed OSGi bundles
* Installing OSGi bundles
* Controlling the life cycle of installed bundles

[[to-enable-the-apache-felix-gogo-remote-shell]]

===== To Enable the Apache Felix Gogo Remote Shell

By default, the Apache Felix Gogo remote shell in {productName} is
disabled. Before using the shell to administer OSGi bundles in {productName}, you must enable the shell.

Enabling the Apache Felix Gogo remote shell in {productName} involves
changing the value of the property `glassfish.osgi.start.level.final`.
This property controls whether the OSGi start level service enables the
shell when the DAS or a {productName} instance is started.

1. Ensure that the DAS is running.
+
[[CEGDBDBH]]
2. Change the value of the `glassfish.osgi.start.level.final` property from 2 to 3.
If the domain includes clustered or standalone instances on remote
hosts, perform this step on each remote host. You can change this value either by creating a Java system property or
by editing a file.
* To change this value by creating a Java system property, create the
Java system property `glassfish.osgi.start.level.final` with a value of 3.
+
[source]
----
asadmin> create-jvm-options --target target -Dglassfish.osgi.start.level.final=3
----
target::
The target for which you are creating the property.
+
For the DAS, the target is `server`.
+
For a clustered or standalone instance, the target is the name of the
instance.
* To change this value by editing a file, edit the plain-text file
as-install``/config/osgi.properties`` to change the value of the
`glassfish.osgi.start.level.final` property from 2 to 3.

3. Restart the DAS.
For instructions, see xref:domains.adoc#to-restart-a-domain[To Restart a Domain].

[[to-run-apache-felix-gogo-remote-shell-commands]]

===== To Run Apache Felix Gogo Remote Shell Commands

The Apache Felix Gogo remote shell is integrated with the {productName} `asadmin` command line utility. You can use the `asadmin`
subcommands `osgi` and `osgi-shell` to access the remote shell and run
OSGi shell commands.

[[GSADG1051]]

To Run Remote Shell Commands Using the `osgi` Subcommand

The `osgi` subcommand delegates the command line to the Apache Felix
Gogo remote shell for the execution of OSGi shell commands. Commands are
executed by the remote shell and results are returned by the `asadmin`
utility. The `osgi` subcommand is supported in remote mode only.

1. Ensure that the server is running.
Remote commands require a running server.
2. Access the remote shell by using the xref:reference-manual.adoc#redeploy[`osgi`]
subcommand. For the full syntax and options for this subcommand, see `osgi`(1).

[[GSADG1052]]

To Run Remote Shell Commands Using the `osgi-shell` Subcommand

The `osgi-shell` subcommand provides interactive access to the Apache
Felix Gogo remote shell for the execution of OSGi shell commands. OSGi
shell commands are executed on the server and results are printed on the client.
You can run multiple commands from a file or run commands interactively.
The `osgi-shell` subcommand is supported in local mode only.
Unlike other local subcommands, however, the DAS and the server
instance whose shell is being accessed must be running.

1. Ensure that the server is running.
2. Access the remote shell by using the xref:reference-manual.adoc#redeploy[`osgi-shell`]
subcommand. For the full syntax and options for this subcommand, see `osgi-shell`(1).

[[GSADG1053]]
Example 1-3 Listing Apache Felix Gogo Remote Shell Commands

This example lists Apache Felix Gogo remote shell commands. Some lines
of output are omitted from this example for readability.

[source]
----
asadmin> osgi help
felix:bundlelevel
felix:cd
felix:frameworklevel
gogo:cat
gogo:each
gogo:echo
...
asadmin> osgi-shell
Use "exit" to exit and "help" for online help.
gogo$ help
felix:bundlelevel
felix:cd
felix:frameworklevel
gogo:cat
gogo:each
gogo:echo
----

[[GSADG1054]]
Example 1-4 Running a Remote Shell Command

This example runs the Felix Remote Shell Command `lb` without any
arguments to list all installed OSGi bundles. Some lines of output are
omitted from this example for readability.

[source]
----
asadmin> osgi lb
START LEVEL 2
ID|State |Level|Name
0|Active | 0|System Bundle
1|Active | 1|Metro Web Services API OSGi Bundle
2|Active | 1|jakarta.annotation API
Command osgi executed successfully.
...
asadmin> osgi-shell
Use "exit" to exit and "help" for online help.
gogo$ lb
START LEVEL 2
ID|State |Level|Name
0|Active | 0|System Bundle
1|Active | 1|Metro Web Services API OSGi Bundle
2|Active | 1|jakarta.annotation API
gogo$
----

[[gjkrh]]
Example 1-5 Determining the Services That an OSGi Bundle Provides

This example runs the Felix Remote Shell Command `inspect` with the
`service` option and the `capability` option to determine the services
that OSGi bundle 251 provides. Some lines of output are omitted from
this example for readability.

[source]
----
asadmin> osgi inspect service capability 251
== GlassFish EJB Container for OSGi Enabled EJB Applications (251) provides services:
objectClass = org.glassfish.osgijavaeebase.Extender
service.id = 68
-----
objectClass = org.glassfish.osgijavaeebase.OSGiDeployer
service.id = 69
service.ranking = -2147483648
Command osgi executed successfully.
...
asadmin> osgi -shell
Use "exit" to exit and "help" for online help.
gogo$ inspect service capability 251
== GlassFish EJB Container for OSGi Enabled EJB Applications (251) provides services:
objectClass = org.glassfish.osgijavaeebase.Extender
service.id = 68
...
gogo$
----

[[to-download-and-install-the-glassfish-osgi-web-console]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the OSGi Web Console was removed from GlassFish. The other OSGi functionality is still supported.

Please remove only the following sections:

  • "To Download and Install the GlassFish OSGi Web Console"
  • "To Access the GlassFish OSGi Web Console Through the {productName} Administration Console"

Keep the rest of the OSGi documentation:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the OSGi Web Console was removed from GlassFish. The other OSGi functionality is still supported.

Web console exists in the source tree under appserver/osgi-platforms.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't know about this. However, that module is just a phony. I added it to the GlassFish modules directory, it adds a tab for server and instances, but when the tab is clicked, it just redirects to http://localhost:8080/osgi/system/console/bundles, which is not found. I assume that this URL used to be provided either by Felix or by some external plugin and now it's just not there.

See https://github.com/eclipse-ee4j/glassfish/blob/master/appserver/osgi-platforms/glassfish-osgi-console-plugin/src/main/resources/osgiConsole.jsf.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there's a Web Console by Felix, which is probably what the GlassFish OSGi Web Console plugin wants to redirect to: https://github.com/apache/felix-dev/tree/master/webconsole

I couldn't get it running easily with GlassFish. I downloaded the Felix Web Console bundle from Maven Central, but it requires a few more bundles and either some integration with GlassFish or a bundle that runs it inside an embedded Jetty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a few hours, I managed to deploy the Felix Web Console:
image

It requires to download around 10 bundles from Maven central and install them into the GlassFish modules directory, and also modify the glassfish/config/osgi.properties file to set a few properties. I managed to run it only via an embedded Jetty, on a separate port, and with a hardcoded username and password in osgi.properties.

I also managed to deploy it using a HTTP bridge bundle but that requires some more config and probably a custom bundle to integrate the Felix servlet to GlassFish. Security could be also bridged so that it's protected by GlassFish user and password. But, again, some more coding required.

If we decided it's worth it, I will modify the docs to describe how to install the OSGi Web Console. If not, I will just write a blog about it and we can just merge this PR and remove the docs.


===== To Download and Install the GlassFish OSGi Web Console

The GlassFish OSGi Web Console is distributed as follows:

* As an add-on component for {productName}
* As a set of files from the https://maven.java.net[GlassFish Maven
repository]

In both distributions, the GlassFish OSGi Web Console is provided as an
extension to the Administration Console and as a standalone web
application.

1. Perform one of the following sets of steps, depending on how you are
obtaining the GlassFish OSGi Web Console.
* If you are obtaining the console as an add-on component, install the
GlassFish OSGi Admin Console component.
* If you are obtaining the console from the Maven repository, download
and unzip the required files.
2. Download the following files to the parent of the `glassfish7`
directory of your {productName} installation.
http://maven.glassfish.org/content/groups/glassfish/org/glassfish/packager/glassfish-osgi-http/3.1.2/glassfish-osgi-http-3.1.2.zip[`glassfish-osgi-http-3.1.2.zip`]
+
http://maven.glassfish.org/content/groups/glassfish/org/glassfish/packager/glassfish-osgi-gui/3.1.2/glassfish-osgi-gui-3.1.2.zip[`glassfish-osgi-gui-3.1.2.zip`]
3. Unzip the files that you downloaded.
+
The contents of the files are added to the
as-install``/modules/autostart`` directory of your {productName}
installation.
4. Restart the DAS. For instructions, see xref:domains.adoc#to-restart-a-domain[To Restart a Domain].

[[GSADG797]]

Next Steps

After downloading and installing the GlassFish OSGi Web Console, you can
access the console as explained in the following sections:

* xref:#to-access-the-glassfish-osgi-web-console-through-the-glassfish-server-administration-console[To Access the GlassFish OSGi Web Console Through the
{productName} Administration Console]
* <<To Access the GlassFish OSGi Web Console as a Standalone Web Application>>

[[to-access-the-glassfish-osgi-web-console-through-the-glassfish-server-administration-console]]

===== To Access the GlassFish OSGi Web Console Through the {productName} Administration Console

A tab for the GlassFish OSGi Web Console is provided for the DAS and for
every {productName} instance in a domain.

1. Ensure that the DAS and the instance for which you want to access
the GlassFish OSGi Web Console are running.

2. Start the {productName} Administration Console.
For instructions, see <<Administration Console>>.

3. Open the Administration Console page for the DAS or instance for
which you are accessing the GlassFish OSGi Web Console.
* For the DAS, in the navigation tree, select the server (Admin Server) node.
* For a standalone instance, perform these steps:
.. In the navigation tree, expand the Standalone Instances node.
.. Under the Standalone Instances node, select the instance.
* For a clustered instance, perform these steps:
.. In the navigation tree, expand the Clusters node.
.. Under the Clusters node, select the cluster that contains the instance.
The General Information page for the cluster opens.
.. In the General Information page for the cluster, click the Instances tab.
The Clustered Server Instances page for the cluster opens.
.. In the Server Instances table on the Clustered Server Instances
page, select the instance.

4. On the Administration Console page for the DAS or instance, click
the OSGi Console tab. You are prompted for the user name and password of the administrative
user of the GlassFish OSGi Web Console.

5. In response to the prompt, provide the user name and password of the
administrative user of the GlassFish OSGi Web Console.
The user name and password of this user are both preset to `admin`.
The GlassFish OSGi Web Console page opens.

[[to-access-the-glassfish-osgi-web-console-as-a-standalone-web-application]]

===== To Access the GlassFish OSGi Web Console as a Standalone Web Application

1. Ensure that the DAS or the instance for which you want to access the
GlassFish OSGi Web Console is running.

2. In a web browser, open the following location:
+
[source]
----
http://host:http-port/osgi/system/console/
----
host::
The host where the DAS or instance is running.
http-port::
The port on which {productName} listens for HTTP requests.
The default is 8080.

+
For example, if the DAS is running on the local host and {productName} listens
for HTTP requests on the default port, open the following location:
+
[source]
----
http://localhost:8080/osgi/system/console/
----

3. When prompted, provide the user name and password of the
administrative user of the GlassFish OSGi Web Console.
+
The user name and password of this user are both preset to `admin`.

[[keytool-utility]]

==== `keytool` Utility
Expand Down
Loading