We are looking at rearchitecting our web application and want to move to a more modular solution, OSGi seems to meet a lot of our needs.
I've come across the Apache Felix project and taken it for a spin. It looks solid yet I find the development cycle a bit slow as it requires a maven build of the bundle(s) to make any code changes effective.
Instead I would like to be able to reload a bundle once classes have been compiled by Eclipse, without any extra building/packaging. Similar to how Tomcat and other servlet containers support deployment of "exploded" war files.
Is this possible to do with Felix or any other OSGi container?
In the Gogo shell, you can do:
install reference:file:/path/to/exploded/directory
This will install an exploded bundle. The format of the exploded directory should be exact that of a bundle JAR file.
Apache Felix FileInstall supports exploded bundles out of the box. Just install it, and put a directory with your bundle in the load directory (or configure FileInstall to look somewhere else).
Not exactly answering your question, but if you have issues with the build cycle, you should take a look at bndtools, which is a plugin for Eclipse that a.o. automatically builds and deploys your bundles in a running framework when your code changes.
Related
I am trying to embed Felix in an application of ours to handle plugins. Everything is working fine, however, development and debugging is very cumbersome.
Is there a solution where I can tell Felix to automatically reload a plugin bundle or its classes when I recompile a plugin in Eclipse?
I cannot use any OSGi specific launchers because Felix is embedded in our application
Felix' fileinstall supports directories, but expects a specific structure, which is incompatible with the layout of the Eclipse project.
Any help or pointers to a solution would be greatly appreciated.
You could take a look at Bndtools and the remote launcher. You only need to install a remote agent in your framework and then Bndtools can update any bundle that has changed in the workspace.
This is explained in remote launching. In OSGi enRoute you find an IoT tutorial that uses this model as well as a Karaf App Note.
I'm looking for a way to automatically install a couple of bundles into an OSGi application, ideally by some kind of batch file / console script so as to allow us to embed it into our build process.
The ideal situation would allow me to just pass the update site URLs to the console and have it download and install them as that would spare from having to install the jars one by one.
Is this possible? Beware that the application I'm talking about is not Eclipse although it contains a couple of Eclipse plugin jars in its bundles directory. I reckon this fact may well imply a slightly different approach to the situation, although I'm not totally sure.
At the moment I'm in control of the application's OSGi console (p2), so I guess that would be the right tool to use, from what I've read.
Thanks
There are several ways to go about this (apart from using p2 which you already mention):
Use the Apache Felix Gogo shell, which has commands to install bundles from a URL, and create a script for that that is executed at startup.
Use the Apache Felix File Install bundle, which allows you to put all bundles in a "hot deploy" folder and automatically installs them.
Use Apache ACE, which is a full blown provisioning solution that allows you to map artifacts to target systems.
Use a Bnd feature to create an executable jar that embeds both the OSGi framework and all bundles and launches them when you start the jar.
Use Apache Karaf features, which allow you to define a list of URLs as a feature and install that feature (using a shell similarly to #1).
There's a lot more to say about each of them, but these are the most-used options I'm aware of.
I wish to setup an eclipse project for implementing a simple module but not a service for axis. I wonder if there're any templates I could use?
Secondly, I would like to ask if there are any information sources such as links around on how to build complex Axis2 applications in eclipse mainly focusing on module building as well
I appreciate your hints.
Best regards,
Alex
I could come along with this issue with my own solution:
Using an customized build.xml based on axis2 module builds I am able to build a module project in Eclipse using ant. I trigger this via key shortcut.
The build.xml has an deploy.module target that puts the module back to the axis2 $HOME/repository folder. Running there ant build.xml will deploy axis2 at whole as an war-file (EAR) the module containing there within to be ready to deploy in a container such as jboss.
The eclipse project is based on common java project (no dynamic web project) containing the $AXIS2/lib in CLASSPATH.
Since Jboss supports hot deployment on update, you can run jboss in a terminal or withing eclipse. I customized the latter build.xml to support easy jboss deployment.
This is a good solution for me.
I'm newbie with servicemix 4.x. I've tried servicemix 4.4 and servicemix-fuse 4.4 with both of them I have the same problem. I've tried to deploy samples to the deploy dir and nothing happens. Servicemix runs, I check the log (tail -f servicemix.log) and there's no message about deploying. I've tried to find some docs about hot deploy under 4.4 but I couldn't find anything.
As I can remember hotdeploy worked out of the box with servicemix 3.x, I just copied zips to hotdeploy dir.
Thanks,
Hubi
I believe ServiceMix 4.4 will hot deploy (<servicemix home>/deploy) files of two types: OSGi bundles and JBI service assemblies. That is, jar files (and exploded jar files) that contain the extra OSGi or JBI meta-information, OSGI blueprint xml files, and Spring xml files, which it assumes are OSGi. ServiceMix 4.4 will not deploy vanilla jar files as its not clear how you would want it to load them - would you want it to wrap it as an OSGi bundle, guessing at imports and exports...
Its not clear from your question what samples you are having problems with. A quick look at most of the ServiceMix samples seems that most of them are OSGi bundles (Maven packaging == bundle), which all should hot deploy when copied to the deploy directory.
If you know your jar files are, say OSGi bundles, then I'd check the <servicemix home>/etc/org.apache.felix.fileinstall-deploy.cfg file's felix.fileinstall.dir property to ensure that its configured to pick up from the directory you think. I'd also check that the File Installer and Deployer services are installed in running. Those typically are within the first 30 services installed, and don't show up on an osgi:list, so you can try
karaf#root> osgi:ls | grep Deployer
If you do not see them, check for modifications to the etc/startup.properties file - someone may have removed those services...
Hope that helps,
Scott
FuseSource
I'm using apache-servicemix-4.4.1-fuse-01-11 and hotdeploy works for me for JBI as well as OSGI based packages (zip for JBI and jar for OSGI).
Try to find your installed packages by running on the karaf console:
osgi:list | grep 'YourBundleName'
if its there all should be ok, you can install and uninstall bundles using other two commands:
osgi:install yourbundlename
osgi:uninstall yourbundlename
Once you have your bundle installed you can see the log output by issuing the following command (works only on Fuse ESB from what I know):
log:tail
How to make a standalone lift application? Which tools/libraries to use? How does the performance compare to using lift application as a war in some application server?
With onejar maven plugin http://onejar-maven-plugin.googlecode.com/svn/mavensite/usage.html and maven I could package jetty and project with dependencies inside one jar.
The part of the question on performance doesn't really fit with the rest. You are primarily asking how to package the Lift application as a single JAR/WAR. This doesn't have anything to do with the runtime.
At runtime you will still be running inside a Servlet container (could be Jetty, Tomcat or a full-blown Java EE server). How you package your application won't affect the performance.
You could take a look at Hudson (a great Continuous Integration Server) to see how they deliver as a single WAR file that contains an embedded Servlet container. You can download the WAR file and run it from the command line: java -jar hudson.war
I know this is an old question, but...
If you are using sbt, I wrote a plugin to produce 'executable' wars like those mentioned above.
https://github.com/glenford/sbt-jetty-embed