95-702 Organizational Communication and Distributed ObjectTechnologies Homework 1 Due Wednesday, January 26, 2005Application Server Installation and Servlets95-702 OCT Carnegie Mellon University 95-702 Organizational Communication and Distributed Object Technologies Homework 1 Due Wednesday, January 26, 2005 Application Server Installation and ServletsTopics: Distributed Systems, Application Server Installation and deployment, Servlets, Log Files, SAX Event Handling, RSS news feeds In this lab we will be using Sun’s Java System Application Server Platform Edition 8 to build several web applications. In Part I, we will present the details associated with the installation and basic configuration of Sun’s Application Server running under Windows NT or Windows 2000 (you may also use Linux). In Part II we will experiment with servlets. In Part III you will be asked to complete work for submission.Part I Installing Sun’s Application ServerRemove J2SDK and JRE (if any)Remove JWSDP (if any)Download and unzip j2eesdk-1_4_01-windows -- I chose D:\Sun\AppServer -- I chose to prompt for admin user name -- Many students change the port from 8080 to 7070 so as not to conflict with a pre-installed Tomcat. You might change the HTTPS port as well. -- I checked “Add bin directory to path”, “create samples server”, and “create desktop shortcut to autodeploy”Download and unzip j2ee-1_4-doc-tutorial_2 from http://java.sun.com/j2ee/1.4/download.html#tutorial -- I unzipped mine to D:\ producing D:\j2eetutorial14Set your environment up so that you can use JAXP (for DOM or SAX) from within the application Server or from stand alone Java:My application server is located at D:\Sun\AppServerMy JDK is located at D:\Sun\AppServer\jdkThe libraries are stored in D:\Sun\AppServer\lib\endorsed and are automatically available to the Application server.To run stand alone java programs that use JAXP, copy the .jar files inD:\Sun\AppServer\lib\endorsed to a new directory called D:\Sun\AppServer\jdk\jre\lib\endorsed (within the JDK). My path variable contains D:\Sun\AppServer\jdk\bin;D:\Sun\AppServer\bin;Download and unzip the Java 2 SDK, Standard Edition Documentation Version 1.4.2. The zip file is called j2sdk-1_4_2-doc and is found at http://java.sun.com/j2se/1.4.2/download.htmlAfter unzipping the documentation I have a directory called 195-702 OCT Carnegie Mellon University D:\Sun\AppServer\jdk\docs that holds documentation for all the standard Java API’s.295-702 OCT Carnegie Mellon University TESTING THE INSTALLATIONTest java withd:\mccarthy>java -versionjava version "1.4.2_04"Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b04)Java HotSpot(TM) Client VM (build 1.4.2_04-b04, mixed mode)Test J2EE startup with d:\mccarthy>cd D:\Sun\AppServer\domains D:\Sun\AppServer\domains>asadmin start-domain domain1Starting Domain domain1, please wait.Log redirected to D:\Sun\AppServer\domains\domain1\logs\server.log.Domain domain1 started.Visit with browser athttp://localhost:8080/Visit admin console at http://localhost:4848/asadminUse log-in ID and password View the log file at Application Server->Logging->Open Log Viewer The help files are very good and are located at Application Console Admin Server Help. Say "hello" to Duke -- copy D:\Sun\AppServer\samples\quickstart\hello.war to D:\Sun\AppServer\domains\domain1\autodeploy -- visit http://localhost:8080/helloTest J2EE shutdown withd:\mccarthy>cd D:\Sun\AppServer\domainsD:\Sun\AppServer\domains>asadmin stop-domain domain1Domain domain1 stopped. Test PointBase database withD:\Sun\AppServer\pointbase\tools\serveroption>startserverServer started, listening on port 9092, display level: 0 ... >quitPointBase Server Stopped. Good Bye!Examine server log withD:\Sun\AppServer\domains\domain1\logs>type server.log | more395-702 OCT Carnegie Mellon University Some Notes from Application Server Admin Console Help (not needed for this lab): To start a domain called domain1 asadmin start-domain domain1Starting a domain starts the domain's application server and administration server instance Stopping a domain shuts down its administration server and application server instance To stop domain1 asadmin stop-domain domain1The deployment life-cycle: Applications or modules are installed in specific domains. Applications and modules are contained in JAR files. Deployment survives domain shutdown. You need not restart a domain to redeploy an application. An application or module may be enabled or disabled within a domain. To replace an application or module simply redeploy it. Types of J2EE JAR Files: WAR files are Web Application Archives (.war) EJB JAR files hold EJB's (.jar) J2EE Application Client JAR's access enterprise beans via RMI/IIOP (.jar) Resource Adapter Archive (.rar) An Enterprise Application Archive file holds one or more of the above (.ear) Deployment is through the admin console, the deploytool or through asadmin command. Sun implements the JMS API with the Sun Java System Message Queue (formerly Sun ONE Message Queue) The J2EE architecture includes standard resources, such as JDBC, JMS, and JavaMail resources. Custom resources may be built by the developer. When you create a new resource, a new name-object binding is entered into the JNDI repository. Each resource object is identified by a unique, people-friendly name: the JNDI name. A resource object and its JNDI name are bound together by the naming and directory service, which is included with the Application Server. JNDI names are organized hierarchically, much like a file system. In a file system, you can organize your files into subdirectories. In JNDI, resource names are organized into subcontexts. For example, all JDBC resource names must be in java:comp/env/jdbc subcontext. The JNDI name for the resource of a payroll database could be java:comp/env/jdbc/payrolldb.495-702 OCT Carnegie Mellon University Part II Packaging Web
View Full Document