Making Apache Felix Gogo not open a local console - osgi

I am learning Apache Felix to use as my OSGi framework. I want to be able to use the Felix Remote Shell to access my running instance through telnet. The Remote Shell accesses the process through Gogo, as explained on http://felix.apache.org/site/apache-felix-remote-shell.html. When I start Felix with the Gogo shell bundles in the auto-deploy bundles directory, it opens a Felix prompt g! on the Linux console from which I am starting. What I would like to do is have Felix start with the Gogo shell active, but without attaching to my current Linux console and showing the g! prompt, and still allowing me to access the instance using the Remote Shell through telnet. Is this possible? If so, what is the correct way to do it? Would nohup and running in the background suffice? That doesn't seem very clean to me. Thanks for any suggestions!

According to a discussion on the mailing list, you should add the -Dgosh.args=--nointeractive JVM argument.

Related

How to customize OSGi prompt in apache felix gogo shell

I have an OSGi system running with Apache Felix Gogo shell (version 1.1.2).
I see the prompt g! and everything works fine. I can change the prompt in the console by e.g. prompt="myPrompt>".
How can I have this at start up, configured in my config file (config.ini)?
You could simply put a startup script in your working directory ./etc/gosh_profile.
In that script you can define the prompt name like
prompt="myPrompt>".

OSGi in saaj environment [duplicate]

This question already has an answer here:
Apache Felix shell with SSH
(1 answer)
Closed 5 years ago.
In my local environment I use the "start.bat" file to start application bundle.
This is like as follows:
java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console -noExit
OSGi is starting on the command prompt by the way I can list existing plugins. However the production will be a saaj environment and I think to start OSGi as a background process by installing a process manager package. Then my question is how to monitor it? How to start or stop the bundles? Do I need to use some monitoring tools such as Apache Felix web console to be able to make telnet connection? Is there an easy way (or common usage) to do on a cloud server?
Can someone inform me about this issue because I am new to OSGi concept?
After some further researches, I've found a solution for my situation. "-console" option of eclipse equinox (which is equivalent to "osgi.console") takes host and port parameters. So I 've changed my start script as follows(just added port number):
java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console 5555 -noExit
However this additional configuration needs some extra libraries and OSGi config changes. I had to place following jar files on the same folder with "org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar". That is the plugins folder in my environment.
org.apache.felix.gogo.command_0.10.0.v201209301215.jar
org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar
org.apache.felix.gogo.shell_0.10.0.v201212101605.jar
org.eclipse.equinox.console_1.1.0.v20140131-1639.jar
Secondly I have configured my config.ini file. It should contain following key/values:
osgi.bundles=org.eclipse.equinox.console#start, org.apache.felix.gogo.command#start, org.apache.felix.gogo.shell#start, org.apache.felix.gogo.runtime#start
osgi.noShutdown=true
eclipse.ignoreApp=true
After these changes, I can pass commands to the OSGi runtime from the command line by simply using a telnet connection to the port given. A tricky point is OSGi is always up until you termşnate OSGi console by typing 'exit' even if you terminate your ssh connection.
Reference: OSGi Modularity - Tutorial

Apache Felix won't start

I'm trying to start Apache Felix (java -jar felix.jar) from the Windows 7 cmd, but I get nothing. The cursor simply jumps to the next line which then remains blank and blinking forever. I don't get the Apache Felix success message, ie:
Welcome to Felix
================
-> ps
What could I be missing?
When I start from the directory of the felix distribution it works for me.
I got a similar behaviour like you when I started directly from the bin directory as then the launcher did not find the config.properties.
It might also be about the java version. I used Java 8.

Is it possible to start pax-run without the Gogo shell?

I'm trying to deploy an application which is provisioned with pax-run. However, it seems that it insists on installing the Gogo bundles. Since when the application is executed it does not get a terminal allocated, Gogo closes and stops the application with it.
I have found no way to remove to Gogo bundles or at least prevent them from stopping. How can I do that?
According to the documentation of Pax Runner, you can turn off the console with
--console=false
It's also possible to run as deamon
pax-rund --startd

How to install bundles to remote locations OSGI Equinox

I am using the OSGI framework, mainly Equinox.
I know how to get bundles working on a local system.
osgi> install file:path/to/file
or if theyre in a remote location then:
osgi> install http://ip_addressordomain:filelocation
How do I have it so I can have my osgi console running on Machine A and from it start and run a bundle on Machine B?
There are a couple of options. You can tell Equinox to create the console on a TCP/IP port rather than using standard input, for example:
java -jar org.eclipse.osgi_blah.jar -console 9999
... and now you can telnet into the machine on port 9999. Bear in mind however that this is very insecure, so not something you should do in a production environment.
Alternatively you can use the Felix Web Console, which will give you a full web-based management console for the OSGi framework.

Resources