This page describes how to configure a Tomcat installation to run Alfresco's Web Client as one Tomcat webapp and, in parallel, a second Tomcat webapp that uses Tapestry 4.1.x and accesses the Alfresco repository.
This wiki page was not created by Alfresco engineers but contributed by community members; it is therefore neither official nor does it come with any kind of guarantee as far as accuracy and compatibility is concerned.
Install Tomcat & Alfresco, and Tapestry. Notice that the directory tomcat/shared/lib is empty and tomcat/shared/classes contains a folder hierarchy with one file (wcm-bootstrap-context.xml).
Create your Tapestry webapp. I created mine using Eclipse's Web Tools Platform but you can also create it manually. Start with a very simple Tapestry webapp that â€“ for the time being â€“ is independent of Alfresco. (Even though the goal is to be able to query/modify the Alfresco repository from the Tapestry webapp.)
Make sure both Alfresco's Web Client and your (very basic) Tapestry webapp work.
Sharing Alfresco's code base for use in other webapps (in our case, for the Tapestry webapp)
In order for the Tapestry webapp to be able to access the repository, it needs to have access to Alfresco's code base and (at runtime) to the Spring beans representing the Alfresco services (the bean serviceRegistry). For this, I followed this advice, which means:
Stop Tomcat if it is running.
Deploy tomcat/webapps/alfresco.war. You can do this by starting up Alfresco and shutting down again.
Copy the contents of the directory tomcat/webapps/alfresco/WEB-INF/classes/ to tomcat/shared/classes/. Then remove all contents of the former directory. (We copy & delete instead of just moving in order to make sure that we do not delete the previous content in tomcat/shared/classes, which in my case â€“ as noted above â€“ is the single file wcm-bootstrap-context.xml.)
Copty the contents of the directory tomcat/webapps/alfresco/WEB-INF/lib/ to tomcat/shared/lib/. Then remove all contents of the former directory. (Again, copy & delete instead of move in order to keep possibly existing contentâ€¦)
Restart Tomcat and make sure both webapps, Alfresco's Web Client and your Tapestry webapp, continue to work.
Share Alfresco's application context with your Tapestry webapp
We need to make Alfresco's application context available to your Tapestry webapp in order to access the bean serviceRegistry from Tapestry. You can accomplish this as follows:
In your Tapestry webapp's WEB-INF/ directory add a file called hivemodule.xml with this content:
Lastly, make sure the context-entry in your Tomcat's server.xml file for your tapestry webapp has the crossContext attribute set. In my case, the entry looks as follows (yours may be different â€“ remember that I am using Eclipse's Web Tools Platform):