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.
Related
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
I have Ubuntu server on Digital Ocean and I wrote Spring web app and now I want to put it in production.
I upload it via FTP to the server and I open my console via Putty and I use this command:
java -jar name.jar
Spring is started after that and when I open my web app everything is working fine, but when I close my Putty session my Spring web app does not work anymore. It seems like when I close my Putty session that also Spring web app is closed.
How to solve this?
While what KLHauser suggested will work, but if the vm is restarted in the cloud (which happens) your application will not automatically restart. Also stopping your application with kill -9 is error prone and dangerous, because you accidentally may kill the wrong process.
See running as Linux service section of Spring Boot documentation on how to do that.
If you’ve configured Spring Boot’s Maven or Gradle plugin to generate
a fully executable jar, and you’re not using a custom
embeddedLaunchScript, then your application can be used as an init.d
service. Simply symlink the jar to init.d to support the standard
start, stop, restart and status commands.
The script supports the following features:
Starts the services as the user that owns the jar file
Tracks
application’s PID using /var/run//.pid
Writes
console logs to /var/log/.log
Assuming that you have a Spring Boot application installed in
/var/myapp, to install a Spring Boot application as an init.d service
simply create a symlink:
$ sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp Once installed,
you can start and stop the service in the usual way. For example, on a
Debian based system:
$ service myapp start
Just use java -jar name.jar & and the application is started in new process thread.
by adding also > log.txt directly at the end you would also have a log.
We are unable to deploy our application from our BuildServer to our appliation server.
This is the maven command we use in Jenkins:
clean install jboss-as:deploy -Pjboss7 -Dmaven.test.skip=true
We have tried the following:
Confirmed we can telnet from our BuildServer to our appliation server
Upgrade Jboss maven plugin
Started Jboss (on our application server) with
$JBOSS_HOME/bin/standalone.sh -b 0.0.0.0
Jenkins seems to hang at the following point:
INFO: JBoss Remoting version 3.2.12.GA
Authenticating against security realm: ManagementRealm
Is the JBoss AS 7 working on the same machine as Jenkins?
Currently your binding your public interface to all network interfaces on the host machine (the -b command). You should also bind your management interface of the app server to a proper network interface (Jboss allows remote deployment only by the management interface). You can do it in the $JBOSS_HOME/standalone/configuration/standalone.xml (or domain.xml for domain mode) file. Find:
and set the inet-address to the ip of the machine which hosts the application server. You can also use the -bmanagement switch to bind the management interface, as such:
$JBOSS_HOME/bin/standalone.sh -bmanagement=192.168.100.10
You also stated, that you have a potential problem with authentication. Please post your maven plugin configuration. Note that the username and password you provide for the maven plugin should match the administrator user on JBoss (you can add him by choosing Management User in the $JBOSS_HOME/bin/add-user.sh promp). This is the most likely source of your problem - but it is hard to tell without any further information (for example something from the pom.xml file).
Also if the app server is working on the same machine as Jenkins, JBoss allows the "local user authentication" which basicaly checks if the call has originated from the same machine.
Additional source for network interface binding: https://docs.jboss.org/author/display/AS71/Command+line+parameters#Commandlineparameters-bindaddress
I need to create a Build Server in CentOS 6.4 Minimal I sucessfully installed:
Java compiler (OpenJDK 1.7.0)
Git or Mercurial
Maven
Jenkins
Now I need to to the following:
At given intervals (eg daily at midnight) is the latest revision in the version control system (tip, HEAD, ...) compiled with Maven. In addition, Java Docs and packages (jar, war) need to be created.
Then Jenkins with all tests conducted and reported.
Make sure there is a report of previous builds
Ensure that the Java Docs and packages can be downloaded (jars, wars, ...) of the latest build
I can't use a GUI on CentOS Minimal so I need to configure the job in xml files? Could please someone show me the way... I'm not a linux server guru.
It's a bit impractical to configure Jenkins via XML by hand, because Jenkins' configuration is spread over multiple files, and the format of the configuration files changes between releases.
Given that Jenkins is a web application, you should be able to visit port 8080 (Jenkins' default port, assuming you didn't change it) on the server where you installed Jenkins (e.g. http://mycentosserver.example.com:8080), and configure it via the web interface.
If you're unable to access the web interface because of a firewall or similar, but you are able to SSH to the server (presumably you can, given that you were able to install stuff on it), you could set up an SSH tunnel to forward a port on your local machine to port 8080 on the server. For example, from your local machine, run the following command. You will then be able to access Jenkins on your local machine at http://localhost:28080 . If you're on Windows, you can use Putty to do the same thing.
ssh -L 28080:127.0.0.1:8080 mycentosserver.example.com
If you can't access the web app directly, and you can't SSH tunnel, I'd recommend setting up Jenkins on a server where you can access the web app, configuring it, and copying the XML config files from /var/lib/jenkins on that server across to your Centos server.
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.