Deploying WebRenderer Server Edition in a Tomcat container is fairly straight forward when one understands the basic deployment principles. If you deploy WebRenderer Server Edition into your WEB-INF/lib or any other local project directory you will run into issues when trying to redeploy. When you try to redeploy your application Tomcat tries to reload the WebRenderer libraries (which are already loaded in memory) and is refused. You will then be confronted with a message about an UnsatisifiedLinkError in setMozPath. Even though at this point it may look like the end, Tomcat comes to our rescue with some specific instructions (found in the Tomcat docs) on exactly how to deploy components like WebRenderer. The following are the basic steps that will get you up and running with Tomcat and allow as many WebRenderer Server Edition redeploys as your heart desires.
Steps to deploy WebRenderer Server Edition in Tomcat
1) Place all the WebRenderer libraries (webrendererse.jar, webrendererse-xxx.jar, corecomponents-xxx.jar) in your CATALINA_HOME/lib directory. Whatever you do, avoid deploying any WebRenderer libraries to your WEB-INF/lib or WEB-INF/classes directory.
The next two steps are Optional
2) You can control where WebRenderer extracts its components to using the BrowserFactory.setXXX methods. This is particularly helpful if you want to control the extraction and data storage of WebRenderer. If you do not set these methods WebRenderer will extract out to <USER_HOME>/.webrendererse directory. The following methods allow you to specify the home directories and library locations for WebRenderer:
3) Make note that when you are finished with the browser that you destroy it by calling browser.destroy(). This ensures that you do not have any memory issues caused by browsers hanging around when not in use.
That is really all there is to it. It is fairly straight forward and hassle free.
NOTE: If you are using Netbeans you need to ensure that you right click on “Libraries” in your “Projects” view and uncheck the “Package” checkbox next to the WebRenderer Server Edition JAR. If you do not uncheck this, Netbeans will automatically deploy the WebRenderer JAR file out to your <PROJECT>/build/web/WEB-INF/lib directory, and then you will have issues when you try to redeploy your application even after a trivial change.