Usually we start/stop bundles via OSGI console, but for web application, how to do that once it's deployed in a container ?
Regards,
Setya
Also not sure if I got you right, but anyway:
I think it depends on how you deploy a OSGi web application. The only way I already did was that I ran Tomcat within the OSGi context. Then Tomcat scans for bundles with a ".war" ending, so its basically started as soon as it's deployed and you can control it normally via the OSGi console
not sure If I got you right, but...
Mostly applications are started just after deployment(war or eclipse)... you don't need to do anything.
but in case you want to you can do exactly the same thing you do to bundles... go to the web console of your chosen AS and start it there.
Depends what you're using - please update question with container/framework details.
Otherwise, using Karaf you may simply SSH into the framework's shell and execute commands as normal.
Another alternative would be to use WebConsole from Apache Felix - this gives you a lot of control wrt bundles (you can even upload to deploy), and also gives you an embedded shell. It's quite extensible, you can write plugins to create new tabs etc. (AFAIK this will run fine in any framework).
Related
I need to run the service outside my eclipse. I have taken my OSGi bundles as jars. I need to up the service of the bundles one by one and access the methods in it. I am trying to use Karaf to do this process. Can anyone tell me a better way to do so?
If you have them as osgi bundles, why don't you just deploy them to karaf?
I'm developing a java base app which has to be deployed in PROD to Google App Engine. I need the set the <secure>true</secure> flag inside web.xml when comes time to deploy to PROD. However I'm testing with my appengine:devserver on my workstation and I'm using http (not https) so I have to set it to <secure>false</secure> or comment it out.
Question: what's the easiest way to automate this? I know it's possible with maven profiles but is there something Google plugin for Eclipse made or another way I'm missing? My project is Maven based and I'm starting the devserver either from command line or within the IDE...
Have you tried SessionCookieConfig and setting it programmatically? (e.g.: depending on environment variables)
I discovered that if I start only the webapp using appengine:devserver we don't need to care about true. So this is not a problem if I simply change the way I start the webapp. The problem occurs only if you start the webapp with Tomcat, jBoss or your own jetty server. However I consider a good practice to be able to run the application from something else than GAE just to be sure we aren't binded to a specific engine (server agnostic pattern)...
I want to get a development experience like I get with Play! framework with JAX-RS (with Jersey for example). More specifically I want to use some kind of background compilation and run the compiled code immediately so that I have almost no waiting time.
My first attempt was to use NetBeans background compilation and Maven with plug-ins for Tomcat and Jetty which are restarting the application in the running container. But restarting took too long. I'm wondering if I need to restart the application if code changed or if something like Grizzly or Netty instead of a Servlet container would help.
Any ideas how to get fast reloads with JAX-RS?
Try this,
you need to add the dependencies. It uses jreloader (open source).
ant archetype
Edit:
People are still visiting this post after two years. Now there's a complete alternative for hot reloading and the project is active again http://dcevm.github.io/
You may need to use this as well https://github.com/HotswapProjects/HotswapAgent
Take a look at gretty: https://github.com/groovypp/gretty
It should work with jersey and you should see fast runtime reloads.
JRebel does this: http://zeroturnaround.com/jrebel/
I'm wondering is it possible to "hot develop" spring application.
For example. In Play framework when I change something in template or even controller or configuration I don't need to republish the application or restart server. I just refresh the page.
Is this kind of quick and easy work is possible with spring framework ? Does it depend of server?
If you want true hot (re)deployment you'll probably need to use something that modifies Java class-loading like JRebel.
Spring itself doesn't tell much about redeployment and stuff, but in most cases you can reload your templates without restarting depending on your ViewResolver.
Furthermore in some environments (for example in OSGi) it is possible to hot-deploy classes, resources and nearly everything. Having a properly configured SpringSource Tool Suite and eg. Virgo WebServer it is possible to achieve hot deployment and as such you can reload the running classes as you save them.
I have several webapps deployed to production. I have used Tomcat as my servlet engine for ~10 years now. I'm considering moving to embedding Jetty model from the deploy-a-war-into-Tomcat model.
These webapps are deployed over several servers and some of the are horizontally scaled (using nginx IP hash based partitioning).
I see some advantages:
I can configure my servlet engine for a particular webapp (instead of having a generic configuration for Tomcat which is running several different webapps)
It's easier to horizontally scale my webapp by running multiple Jetty instances (configured to listen on different ports) on the same host. I could also do this with Tomcat (and I have run multiple tomcat instance on the same host in the past), but I've moved to using Debian packages (.deb archives) for deployment and it's not as easy to run multiple Tomcats using this method.
My deployment package (.deb) is more "complete" at build time i.e. I don't have to be sure the Tomcat instance is configured correctly.
And disadvantages:
More instances of a servlet engine running on a server means more resources being used
I've never used Jetty. I don't think I have any Tomcat-specific stuff going on in my webapps, but I'm not sure.
My main concern is the amount of resources that Jetty will use. If I had one Tomcat instance running 4 webapps, what will the difference in resources (memory/processor) be with four Jetty instances running?
This question is probably too open-ended, but I'm curious to know if I'm overlooking something or if anybody has any experience moving from Tomcat to (embedded) Jetty.
The web container I've found easiest to embed in a jar file (and it is still a valid WAR too) is Winstone (http://winstone.sourceforge.net/).
Jenkins - http://jenkins-ci.org/ - use this container so it has been pretty stress-tested. Note that it is Servlet 2.4 only.
Well I think there is no direct answer;
I might not fully understand the ".deb" part as I'm not a debian freak :)
I prefer having an instance of tomcat with a number of configurations aka CATALINA_HOME folders where you may specify apps and ports running, so you can always have all your configs separately and change the tomcat instance if needed.
Also, see related post:
Jetty: To embed or not to embed?
I also was used to Tomcat, so in my new project I tried using Jetty to learn about it.
In an enterprise environment (where you have production / testing / development servers) I would stick to Tomcat, mainly because it helps you in getting to separate code from configuration files (now I am working in setting the conf files in a separate jar, because that way when I move changes from testing to production they do not have to manually update the jars that I'll pass to sysadmin).
Other issue is that it looks like that Jetty has changed ownership not so long ago, and looking for info often got me to the old version.
Apart from that, using Jetty is not that different from Tomcat; had to run a little through docs for finding where everything is, but structure is (as last what I have seen, I have not tried anything too complicated) more or less like Tomcat.