Thursday, August 12, 2010

Spring EYE on JAVA EE – Cond. Detail Installation Instruction

Workstation in windows, presumably Java 6 is installed.

1. download eclipse from the following link, select eclipse IDE for Java Developers
http://www.eclipse.org/downloads/
extract the file to c:\javawork\tools

2. download spring framework from the following link, select "2.5.6.SEC01" then "spring-framework-2.5.6.SEC01-with-dependencies.zip". The version has bundled the dependencies in separate folder.
http://www.springsource.com/download/community
extract the file to c:\javawork\tools

3. download activemq from the following link, select "ActiveMQ 5.3.0 Release" then "apache-activemq-5.3.0-bin.zip"
http://activemq.apache.org/download.html
extract the file to c:\javawork\tools

4. download tomcat 6 from the following link, select "32-bit Windows zip (pgp, md5)"
http://tomcat.apache.org/download-60.cgi
extract the file to c:\javawork\server

5.download project zip file from https://docs.google.com/uc?id=0BxIFLyh-ItQyMTM0Yjc3OWQtODMxYy00NWFiLTkyOWQtZDdkZjNmY2U3YWFi&export=download&hl=en

6. start eclipse, specify the workspace as the following directory
C:\javawork\workspaces
Yours maybe different depending on where you extract the project springdemo.

7. in eclipse, open perspective of Java, import springdemo by following the procedure:
(a) File -> import
(b) General ->Existing Projects into Workspace, then click "Next"
(c) click "Browse" button, find where springdemo is located, in my case at c:\javawork\workspaces\springdemo. springdemo will be loaded in the existing projects. Select it and finish the import

8. go to the view of "Navigator", compare the file structure with the one listed in the blog:
http://hr1551.blogspot.com/2010/03/eye-on-java-ee-springs-practical_5312.html
Add the missing four folders: activemq-data, doc, report, resource/lib

9. copy the required libraries into the resource/lib folder: Your source file location varies depending on where you saved them
(a) From the spring framework:
C:\javawork\tools\spring-framework-2.5.6.SEC01\dist\spring.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\dist\modules\spring-webmvc.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\dist\modules\spring-test.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\dist\weaving\spring-aspects.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\antlr\antlr-2.7.6.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\cglib\cglib-nodep-2.1_3.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\dom4j\dom4j-1.6.1.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\hibernate\hibernate3.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\hibernate\hibernate-annotations.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\hibernate\hibernate-commons-annotations.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\hibernate\hibernate-entitymanager.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\hsqldb\hsqldb.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\itext\iText-2.1.3.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\el-api.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\jsp-api.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\jstl.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\jta.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\persistence
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\j2ee\servlet-api.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-commons\commons-collections.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-commons\commons-dbcp.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-commons\commons-lang.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-commons\commons-logging.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-commons\commons-pool.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jakarta-taglibs\standard.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\javassist\javassist-3.4.GA.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\jexcelapi\jxl.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\junit\junit-4.4.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\log4j\log4j-1.2.15.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\slf4j\slf4j-api-1.5.0.jar
C:\javawork\tools\spring-framework-2.5.6.SEC01\lib\slf4j\slf4j-log4j12-1.5.0.jar

(b) from ActiveMQ package
C:\javawork\tools\apache-activemq-5.3.0\activemq-all-5.3.0.jar
C:\javawork\tools\apache-activemq-5.3.0\lib\optional\xbean-spring-3.6.jar

10. check the build path configuration by right click the project name springdemo ->Build Path->Configure Build Path. The only missing jar left should be external jars point to a tomcat location.

11. fix the missing tomcat jars by add them as external jars following the steps: Tab Libraries ->Add External JARS, find the tomcat location, in my case: C:\javawork\server\apache-tomcat-6.0.29\lib, yours may vary depending on where saved. Select all jars in the folder plus the two jars: commons-daemon.jar and tomcat-juli.jar located in bin folder. (Or as I did copy these two jars to the lib folder and then be selected along with other library files)

12. Now all the missing jars will have a duplicated records in the list so simply remove all missing jars.

13. Now project should be able to be compiled and no more errors.

14. modify the following files so they all points to the correct locations for Java, Tomcat, and Spring:
build.xml
db/server.bat (server.bat maybe displayed as server.bat.changeitbackpls cause gmail does not allow sending executable file, change it back to server.bat)

15. modify tomcat configure file, server.xml in the C:\javawork\server\apache-tomcat-6.0.29\conf so it can include springdemo by adding the following xml element within the <Host></Host> tag. Make sure the docBase point to the correct location where project is saved.
<Context path="/springdemo" docBase="C:\javawork\workspaces\springdemo\war"
crossContext="false" debug="0" reloadable="true" />

16. now it is time to run it by running the default task, runInEclipse, in the build.xml. It will complete the following elemental tasks
(a)startHSQLDB
(b)createHSQLTables
(c)startAppTier
(d)startWebTier
Checking the "Windows Task Manager" there should be three java processes running, corresponding to the HSQLDB, AppTier, and WebTier.
Go to the URL: http://localhost:8080/springdemo/ to check out the application.

A couple of notes for the demo application:
1. After initialization, there is one order in the system. Can be seen by click: Want to View Existing Orders?
2. There is no report after initialization.
3. Adding multiple order for any one specific product, simply click the Add To Cart at the end of the product line multiple times.
4. Running report, only two reports available, and the date format has to be yyyy-mm-dd. Running report will simple submit the report request. It is the asynchronized process. View Report need to go the other link of: Want to See Past Reports?
5. There are some broken links and some pages are used in multiple places, therefore some language/labels does not make sense.

Potential improvement to demonstrate more development practice but not done here:
1. I18n
2. Integration of Automated UAT test by adopting Selenium.
3. Component Validation Test.
4. Better dependency management by adopting sophisticated framework like Ivy or Maven.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home