Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Run a Google Web Toolkit 2 project on Apache Karaf/ServiceMix

DZone's Guide to

Run a Google Web Toolkit 2 project on Apache Karaf/ServiceMix

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

To simplify the development of Web projects on Apache Karaf/Apache ServiceMix, we have created archetypes to setup WAR or WAB projects. They are very basic but they can be enriched with framework like Struts 2, Wicket, plain JSP or MyFaces JSF as they are currently supported on Apache Karaf - ServiceMix.

For the GWT users, it exists now an archetype which will create a GWT project. To create such a project, you must generate a project from the archetype

mvn archetype:generate \
   -DarchetypeGroupId=org.ops4j.pax.web.archetypes\
   -DarchetypeArtifactId=wab-gwt-archetype \
   -DarchetypeVersion=2.0.0-SNAPSHOT \
   -DgroupId=com.mycompany \
   -DartifactId=hello \
   -Dversion=1.0


build next the WAB using hello/mvn clean install

and deploy it on Apache Karaf


Verify that the web site is well registered :


Next, you can navigate to your application in your browser and click on the button to say Hello.


Remark : A WAB project is nothing more than a WAR excepted it is packaged as a bundle file, that we have removed the WEB-INF/lib dependencies and create a MANIFEST file containing the OSGI instructions.

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}