Figure 18-24 Enterprise application installation: step 9 Click Finish and be patient.. When installed, click Save to master configuration to save the installed application.. You can find
Trang 1Figure 18-18 Enterprise application installation: step 3
4 Map data sources for all EJB 2.0 CMP beans (Figure 18-19)
Figure 18-19 Enterprise application installation: step 4
5 Map EJB references to beans (Figure 18-20)
Trang 26 Map virtual hosts for Web modules (Figure 18-21).
Figure 18-21 Enterprise application installation: step 6
7 Map modules to application servers (Figure 18-22)
Figure 18-22 Enterprise application installation: step 7
8 Ensure that all unprotected EJB 2.0 methods have the correct level of protection (Figure 18-23)
Trang 3Figure 18-23 Enterprise application installation: step 8
9 A Summary report is produced (Figure 18-24)
Figure 18-24 Enterprise application installation: step 9 Click Finish and be patient Messages are displayed in the console: Check the SystemOut.log on the Deployment Manager or Server where the application is deployed for specific information about the EJB Deploy process as it occurs
ADMA5009I: Application archive extracted at C:\DOCUME~1\FUNDY\LOCALS~1\Temp\app_f4fa315b45\ear ADMA5003I: Jsps in wars ItsoProGuideStoredProcWeb.war, ItsoProGuideWebServ.war, ItsoProGuideWebServClient.war,
Trang 4ItsoProGuideXmlWeb.war, ItsoProGuideDataBaseWeb.war compiled successfully
ADMA5005I: Application ItsoProGuide configured in WebSphere repository ADMA5001I: Application binaries saved in
D:\WebSphere\AppServer\wstemp\UELI\workspace\cells\FUNDY\applications\
ItsoProGuide.ear\ItsoProGuide.ear ADMA5011I: Cleanup of temp dir for app ItsoProGuide done
ADMA5013I: Application ItsoProGuide installed successfully
If you want to start the application, you must first save changes to the master configuration
When installed, click Save to master configuration to save the installed application You can find the installed application in:
c:\WebSphere\AppServer\installedApps (under the node)
Regenerating HTTP Server plug-in configuration
When the application is installed we have to update the IBM HTTP Server’s plug-in configuration to make it aware of the new URLs that the application uses:
Select Environment (left side) and Update Web Server Plugin
Click OK to regenerate the plugin
Either wait until the IBM HTTP Server has picked up the new configuration (default is every 60 seconds) or restart the IBM HTTP Server
Starting the enterprise application
You can start the ItsoProGuide enterprise application by expanding Applications and selecting Enterprise Applications and then select the application and click Start
This may work, dependent on the modifications you made to the configuration Sometimes it is necessary to stop and start the server:
Use the startServer.bat and stopServer.bat scripts in
c:\WebSphere\AppServer\bin
Use the icons in the program folder or in First Steps
Trang 5Testing the applications
You can test the application using the built-in HTTP server or the stand-alone HTTP server
Running the Web applications
Open a browser and enter these URLs:
http://hostname:9080/ItsoProGuideBasicWeb <=== from another machine
http://localhost:9080/ItsoProGuideBasicWeb <=== from the same machine
http://localhost:9080/ItsoProGuideStrutsWeb http://localhost:9080/ItsoProGuideDataBaseWeb/ListCreditsInputForm.html
enter type: C or D, and a partial last name: %i%
http://localhost:9080/ItsoProGuideDataBaseWeb/TestDBBeans.jsp
http://localhost:9080/ItsoProGuideStoredProcWeb/RunStoredProcedure.jsp
http://localhost:9080/ItsoProGuideStoredProcWeb/RunGetCustomerBean.jsp http://localhost:9080/ItsoProGuideStoredProcWeb/RunTransfer.jsp
Note: the stored procedures must be installed on the server machine
http://localhost:9080/ItsoProGuideWebServ/RunBanking.jsp http://localhost:9080/ItsoProGuideWebServClient/TestBankingWebService.jsp
If you have regenerated the Web server plugin, start the HTTP server and you can test the applications using URLs without the 9080 port:
http://hostname/ItsoProGuideBasicWeb
Running the application client module
To run the application client module, use these commands:
cd \WebSphere\AppServer\bin where WebSphere is installed
launchClient.bat d:\WebSphere\AppServer\installableapps\ItsoProGuide.ear
-CCclasspath=d:\SQLLIB\java\db2java.zip
To run the application on another machine you must have the WebSphere client installed The command would be:
launchClient.bat d:\WebSphere\AppServer\installableapps\ItsoProGuide.ear
-CCclasspath=d:\SQLLIB\java\db2java.zip
-CCBootstrapHost=hostname
Note that you must provide the DB2 JDBC classes in the classpath
Trang 6Remote debugging
With the enterprise application installed on a real WebSphere Application Server you can now perform remote debugging as described in “Debugging on a remote WebSphere Application Server” on page 566
Command line tools
Command line tools can greatly speedup deployment of applications and other WebSphere configuration tasks
We only cover a small subset of the tools; those which seem useful to an application developer and tester For a complete discussion of the tools, refer to the WebSphere documentation
Command line tools come in two sets:
Batch commands (.bat files in WebSphere\AppServer\bin)
Scripting tool (started with the wsadmin.bat file)
Batch commands
Here is a list of some of the commands:
assembly—runs the Application Assembly Tool (AAT)
clientConfig— runs the Application Client Configuration Tool
backupConfig—creates a ZIP file of all the configuration information
restoreConfig—restores a configuration from a backup file
dumpNameSpace—lists all the JNDI names from the name server
ejbDeploy—generates deployed code for an EJB JAR file
firstSteps—launches the First Steps menu
GenPluginCfg—generates the HTTP plugin
launchClient—run an application client module
JspBatchCompiler—compiles the JSPs for an application server
startServer—starts a server
stopServer—stops a server
serverStatus—report if a server is running
setupCmdLine—sets the classpath for most of the other tools
wsadmin—starts the administration scripting tool
Trang 7Scripting tool: wsadmin
WebSphere Application Server 5.0 provides a scripting tool, wsadmin, with which many of the configuration functions can be run in batch For a description of all the functions, refer to the WebSphere documentation
Wsadmin can be run with a single command, or you can interact with the tool:
Single command example:
wsadmin -c "$AdminApp list"
A single command is passed to wsadmin using the -c option The $AdminApp list command lists all the installed applications
To start wsadmin in interactive mode, enter wsadmin: D:\WebSphere\AppServer\bin>wsadmin
WASX7209I: Connected to process "server1" on node a23wph18 using SOAP connector; The type of process is: UnManagedProcess
WASX7029I: For help, enter: "$Help help"
wsadmin>
Example commands
Once the interactive mode has started, you can enter commands, such as:
$AdminApp list
$AdminApp install c:/ItsoProGuide.ear
$AdminConfig save Some commands work with objects that you have to retrieve first For example, to regenerate the HTTP server plugin:
set pluginGen [$AdminControl completeObjectName type=PluginCfgGenerator,*]
===> output:
WebSphere:platform=common,cell=a23wph18,version=5.0,name=PluginCfgGenera tor,mbeanIdentifier=PluginCfgGenerator,type=PluginCfgGenerator,
node=a23wph18,process=server1
$AdminControl invoke $pluginGen generate "c:/WebSphere/AppServer c:/WebSphere/AppServer/config a23wph18 null null plugin-cfg.xml"
===> no output Stopping and starting an enterprise application:
set appManager [$AdminControl queryNames cell=a23wph18,node=a23wph18, type=ApplicationManager,process=server1,*]
$AdminControl invoke $appManager stopApplication ItsoProGuide
$AdminControl invoke $appManager startApplication ItsoProGuide
Trang 8Example script
You can also write script files with multiple commands and run the file using: wsadmin -f RunningApplications.script
The sample script in Figure 18-25 can be found in the Information Center It lists all the applications running on all the servers on all the nodes
Figure 18-25 Sample wsadmin script to list all applications
# retrieve all cells
set cells [$AdminConfig list Cell]
foreach cell $cells {
# retrieve nodes for each cell
set nodes [$AdminConfig list Node $cell]
foreach node $nodes {
set cname [$AdminConfig showAttribute $cell name]
set nname [$AdminConfig showAttribute $node name]
# retrieve servers for each node
set servs [$AdminControl queryNames type=Server,cell=$cname,node=$nname,*] puts "Number of running servers on node $nname: [llength $servs]"
foreach server $servs {
set sname [$AdminControl getAttribute $server name]
set ptype [$AdminControl getAttribute $server processType]
set pid [$AdminControl getAttribute $server pid]
set state [$AdminControl getAttribute $server state]
set jvm [$AdminControl queryNames
type=JVM,cell=$cname,node=$nname,process=$sname,*] set osname [$AdminControl invoke $jvm getProperty os.name]
puts " $sname ($ptype) has pid $pid; state: $state; on $osname"
# retrieve applications
set apps [$AdminControl queryNames
type=Application,cell=$cname,node=$nname,process=$sname,*] puts " Number of applications running on $sname: [llength $apps]"
foreach app $apps {
set aname [$AdminControl getAttribute $app name]
puts " $aname"
}
puts " -" puts ""
}
}
}
Trang 9All the JAR files in the WebSphere lib folder are automatically in the classpath of the WebSphere Application Server If your enterprise application uses any external JAR files that are not in the lib folder or in the system classpath, then they must be added to the classpath One way to accomplish this is by copying the JAR files into the WebSphere lib folder
For example, if you create a Web service from an SQL statement (we did not do this in this document, but it is possible), then the Web Services Object Runtime Framework (WORF) is used at runtime In this case you have to add the WORF runtime classes to the classpath You can find the worf.jar file in:
<wsadhome>\wstools\eclipse\plugins\com.ibm.etools.webservice_5.0.1\runtime
Summary
In this chapter we described the basic steps for setting the deployment descriptors and exporting an application from Application Developer and then installing it in WebSphere Application Server, including the configuration that is required in the server
Note that WebSphere Application Server has many performance and tuning options that we do not cover in this redbook
Trang 10Chapter 19. Building applications with
Ant
In this chapter we show how to use the Ant tool to build your projects and perform some special customizations in order to generate the output that you want Traditionally, building applications have been performed by using shell scripts or batch files in UNIX® or Windows environments, or by using tools such as make While these approaches are still valid, developing Java applications—especially
in a heterogeneous environment—introduces new challenges A particular limitation with traditional tools is the close-coupling to a particular operating system With Ant you can overcome these limitations and perform the build process in a standardized fashion regardless of platform
19