|
||
|
||
Installation - WindowsSetupDownload the software as described in Lesson 1 - Technology, and unzip into a temporary directory. For convinence, all software below is installed in Java (J2SDK)double click on
License
Select Accept terms of license
[Next]
Custom Configration
[Change]
Set Destination Folder c:\www\j2sdk1.4.2_04\
[Ok]
[Next]
Browser Registration
[Install]
Setup Completed
[Finish]
A system reboot is necessary Tomcatdouble click on
Welcome
[Next]
License Agreement
[I Agree]
Choose Components
Select Custom
+ Expand Tomcat and tick Service
[Next]
Choose Install Location
[Browse]
c:\www\tomcat
[Next]
Configuration
HTTP/1.1 Port 8080
User Name admin
Password admin
[Next]
Java Virtual Machine
c:\www\j2sdk1.4.2_04 (dir from previous J2SDK installation)
[Install]
Completed
tick Run Apache Tomcat
[Finish]
NOTE: While installation allows you to start Tomcat, a reboot is usually necessary. Using Internet Explorer or similiar Browser goto
http://localhost:8080
Eclipsedouble click on unzip files to c:\www double click on Tomcat Examples Configuration
The following instructions create a custom Tomcat Environment for an example application.
For reference, the following will utilise the variable CATALINA_HOME. Ensure tomcat is not running. 1. Edit $CATALINA_HOME\conf\web.xml and add the following in the section providing similar syntax after corresponding *.jsp entry
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
NOTE the .html extension is left for defining normal html files when working with http apache server applications, not applicable with tomcat. 2. Rename $CATALINA_HOME\conf\server.xml to $CATALINA_HOME\conf\server.xml.orig 3. Edit $CATALINA_HOME\conf\server.xml and include the following
<Server port="8005" shutdown="SHUTDOWN">
<GlobalNamingResources>
<Resource name="jdbc/example" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/example">
<parameter><name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
<parameter><name>maxActive</name> <value>20</value></parameter>
<parameter><name>maxIdle</name> <value>10</value></parameter>
<parameter><name>maxWait</name> <value>10000</value></parameter>
<parameter><name>validationQuery</name> <value>SELECT 1</value></parameter>
<parameter><name>removeAbandoned</name> <value>true</value></parameter>
<parameter><name>removeAbandonedTimeout</name> <value>120</value></parameter>
<parameter><name>driverClassName</name> <value>com.mysql.jdbc.Driver</value></parameter>
<parameter><name>url</name> <value>jdbc:mysql://localhost:3306/example?autoReconnect=true</value></parameter>
<parameter><name>username</name> <value>example</value></parameter>
<parameter><name>password</name> <value>example</value></parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="example">
<Connector port="80" />
<Engine name="example" defaultHost="example.dev" unpackWARs="false" debug="0">
<Host name="example.dev" appBase="webapps/example">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="example_access_log." suffix=".txt" pattern="common"/>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs"
prefix="example_host_log." suffix=".txt" timestamp="true"/>
<Context path="" docBase="www/web" debug="0" reloadable="true">
<ResourceLink name="jdbc/example" global="jdbc/example" type="javax.sql.DataSource"/>
<ResourceLink name="mail/Session" global="mail/Session" type="javax.mail.Session"/>
</Context>
</Host>
</Engine>
</Service>
</Server>
4. Rename $CATALINA_HOME\webapps to $CATALINA_HOME\webapps.orig 5. Download example.zip and unzip into $CATALINA_HOME. This will create $CATALINA_HOME\webapps\example\... NOTE: 6. Copy necessary jar files.
A current version of these files are included here In addition, $JAVA_HOME\lib\tools.jar must be copied to $CATALINA_HOME\common\lib to enable compiling of generated JSP pages. Replace tools.jar file if it exists. $JAVA_HOME is the installation directory of Java e.g. c:\www\j2sdk_1.4.2_04 7. Update Hosts edit c:\windows\system32\drivers\etc\hosts and add entry, leave any current lines with 127.0.0.1 127.0.0.1 example.dev Ensure you shut down all versions of Browser. Using Internet Explorer or similiar Browser goto http://example.dev Port 80Port 80 is what is used to on servers as the default for web pages. By default, software
such as Apache HTTP Server use Port 80. Tomcat by default uses port 8080. It is possible that
tomcat can be configured to use port 80, depending on your requirements. Next Lesson - HTML Refresher |
||
| © Copyright 2004 - ARABX Pty Ltd. All Rights Reserved |