How to customize OSGi prompt in apache felix gogo shell - osgi

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>".

Related

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

Making Apache Felix Gogo not open a local console

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.

Can't setup remote debugging with JBoss Web 2.1.4 windows and eclipse

I'm unable to find an option to setup remote debugging in JBossWeb 2.1.4 on Windows. It is not installed as a service and there are no .bat scripts where I can edit the JAVA_OPTS environment variable to include:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142
The only thing in the jboss web bin directory are jbossweb.exe files.
I've tried editing the run configuration in eclipse to start the container by running jbossweb.exe and setting the environment variable JAVA_OPTS to the above, but it doesn't listen on port 4142 on startup (ie, there seems to be no effect in adding the environment variable to the run configuration).
Any ideas here?
If you control the server from eclipse with for instance JBoss Tools, you can just click "debug" instead of "start" in the Server pane in order to start up in debug mode.
You can create such bat script by yourself. Just add jboss.bat file to bin subdirectory of JBoss install directory and put there:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142 -jar "D:\JBoss.org\JBoss Web 2.1\bin\bootstrap.jar" start
When you run this script, you will get JBoss running in debug mode. Probably, it won't help you in all situations, but it worked for me.

Resources