Web applications will not, by default, automatically route through the CrossWorlds code that adds native Java access to Domino. The j2eeenabler is a Servlet 3.0 web fragment that needs to be added to any application, into the application's WEB-INF/lib folder. The j2eeenabler only includes the web-fragment.xml file. The classes that the web-fragment.xml points to are in the org.openntf.xworlds.core and will be available server-wide.
The j2eenenabler contributes:
- An ApplicationListener which controls initialisation / registration / deregistration / shutdown of services.
- A servlet filter that initialises and destroys the Domino thread and OpenNTF Domino API sessions for each thread.
- A servlet filter mapping that maps any request through the servlet filter.
If the j2eeenabler is missing, any request to
will fail, throwing a Factory is not initialized for this thread error message. You may also get this message if running from Eclipse and the j2eeenabler source code project is not available - I've had that before.
If you are not using Maven, the jar file can just be added to the WEB-INF\lib folder.
If using Maven, the j2eeenabler jar can be contributed directly from a local Maven repository. But first the Maven repository needs setting up. The details for setting up a local Maven repository from the j2eenabler jar file are on a StackOverflow question. To make it easier, the local Maven repository files have been included in the source code as a zip file. To find out the correct location to extract to, in Window > Preferences go to Maven > User Settings. The location of the Local Repository will be shown.
Extract the contents of the zip file into this folder.
Then in your application's pom.xml, you can just reference the j2eeenabler:
The Application Listener, Filter and Filter Mapping could always be set up manually to the application, if desired. If so, the j2eeenabler jar would not need adding to the application's WEB-INF\lib folder. This may be a preferred route for those using Maven.