Employing a Java based Application Server

milklivereddeepInternet and Web Development

Nov 13, 2013 (3 years and 8 months ago)

56 views

degree dissertation (Diplomarbeit)





Employing a
Java based Application Server
- an introduction -

A step-by-step example developing and
employing an enterprise application using
IBM WebSphere Application Server and
IBM WebSphere Studio Application
Developer




Author: Petra Lehner
Version 1.3; July, 15
th
2004
Contents Page i
Contents
1 Preface.........................................................................................................1
1.1 Goal......................................................................................................1
1.2 Personal note.......................................................................................1
1.3 General Structure.................................................................................2
2 IBM WebSphere Application Server.............................................................5
2.1 Architecture overview...........................................................................5
2.2 Planning the Installation.....................................................................13
2.3 Conducting the Installation.................................................................20
2.4 Verifying the Installation.....................................................................27
2.5 How to use the Administrative Console..............................................34
3 IBM WebSphere Studio Application Developer..........................................36
3.1 General View......................................................................................36
3.2 Planning the Installation.....................................................................37
3.3 Conducting the Installation.................................................................38
3.4 Verifying the Installation and Update.................................................46
3.5 How to use IBM WebSphere Studio...................................................47
4 Example Servlet - HelloServer....................................................................50
4.1 Information on Java Servlets..............................................................50
4.2 About the Example.............................................................................51
4.3 Hello Server, development.................................................................53
4.4 Hello Server, deployment...................................................................61
5 Example Java Server Page – Guess Game...............................................71
5.1 Information on HTML Pages..............................................................72
5.2 Java Server Pages (JSP)...................................................................72
5.3 Information on Cascading Style Sheets (CSS)..................................73
5.4 About the example.............................................................................75
5.5 A Simple Guess Game.......................................................................77
5.6 Optional: Number Guess Game (Bean).............................................91
Contents Page ii
6 IBM DB2 Universal Database.....................................................................92
6.1 Planning the Installation.....................................................................93
6.2 Conducting the Installation.................................................................93
6.3 Verifying the Installation.....................................................................99
6.4 How to use IBM DB2 Universal Database........................................100
7 Example Enterprise Java Bean - MyVisitor...............................................102
7.1 Information on Enterprise Java Beans (EJB)...................................102
7.2 About the example...........................................................................102
7.3 Part 1 – Enterprise Java Bean (EJB)...............................................104
7.4 Part 2 – Web contents.....................................................................139
7.5 Part 3 – JDBC..................................................................................160
7.6 Summary..........................................................................................167
8 Uninstalling WebSphere Applications.......................................................168
8.1 Preparing Uninstallation...................................................................168
8.2 Conducting Uninstallation................................................................169
8.3 Verifying Uninstallation.....................................................................171
9 Appendix: Troubleshooting.......................................................................172
9.1 Problems during the Installation.......................................................172
9.2 Problems running applications.........................................................173
9.3 Error messages................................................................................179
9.4 Problems using the administrative console......................................182
10 Appendix: Example Variable Settings......................................................183
10.1 Settings used by the installed products............................................183
11 Appendix: Advanced Users Guide...........................................................187
11.1 IBM WebSphere Application Server.................................................187
11.2 IBM WebSphere Studio Application Developer................................192
11.3 IBM DB2 Universal Database...........................................................195
12 Referenced Information...........................................................................198
13 Resources and Utilities............................................................................202
14 Abbreviations and Acronyms...................................................................203
Contents Page iii
Contents: Figure
Figure 1–1: General Structure ...................................................................2
Figure 1–2: Process Overview....................................................................3
Figure 1–3: MyVisitor Example using Number Guess Game......................4
Figure 2–1: IBM WebSphere architecture overview...................................5
Figure 2–2: IBM WebSphere Application Server, administration................7
Figure 2–3: IBM WebSphere Application Server, configuration repository.8
Figure 2–4: Request cartoon (1).................................................................8
Figure 2–5: Excerpt plugin-cfg.xml..............................................................9
Figure 2–6: Request cartoon (2).................................................................9
Figure 2–7: Request cartoon (3).................................................................9
Figure 2–8: Request cartoon (4)...............................................................10
Figure 2–9: Recognize possibilities...........................................................11
Figure 2–10: Installation images in WebSphere Application Server
packages [cp. IBMa02, 34]....................................................12
Figure 2–11: Activities Installing IBM WebSphere Application Server........13
Figure 2–12: Single Server topology [IBMI03, page 37].............................15
Figure 2–13: Checking IP ports, information...............................................15
Figure 2–14: Checking IP ports - example..................................................16
Figure 2–15: Machine name.......................................................................17
Figure 2–16: User accounts, define a new user.........................................18
Figure 2–17: User accounts, part of the administrator group......................19
Figure 2–18: User accounts, changing the password.................................19
Figure 2–19: LaunchPad, language selection.............................................20
Figure 2–20: LaunchPad............................................................................21
Figure 2–21: Installation wizard, language selection..................................22
Figure 2–22: Installation wizard, welcome screen......................................22
Figure 2–23: Installation wizard, software license agreement....................23
Figure 2–24: Installation wizard, checking system prerequisites................23
Figure 2–25: Installation wizard, destination directories.............................24
Figure 2–26: Installation wizard, node name and hostname......................24
Figure 2–27: Installation wizard, using windows services...........................25
Figure 2–28: Installation wizard, summary information...............................26
Contents Page iv
Figure 2–29: First Steps window.................................................................27
Figure 2–30: Status message, WebSphere Application Server start..........29
Figure 2–31: Status message, WebSphere Application Server
verification..............................................................................29
Figure 2–32: Administrative Console, log in................................................30
Figure 2–33: Administrative Console, Home..............................................30
Figure 2–34: Administrative Console, update Plug-in.................................31
Figure 2–35: First Steps, stopping the server.............................................31
Figure 2–36: Starting IBM HTTP Server.....................................................32
Figure 2–37: Embedded HTTP Server vs. HTTP Server and Plug-in.........32
Figure 2–38: Snoop Servlet........................................................................33
Figure 2–39: Relevant directories pointed out............................................34
Figure 2–40: IBM WebSphere, Administrative Console Areas...................35
Figure 3–1: Live Cycle, IBM Product Support...........................................36
Figure 3–2: Installation of IBM WebSphere Studio, Activities overview....37
Figure 3–3: IBM WebSphere Studio, Product CD.....................................38
Figure 3–4: Extracting files for IBM WebSphere Studio Application
Developer..............................................................................39
Figure 3–5: WebSphere Studio Installation Launcher..............................39
Figure 3–6: IBM WebSphere Studio, Installation Wizard, license
agreement..............................................................................40
Figure 3–7: IBM WebSphere Studio, Installation Wizard, Installation
folder......................................................................................40
Figure 3–8: IBM WebSphere Studio, Installation Wizard, list of features.41
Figure 3–9: IBM WebSphere Studio, Installation Wizard, Installation com-
pleted.....................................................................................41
Figure 3–10: IBM WebSphere Studio, extract update files.........................42
Figure 3–11: IBM WebSphere Studio, Current Configuration.....................43
Figure 3–12: IBM WebSphere Studio, Updates..........................................43
Figure 3–13: IBM WebSphere Studio, Update, Initial window....................44
Figure 3–14: IBM WebSphere Studio, Update, installation wizard.............44
Figure 3–15: IBM WebSphere Studio, Update, features window................45
Figure 3–16: IBM WebSphere Studio, Update, install location...................45
Figure 3–17: IBM WebSphere Studio, Update...........................................46
Contents Page v
Figure 3–18: IBM WebSphere Studio, Update Manager, current configuration
...............................................................................................46
Figure 3–19: IBM WebSphere Studio, Workbench Example......................48
Figure 3–20: Different perspectives............................................................48
Figure 3–21: IBM WebSphere studio, perspectives....................................49
Figure 4–1: Example Hello Server, Activities Overview............................50
Figure 4–2: Java Servlets.........................................................................51
Figure 4–3: Example Servlet, Use Case...................................................52
Figure 4–4: Example HelloServer, Process..............................................53
Figure 4–5: Example HelloServer, swim lane activity diagram.................53
Figure 4–6: Example Hello Server, create new project (1).......................54
Figure 4–7: Example Hello Server, create new project (2).......................54
Figure 4–8: Example Hello Server, file and directory structure.................55
Figure 4–9: Example Hello Server, create servlet.....................................56
Figure 4–10: Example Hello Server, servlet wizard....................................56
Figure 4–11: Example Hello Server, edit the servlet...................................57
Figure 4–12: Example HelloServer, activity diagram..................................58
Figure 4–13: Example Hello Server, workspace directory..........................59
Figure 4–14: Example Hello Server, Output (quick and dirty).....................60
Figure 4–15: Example Hello Server, Deployment.......................................60
Figure 4–16: Packing files to archives........................................................61
Figure 4–17: J2EE Hierarchy [ISEL02, p 151]............................................62
Figure 4–18: Example Hello Server, archive...............................................62
Figure 4–19: Example Hello Server, export EAR........................................63
Figure 4–20: Example Hello Server, Import (1)...........................................64
Figure 4–21: Example Hello Server, Import (2)...........................................65
Figure 4–22: Example Hello Server, Import (3)...........................................65
Figure 4–23: Example Hello Server, Import (4)...........................................65
Figure 4–24: Example Hello Server, Import (5)...........................................66
Figure 4–25: Example Hello Server, Import (6)...........................................66
Figure 4–26: Example Hello Server, Import complete................................67
Figure 4–27: Example Hello Server, Save to master configuration............67
Figure 4–28: Example Hello Server, Start the application..........................68
Figure 4–29: Example Hello Server, Update Plug-in (2).............................69
Contents Page vi
Figure 4–30: Example Hello Server, excerpt from the Plug-in....................69
Figure 4–31: Example Hello Server, run on server.....................................70
Figure 4–32: Example Hello Server, application installed on IBM
WebSphere Application Server..............................................70
Figure 5–1: Example Guess, Activities Overview......................................71
Figure 5–2: HTML Structure.....................................................................72
Figure 5–3: JSP in IBM WebSphere Application Server...........................73
Figure 5–4: Adding a style........................................................................74
Figure 5–5: Example Guess, Use Case....................................................75
Figure 5–6: Example Guess, Process......................................................76
Figure 5–7: Example Guess, swim lane activity diagram..........................76
Figure 5–8: Example Guess, create new jsp file.......................................77
Figure 5–9: Web project structure [cp. Wah02, 123]................................78
Figure 5–10: Example Guess, HTML code fragment..................................79
Figure 5–11: Example Guess, activity diagram...........................................80
Figure 5–12: Example Guess, Code preview..............................................81
Figure 5–13: Cascading Style Sheet Designer...........................................82
Figure 5–14: Example Guess, Preview (1).................................................83
Figure 5–15: Example Guess, Preview (2).................................................83
Figure 5–16: Server Configuration, create a new Server (1)......................84
Figure 5–17: Server Configuration, create a new Server (2)......................84
Figure 5–18: Server Configuration, Server Settings...................................85
Figure 5–19: Server Configuration, adding the project...............................86
Figure 5–20: Test Server, configuration repository.....................................86
Figure 5–21: Production and Test Environment.........................................87
Figure 5–22: Example Guess, Run on Test Server....................................87
Figure 5–23: Example Guess, Test the JSP...............................................88
Figure 5–24: Overwriting EAR file...............................................................90
Figure 5–25: WebSphere Administrative Console, update enterprise
application..............................................................................90
Figure 5–26: Example Guess, run on IBM WebSphere Application
Server....................................................................................91
Contents Page vii
Figure 6–1: General Structure..................................................................92
Figure 6–2: IBM DB2, activities overview..................................................92
Figure 6–3: IBM DB2 Installation, product selection.................................93
Figure 6–4: IBM DB2 Installation, License Agreement.............................94
Figure 6–5: IBM DB2 Installation, type of installation...............................94
Figure 6–6: IBM DB2 Installation, installation directory.............................95
Figure 6–7: IBM DB2 Installation, using windows services.......................96
Figure 6–8: IBM DB2 Installation, administration contact list....................96
Figure 6–9: IBM DB2 Installation, instance configuration.........................97
Figure 6–10: IBM DB2 Installation, DB2 tools catalog................................97
Figure 6–11: IBM DB2 Installation, health monitor notification...................98
Figure 6–12: IBM DB2 Installation, installation summary............................98
Figure 6–13: IBM DB2, First Steps.............................................................99
Figure 6–14: IBM DB2, Create Sample Database......................................99
Figure 6–15: IBM DB2, gaining access.....................................................100
Figure 7–1: IBM WebSphere Application Server, architecture...............102
Figure 7–2: Example MyVisitor, Use Case.............................................103
Figure 7–3: Process................................................................................105
Figure 7–4: Example MyVisitor, EJB: Table............................................105
Figure 7–5: Example MyVisitor, EJB: Archives.......................................105
Figure 7–6: Example MyVisitor, EJB: Create an EJB Project.................106
Figure 7–7: Example MyVisitor, EJB: Update Server Configuration.......106
Figure 7–8: Example MyVisitor, EJB: New Enterprise Bean...................107
Figure 7–9: Example MyVisitor, EJB: Create (1)....................................107
Figure 7–10: Example MyVisitor, EJB: Create (2)....................................108
Figure 7–11: Example MyVisitor, EJB: Create (3)....................................109
Figure 7–12: Example MyVisitor, EJB: Created Entries............................110
Figure 7–13: EJB Components.................................................................110
Figure 7–14: Example MyVisitor, EJB: Created Components..................111
Figure 7–15: Example MyVisitor, EJB: java and class files......................111
Figure 7–16: Example MyVisitor, EJB: Game files..................................113
Figure 7–17: Set a Relationship................................................................113
Figure 7–18: Example MyVisitor, EJB: Add Relationship.........................114
Contents Page viii
Figure 7–19: Example MyVisitor, EJB: Mapping to the
Relational Database............................................................116
Figure 7–20: Example MyVisitor, EJB: Create a backend folder..............116
Figure 7–21: Example MyVisitor, EJB: Mapping Editor............................117
Figure 7–22: Example MyVisitor, EJB: Mapping Editor (2).......................118
Figure 7–23: Example MyVisitor, EJB: Database table - XML File...........119
Figure 7–24: Example MyVisitor, EJB: Database– DDL File....................119
Figure 7–25: Database, Export DDL file...................................................120
Figure 7–26: Example MyVisitor, EJB: Starting DB2 Command Window.121
Figure 7–27: Example MyVisitor, EJB: Create a database.......................121
Figure 7–28: Created Database and tables..............................................123
Figure 7–29: Modify Test environment, add a data source.......................124
Figure 7–30: Modify Test environment, add a data source (2).................124
Figure 7–31: Modify Test environment, add a data source (3).................125
Figure 7–32: Example MyVisitor, EJB: deployment descriptor.................125
Figure 7–33: Example MyVisitor, EJB: deploy code.................................126
Figure 7–34: Example MyVisitor, EJB: deploy code (2)............................126
Figure 7–35: Guess Server Start..............................................................127
Figure 7–36: Console Guess Server.........................................................127
Figure 7–37: Run Universal Test Client....................................................128
Figure 7–38: JNDI Explorer......................................................................128
Figure 7–39: Using the Universal Test Client............................................129
Figure 7–40: EJB Visitor Test...................................................................129
Figure 7–41: Testing EJB Game...............................................................130
Figure 7–42: Sample Contents GuessDB.................................................131
Figure 7–43: Example MyVisitor, EJB: Remote and Local Home
Interface...............................................................................132
Figure 7–44: Example MyVisitor, EJB: Develop a EJB Session Bean......133
Figure 7–45: MyVisitor, Session EJB: Methods created...........................133
Figure 7–46: Example MyVisitor, Session EJB: Promote to Remote
Interface...............................................................................136
Figure 7–47: Example MyVisitor, Session EJB: Methods.........................136
Figure 7–48: Testing the EJB session bean.............................................137
Figure 7–49: Example MyVisitor, Web: Task overview.............................139
Contents Page ix
Figure 7–50: Example MyVisitor, Web: Process.......................................140
Figure 7–51: Example MyVisitor, Web: Warning......................................142
Figure 7–52: Example MyVisitor, Web: HTML Page preview...................143
Figure 7–53: Example MyVisitor, Web: Java Build Path...........................146
Figure 7–54: Example MyVisitor, Web: Run on Server............................147
Figure 7–55: MyVisitorServlet, Test Results.............................................148
Figure 7–56: JAAS Configuration, IBM WebSphere Application
Server (1).............................................................................150
Figure 7–57: JAAS Configuration, IBM WebSphere Application
Server (2).............................................................................150
Figure 7–58: Example MyVisitor deployment, JDBC Providers................151
Figure 7–59: Example MyVisitor deployment, JDBC Providers (2)...........152
Figure 7–60: Example MyVisitor deployment, configure data source.......153
Figure 7–61: Example MyVisitor deployment, configure data source (2)..154
Figure 7–62: Example MyVisitor, environment variables..........................154
Figure 7–63: Example MyVisitor, DB2 JDBC Driver Path.........................155
Figure 7–64: Example MyVisitor, update enterprise application...............156
Figure 7–65: EJB deployment...................................................................156
Figure 7–66: EJB deployment, Step 1......................................................157
Figure 7–67: EJB deployment, Step 2......................................................157
Figure 7–68: EJB deployment, Step 3......................................................157
Figure 7–69: EJB deployment, Step 4......................................................157
Figure 7–70: EJB deployment, Step 5......................................................157
Figure 7–71: EJB deployment, Step 6......................................................158
Figure 7–72: EJB deployment, Step 7......................................................158
Figure 7–73: EJB deployment, Step 8......................................................158
Figure 7–74: EJB deployment, Step 9 Summary......................................158
Figure 7–75: EA Status.............................................................................159
Figure 7–76: Use Case.............................................................................160
Figure 7–77: Process................................................................................161
Figure 7–78: adapted workflow: Guess.JSP.............................................164
Figure 7–79: Example MyVisitor, JDBC: Output.......................................165
Figure 7–80: Example MyVisitor, JDBC: DB2, Sample Contents............165
Figure 7–81: Example MyVisitor, JDBC: DB2, Sample Contents.............166
Contents Page x
Figure 8–1: Uninstallation activities........................................................168
Figure 8–2: Software window..................................................................169
Figure 8–3: Uninstall Wizard, applications to be removed......................170
Figure 8–4: Uninstalling IBM DB2 universal database............................171
Figure 9–1: Error message, services......................................................174
Figure 9–2: Local security policy setting.................................................175
Figure 9–3: Local security policy setting (2)............................................175
Figure 9–4: Automatically added code for the Web Server Plug-in,
alias.....................................................................................176
Figure 9–5: Automatically added code for the Web Server Plug-in,
Configuration directory.........................................................177
Figure 9–6: Checking IP ports, information.............................................178
Figure 9–7: Changing HTTP Server ports...............................................178
Figure 9–8: Changing HTTP Server ports (2).........................................178
Figure 9–9: Administrative Console, IP Ports.........................................179
Figure 9–10: Error message, Update Studio............................................180
Figure 9–11: Error message, Internal Server Error...................................181
Figure 9–12: Error message, Save Conflict..............................................182
Figure 11–1: Administrative Console, Home............................................190
Figure 11–2: Snoop Servlet......................................................................191
Figure 11–3: Embedded HTTP Server, HTTP Server and Plug-in...........191
Figure 11–4: IBM WebSphere Studio, Update manager..........................193
Figure 11–5: IBM WebSphere Studio, Update, features window..............194
Figure 11–6: IBM WebSphere Studio, Update Manager, current
configuration........................................................................195
Contents Page xi
Contents: Table
Table 2–1: IP ports, default settings [cp. SaHe03, 170-174]...................16
Table 4–1: Source code servlet: HelloServer.java...................................58
Table 4–2: Example HelloServer, update Plug-in (1)...............................68

Table 5–1: Style definition within the html code.......................................73
Table 5–2: Embedded style definition......................................................73
Table 5–3: Output example, style definition.............................................73
Table 5–4: Example external style sheet.................................................74
Table 5–5: Example Guess, code sample (1)..........................................79
Table 5–6: Example Guess, code sample (2) [Thi04]..............................80
Table 5–7: Adapt IP port settings............................................................85
Table 5–8: Deployment Checklist............................................................89
Table 6–1: Examples on working with DB2...........................................101
Table 7–1: Example MyVisitor, EJB: CMP Attributes............................109
Table 7–2: Example MyVisitor, EJB: Game...........................................112
Table 7–3: Excerpt VisitorBean, relationship methods..........................115
Table 7–4: Excerpt deployment descriptor source.................................115
Table 7–5: Example MyVisitor, DB........................................................122
Table 7–6: Example MyVisitor, Session EJB: Code (1).........................134
Table 7–7: Example MyVisitor, Session EJB: Code (2).........................134
Table 7–8: Example MyVisitor, Session EJB: Code (3).........................135
Table 7–9: Example MyVisitor, Session EJB: Code (4).........................135
Table 7–10: Activities for testing EJBs....................................................137
Table 7–11: Example MyVisitor, Session EJB: Code (5).........................138
Table 7–12: Example MyVisitor, Web: Output Criteria............................140
Table 7–13: Example MyVisitor, Web: HTML page.................................141
Table 7–14: Example MyVisitor, Web: HTML page source.....................142
Table 7–15: Example MyVisitor, Web: Servlet........................................144
Table 7–16: Example MyVisitor, Web: MyVisitorServlet Source Code....145
Table 7–17: MyVisitorServlet, Test Checklist..........................................148
Table 7–18: Deployment Checklist, Packing the Enterprise Application.149
Contents Page xii
Table 7–19: Modify Code MyVisitorServlet..............................................161
Table 7–20: Modify Code Guess.JSP......................................................162
Table 7–21: Modify Code Guess.JSP (2)................................................162
Table 7–22: Modify Code Guess.JSP (3)................................................163
Table 7–23: Modify Code Guess.JSP (4)................................................164
Table 9–1: Log files [cp. SaHe03, 189] [cp. IBMa02, 71-72].................173
Table 9–2: Services used......................................................................174
Table 9–3: Changing the status of a service.........................................174
Table 9–4: Additional log files [cp. IBMa02, 71-72]...............................176
Table 10–1: Default installation directories..............................................184
Table 10–2: IP ports used by IBM WebSphere Applicaiton Server.........186

degree dissertation (Diplomarbeit)






Employing a
Java based Application Server
- an introduction -

A step-by-step example developing and
employing an enterprise application using
IBM WebSphere Application Server and
IBM WebSphere Studio Application
Developer




Author: Petra Lehner
Version 1.3; July, 15
th
2004