Skip to content
Shubham Gupta edited this page Oct 11, 2013 · 1 revision

How to deploy an auxilliary service in Karma's Jetty server?

If you want to deploy your web-application or a web-service in the same Jetty container that runs Karma, you need to create a war package. Maven allows you to easily create a war package by running mvn package from the top level directory of your source code. Make sure that your packaging is set to war in your pom.xml: <packaging>war</packaging> inside the project element. http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/ has a very good example for creating web-applications and war packages with Maven.

Once you have the war file, you can put it in the external_webapps folder present in the Karma source code directory. After that, you need to edit the Karma's pom.xml to provide the application's context and location as shown with an example below (inside the contextHandlers element):

<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
  <war>${project.basedir}/external_webapps/cleaningService.war</war>
  <contextPath>/cleaningService</contextPath>
</contextHandler>

Everytime you make a change in your service/web-app, you need to recreate a war package and replace the older one.

Clone this wiki locally