JAX-RS or THE way to do REST in Domino Part 2

In part 1 of this series you learned how to setup Eclispe to write OSGi plugins.  Next we get to create a plugin.

1.  On the menu click File -> New -> Plugin Project

2.  Add your Project name and use Eclipse 3.4 Click Next

3.  Make sure Generate an Activator is checked, change Execution Environment to JavaSE 1.6, then Click Finish

4.  Your on the Overview Page of the Plugin, were going to start going through all the tabs on the Plugin, next click the Dependencies Plugin

5.  you’ll already have org.eclipse.core.runtime as a required plugin.  Go ahead and add com.ibm.pvc.webcontainer and org.apache.wink

6.  On the right side of the page add all the packages that use *org.apache.wink* and lotus.domino and javax.servlet.http, javax.servet, and javax.servlet.jsp. Next click on the Extensions tab at the bottom.

7.  Here you will add com.ibm.pvc.webcontainer.application

7a.  Change the contextRoot Details on the right to /myurlpath

7b.  Right-Click on com.ibm.pvc.webcontainer.application in the left window and add a new contentLocation, change it in the right window to “WebContent”

8.  In the package explorer add a new toplevel folder called WebContent, inside that folder add another folder called WEB-INF, and finally inside of that folder add a file called web.xml.

9.  Go back to the plugin.xml by double clicking on it.  then click on the Build Tab.  Check WebContent and bin folders to ensure they get included in the build.

10.  Next we can start updating the web.xml,  I have an example one in my project on my github here:


The web.xml points to the JAX-RS application we haven’t created yet, so you will also need to get the 2 Java files from the project here:


Once you have added those 2 Java files and make sure the namespace matches what the web.xml has for it, you can fix the Activator.

In the previous Java folder there is also an Activator.  if you Overwrite the Activator you have in your project with that one, it will start up wink without any issues.  Consequently this was the strangest part of getting this working, Apparently wink needs this small bit of code in the start method of the activator to ensure that it runs in the right Thread context.  With all of that done you now should have a working Plugin, now you just need to deploy it.  Lots of ways to do this, you can use hot deploy PDE if you have it installed. or you can Right-Click and Export as a Deploy-able Plugin and Fragment, then drop the created jar in “C:\Program Files\IBM\Domino\data\domino\workspace\applications\eclipse\plugins” and restart the http task on your server.  The last and more production efficent way of deploying these is by using the updatesite.nsf.  But first you will have to create a Feature and UpdateSite project.  There are great directions to do all of the General OSGi stuff here:


Once deployed the URL will be http://servername/myurlpath/rest/helloworld

If you have any questions please let me know.  I know there are a lot of steps here and sometimes things can get lost in translation.  But once you do a couple of these most of it is just muscle memory.  I hope to create a video outlying how to do this in an easier follow along manner.  If that would be useful to you please comment and let me know.


7 thoughts on “JAX-RS or THE way to do REST in Domino Part 2

  1. While adding in the required plugins, I kept getting errors on org.eclipse.ui and AbstractUIPlugin; …could not be resolved. I’m fairly certain I followed things to the letter. Thankfully, I was able to clear the errors by switching to target set up by the OpenNTF XPages SDK for Luna (after installing), but I’m curious as to what went wrong, in case you have any insights, I’d love to following along with what you outlined as I feel like I have a hope of understanding the working components.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s