I have a webapp (http://sourceforge.net/projects/sf-mvn-plugins/files/m2-repo/net/sf/maven/plugins/example-captaincasa-jnlp/0.1-SNAPSHOT/example-captaincasa-jnlp-0.1-SNAPSHOT.war/download) which uses jsf in a servlet container. This works fine with jetty-maven-plugin run-war target at my local pc. In the future I would like make more of this kind of webapps.
I am looking for a way to deliver these webapps with jetty via jnlp. The end user should be have a zero installation but the webapps needs servlet container and my hoster does not support a servlet container or application server or so on.
I don't like an embedded solution because in this case each webapp must be delivered with a separate jetty und run with a separate jetty -> too big size -> to many download size and so on.
The architecture should be similar to this:
(source: sourceforge.net)
Example: Bundle1 could contains jetty and deployed webapp1 and Bundle2 could contains jetty and deployed webapp1 and webapp2 (related to requirements of end user I would like deliver many variant of my webapps)
But what is my question?
Which jars of jetty are needed? I would like these upload to my homepage for hosting.
Which jar should I use for jetty as main jar to start him via jnlp?
Which main class should I use to start jetty via jnlp?
Which parameter could I use to configure jetty to say this is war of webapp1 and this is war of webapp2.... or this is directory of weapps for hot deployment...?
The important question for me is 1. If this is answered so that I could run jetty local (without maven plugin) and via manual maybe I could solve the rest 2-4.
Why not deploy a normal Java app (with a main() etc.) that invokes Jetty programatically via its Server class? That class is configured via code with the appropriate contexts, servlet classes etc.
I've done that before with success. The only headache is running one Jetty with multiple apps being downloaded on request (if I read your question correctly). Can you use some classloading magic, and load classes/apps on demand from a remote URL ?
I have found another way today. This is interesting too. Here is the concept:
Use java webstart to install an osgi container
Use a bundle x or a osgi service to download all bundles of your app
Use the jetty bundle to provide jetty support
Then the application is installed
I got the idea from this article:
http://www.toedter.com/blog/?p=45
Related
We have an existing eclipse RCP application that works as a standalone product. At a high level, this product is used to configure a image specification using its UI and we can export a sample Image based on these configuration.
Now we are developing another web application that has several modules and one module of it is to develop something that our eclipse RCP application does.
Just to provide a QUICK integration of the RCP application for demo purpose, I plan to run the RCP application separately in the server machine and expose its static functionality as a RESTful webservice. So the module shall make a RESTful call to the RCP application.
Now just to begin with I tried to embed a jetty server for hosting the REST service during the start of RCP application like below
But the thing is after the Jetty server is started I am not able to access the TestWebService using the path i configured. So I am confused if this is the right approach to have a RESTful service inside a RCP application. Please note that iam able to hit the server with http://localhost:1002, but not the service.
Following is the console log when i hit on http://localhost:1002/hello/test:
It's a really weird architecture you're experimenting with.
I mean to write an RCP-application which listens on a port and offers REST services on it; this could lead to further obstacles.
Instead I would seperate it into two software artifacts: an RCP-app and a web-application (.war).
You could extract a business-logic jar (It can be an OSGi plug-in if necessary) contaning your image manipulation logic.
Then include this plug-in/.jar as a dependency in the webapp and offer out it's functionalities thru a Web-container (Tomcat, GlassFish, etc.)
So your other (third) application will connect to the Web-services offered by this .war file.
opt.1) If you need a single running instance (because of database or other shared resource) then your RCP-app will have to use this REST service too.
opt.2) If not then simple compile the .jar/plug-in containing the business-logic into your RCP-app.
I have a WAR deployed to Jetty 9.0.0.M3. I am trying to figure out what I need to set in my context in order to be able to have it reloaded every time I upload an updated war file (without having to restart Jetty).
I had a look at the docs, but I'm afraid I couldn't find what I was looking for. I only know how to do this with the embedded Jetty Maven plugin, but not with the standalone.
Any help would be appreciated! Thanks.
The key is in the deployer. You need to wire up the deployment manager functionality and have it manage the starting of the webapp.
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java
The jetty xml files are effectively a thin skin over java so look the following xml file which is what jetty uses for the traditional webapp startup of our distribution.
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-deploy/src/main/config/etc/jetty-deploy.xml
This ought to get you fixed up.
We'd like to set up a development environment using cloud foundry. Unfortunately, our architecture packages a few different wars into one webapp, each war running under its own context. Furthermore, we have a bunch of absolute URIs with the context in it, too many to rename all of them to relative URIs.
CF apparently deploys a war to the root context. Is there any way to get around this? I tried faking it by editing the web.xml in tomcat/conf/ but when I did a whole other application folder was created on my machine.
Thank you
When you push a Java web app to CloudFoundry, the platform installs and configures the Tomcat instance(s) for you, and you have limited control over the configuration. It is possible to configure your own Tomcat (or other application container) and push it along with your application instead of letting the platform do it for you.
There is a good blog post about using this bring-your-own-container approach with Tomcat 7: https://www.cloudfoundry.org/blog/deploying-tomcat-7-using-the-standalone-framework-2/.
I suggest using this approach to configure a Tomcat 6 or 7 distribution in a way that works for your application, zip up the customized Tomcat distribution along with your war files, and push that bundle as a stand-alone app on CloudFoundry.
I would like to develop a Restlet 2.1 Java SE or Java EE Application that uses a (default) Jetty server, as opposed to an external Jetty/Tomcat server.
But I would like to configure the WAR file/folder that Jetty is processing, even allowing for stop(), reconfigure() or reload(), start() to happen at run time. In the external case, I can use setWar("path to war file/folder") from the Jetty API to achieve my goal, so this is plan B. Plan A is to figure out how to do this from the Restlet 2.1 API.
I cannot see a way to do it and I'm hoping that I'm just missing an obvious, or even not-so-obvious solution.
I think the Jetty WebAppProvider will provide what you need. If not, have a look at my hot swap code for WAR files in an embedded Jetty on this thread.
I'd like to deploy regular war (not OSGi-ed) in Equinox' Jetty. Doable?
The OSGi Web Container specification (part of the OSGi Enterprise Spec) allows you to do exactly this. You will need an implementation of the spec, and there are two available I believe: in Eclipse Gemini or Apache Aries.
Note that deploying a plain WAR to OSGi generally means you don't get any of the advantages of OSGi such as the ability to modularise your web application into bundles. However it is a useful transitional step.
You're going to want to read about Pax WAR Extender since this is what will be putting the war into Jetty. I find that it's best to do the bare minimum to OSGI-fy the war since it should not make the war unusable in a normal app server.
As the link mentions, read this for how to run a WAR with no modification. http://ops4j1.jira.com/wiki/display/paxurl/War+Protocol.
Or this to run a WAR with minor modification http://ops4j1.jira.com/wiki/display/paxweb/OSGi-fy+your+WAR.