The following configuration and services are required to run the portal example. ConfigurationAlthough defining and deploying WAR files in Tomcat is outside the scope of this chapter, you can use the following Web.xml file to demonstrate the servlet mapping required in the example: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app> <servlet> <servlet-name>homeplace</servlet-name> <servlet-class>org.jworkplace.homeplace.HomePlace</servlet-class> </servlet> <servlet-mapping> <servlet-name>homeplace</servlet-name> <url-pattern>/homeplace</url-pattern> </servlet-mapping> </web-app> Unzip the portal.zip file. The included WAR file can simply be copied to the /webapps directory of your Tomcat installation prior to startup. This file will be expanded to create the Web resources necessary to run the portal. Starting ServicesThere are a number of services that will initially be required. These services include Tomcat, reggie, mahalo, and JavaSpaces. Starting TomcatTomcat has instructions on configuring and starting the Tomcat server. To start the server, go to the \bin directory and invoke the startup.bat or startup.sh command file. You must set the JAVA_HOME environment variable to point to your Java installation prior to startup. Be sure to copy the homeplace.war file to the Tomcat \webapps directory prior to starting. Starting reggieTo start reggie, the Jini-supplied ServiceRegistrar, use the script in Listing 18.9. Simply set the JINI_HOME environment variable to your Jini installation, and your HTTP_ADDRESS to an accessible Tomcat context, such as /Root and the port Tomcat is using: Set HTTP_ADDRESS=C:\jakarta-tomcat4.0\webapps\Root:8081 It is here that you will place all files that must be available for download to clients and services. For instance:
Listing 18.9 The startReggie.bat File@echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public echo Java P2P Unleashed echo - echo Jini install directory %JINI_HOME% echo Tomcat Web server %HTTP_ADDRESS% echo Default group %GROUPS% echo - java -jar -Djava.security.policy=%JINI_HOME%\policy\policy.all %JINI_HOME%\lib\reggie.jar http://%HTTP_ADDRESS%/reggie-dl.jar %JINI_HOME%\policy\policy.all .\services\logs\ reggie_log %GROUPS% Starting mahaloJavaSpaces requires the transaction service mahalo. To start mahalo, run the script in Listing 18.10. Listing 18.10 The startMahalo.bat File@echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public echo Java P2P Unleashed echo - echo Jini install directory %JINI_HOME% echo Web server %HTTP_ADDRESS% echo Default group %GROUPS% echo - echo Starting the mahalo transaction service... java -jar - Djava.security.policy=%JINI_HOME%\example\txn\policy.all - Dcom.sun.jini. mahalo.managerName=TransactionManager %JINI_HOME%\lib\mahalo.jar http://%HTTP_ADDRESS%/ mahalo- dl.jar %JINI_HOME%\example\txn\policy.all.\services\logs\txn_log %GROUPS% Starting JavaSpacesNow start JavaSpaces, using the script in Listing 18.11. Listing 18.11 The startOutrigger.bat File@echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public set SPACENAME=JavaSpaces echo Java P2P Unleasehd echo - echo Jini install directory %JINI_HOME% echo Web server %HTTP_ADDRESS% echo Default group %GROUPS% echo Default space name %SPACENAME% echo - echo Starting the outrigger JavaSpaces service... java -jar -Djava.security.policy=%JINI_HOME%\policy\policy.all- Dcom.sun.jini.outrigger. spaceName=%SPACENAME% %JINI_HOME%\lib\outrigger.jar http://%HTTP_ADDRESS%/outrigger-dl. jar %JINI_HOME%\policy\policy.all .\services\logs\js_log %GROUPS% You should now be able to access your portal and begin to add content by starting a Web browser and entering http://hostname:8081/homeplace/homeplace.html Figure 18.5 shows the portal in action. Figure 18.5. The personal portal. |