General Pitfalls Chapters 3 and 4
Just some general observations I have made when trying to work through the two chapters.
Conflicts between Tomcat Web Server, HSQLDB database server, and compiling and packaging application WAR file:
I encountered numerous problems resulting from the three above processes interacting with each other. I will attempt to relate these situations as best as I can. Here goes.
1. Compiling and packaging application WAR file:
Ensure that the HSQLDB database server is not running. This is only applicable if you are using the command to start the HSQLDB database server as presented in Chapter 3, pg. 60, TryItOut step 1. Your War build will not complete successfully.
Reason for conflict:
The startup command uses the hsqldb.jar file located in the Pix application lib directory. The WAR build also attempts to include this same hsqldb.jar file in the WAR package. It is unable to do this because hsqldb.jar is in use by another program [HSQLDB database server].
Solution:
Any time you process the command to compile and package the WAR application file, ensure that HSQLDB is not running.
2. Displaying createAlbum.jsp Form View as shown on pg.111:
This page will only display if there are no Album records in the HSQLDB database. If you have run the process to test this in Chapters 3/4, there will be records. This will cause the page not to display. Also, if you use the command mvn package to compile and package the WAR file, it will run the tests and create records.
Solution:
Use the following command instead - mvn package -Dmaven.test.skip=true.
This will create the WAR file but skip the tests and therefore not create records in the database.
Over time as I dealt with these chapters I have come up with the following procedure whenever I need to produce a new WAR file for deployment:
1. Stop HDQLDB.
2. Stop Tomcat.
3. Create WAR file - mvn package -Dmaven.test.skip=true.
4. Delete old pixweb-0.0.1 WebApp in Tomcat.
5. Copy WAR file to Tomcat webapps directory.
6. Start Tomcat - this will establish a new pixweb-0.0.1 WebApp.
7. Start HSQLDB.
8. Try WebApp.
That's it for now. Hope I didn't forget anything. Hope it makes sense. Hope it helps.
Until next time..........
EverettG
|