J2EE-Application Server (inkl windows-8) Installation-Guide F:\_Daten\Hochschule Zurich\Web-Technologie\ApplicationServerSetUp.docx Last Update: 19.3.2014, Walter Rothlin Seite 1
Table of Contents Java Setup... 4 Download JDK (Java Development Kit)... 4 Install JDK... 4 Glassfish Server Setup... 5 Download Glassfish... 5 Install Glassfish... 5 Eclipse for JEE Developers Setup... 5 Download Eclipse... 5 Setup Eclipse... 5 Install JDK in Eclipse... 6 Add Glassfish Tools for Eclipse... 7 Setup Glassfish with Eclipse... 7 Start Glassfish Admin Console... 10 Create first Servlet, deploy and run it... 11 Automated publishing when source has been saved... 13 Visual C++ 2013 runtime... 14 MySql... 15 Download and Install MySql... 16 Create local User in MySQL Workbench... 24 Give a Remote Computer access to MySQL... 27 Download mysql JDBC driver... 28 Download and Install MySql Eclipse Plugin... 29 Seite 2 Toad extension... 29 DBeaver... 31 Basic MySql commands... 37 DB Connection über JNDI auf dem Application Server einrichten... 38 Insalling XAMPP instead of MySql... 40 CS IDesktop Setup... 45 AppDevs Rechte anfordern... 45 Kepler Rechte Anfordern... 46 Eclipse Kepler aufsetzen... 48 Windows-8... 50 Installation of Windows-8... 50 Classic Start-up Menu for Windows-8... 50
Office installation... 50 Other installations... 50 Common Help... 51 Finden der aktuelle IP eines Computers... 51 Helpfull Links... 51 Seite 3
Java Setup Download JDK (Java Development Kit) Download the latest 32-bit JDK from http://www.oracle.com/technetwork/java/javase/downloads/. (January 2015: version 8u31) Accept their License Agreement after carefully reading it by selecting the left radio-button. Choose the Windows x86 version from the List and download it. JDK has to be 32-bit (x86) even on a 64-bit operating system. Install JDK Run the previously downloaded file and follow the instructions. The JDK includes the JRE so you have to specify both installation paths. Both of them shouldn t be changed so they re installed to C:\Program Files (x86)\java. Seite 4
Glassfish Server Setup Download Glassfish Download the latest Full Platform Server from https://glassfish.java.net/download.html. (January 2015: version 4.1) Install Glassfish Extract the compressed zip-file to C:\glassfish. Further Steps to Setup the Glassfish Server will be taken after eclipse is installed (next chapter). Eclipse for JEE Developers Setup Download Eclipse Download the latest 32-bit version of Eclipse for JEE from https://www.eclipse.org/downloads/. (January 2015: version 4.4.1 Luna) Setup Eclipse Extract the previously downloaded zip-file to C:\eclipse. When it s done extracting, run eclipse.exe from the new folder and select your workspace which should be somewhere in your documents folder. Optionally you can create a shortcut on your desktop for faster access. Seite 5
Install JDK in Eclipse In Eclipse, navigate to Windows > Preferences and go to the menu Java > Installed JREs. On the right, click on Add... and navigate to the JDK installation directory. (jdk has to be there not just the JRE!!!) After that, delete the JRE entry and mark the new JDK entry. Seite 6
Add Glassfish Tools for Eclipse Navigate to Help > Eclipse Marketplace. Search for glassfish and install the corresponding package. After that, restart Eclipse. Setup Glassfish with Eclipse First of all, change your view in the top right corner to Java EE. Then click on the Servers-tab which should be at the bottom area. Afterwards click on the blue underlined text to setup a new one. Seite 7
Select Glassfish 4.0 and click on Next >. The JDK should be set to Eclipse Default and the Glassfish Server Directory should point to the installation. Then click on next. Seite 8
The Domain Directory should point to C:\glassfish\glassfish\domains\domain1 Administrator Id should be set to admin and the Password should be left blank. Click on Finish. Seite 9
Start Glassfish Admin Console Right click the server and start it. Then you have to allow the access of the Server when you are prompted. After that right click on Glassfish Select Glassfish View Admin Console and then (after a while) you will see picture above. Seite 10
Create first Servlet, deploy and run it Right click in Project section of eclipse right click new Dynamic Web Project Seite 11
Create Servlet: Right click on the project and new Servlet or if Servlet not listed go to new Other. Seite 12
Automated publishing when source has been saved Select Double click First Servlet Add the following code into the Project: /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype("text/html"); response.getwriter().print("hallo Student from HWZ (doget)"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException { response.setcontenttype("text/html"); response.getwriter().print("hallo Student from HWZ (dopost)"); } Seite 13
Visual C++ 2013 Runtime http://www.microsoft.com/de-ch/download/details.aspx?id=40784 In order to use the MySQL Workbench which will be installed in the next step, the Microsoft Visual C++ 2013 Runtime is required. Select the 32 bit (x86) file and download it by clicking next. After the download execute it. Seite 14
MySql http://www.youtube.com/watch?v=rnq8ds05pwq http://www.youtube.com/watch?v=4ochg9--imm Seite 15
Download and Install MySql http://dev.mysql.com/downloads/mysql/ Oracle: walter@rothlin.com (8ZUqdn007) Seite 16
mysql-installer-community-5.6.22.0.msi Start installation Seite 17
Fix if Developer Default doesn t work: Choose Custom and select the components manually. The specific components are in the second picture below. Seite 18
They are not needed. It means you don t have to take any actions. Seite 19
Seite 20
Seite 21 admin
Seite 22
Seite 23
Create local User in MySQL Workbench Start MySQL Workbench Goto User and Privileges Seite 24
Add Entry -> % (any Schema) -> OK -> Select all Seite 25
Test MySQL Start-Menu MySQL MySQL Server 5.5 MySql Command Line Client Password: admin List all defined DBs (show databases;) Seite 26
Give a Remote Computer access to MySQL Um einem anderen Computer die Berechtigung zu geben auf eine MySql DB zuzugreifen, starten Sie My SQL Workbench: 1. Add Account 2. Add IP Adresse des Remote-Host, welcher auf die DB zugreifen möchte. Gebe diesem Account die nötigen Rechte: Seite 27
Download mysql JDBC driver https://downloads.mariadb.com/files/mysql-connector-java-5.1 download it extract it. Then move the connector (mysql-connector-java-*.*.*-bin.jar) to: C:\glassfish4\glassfish\lib Otherwise it won t work. Seite 28
Download and Install MySql Eclipse Plugin Toad extension Seite 29
Seite 30 admin
DBeaver Restart Eclipse (you will be asked for) Switch to Database Developer Perspective Seite 31
Right Mouse-Click on Database Connections Seite 32
Seite 33
Select the MySQL JDBC Driver with the matching System Version (January 2015: 5.1) and select the «Jar List»-Tab. Seite 34
Remove the current Jar in the list and click on «Add JAR/Zip». Then navigate to the installation directory of the glassfish-server and select the driver in the directory «/glassfish/lib». Click on «Open» and «OK». Seite 35
Seite 36 admin
Basic MySql commands Start MySql Command Line Client to find out which DB are already defined show databases; use test; show tabels; create table Classmates ( id int PRIMARY KEY NOT NULL, fname varchar(25), lname varch,ar(25) ); CREATE UNIQUE INDEX PRIMARY ON classmates(id); INSERT INTO classmates (id, lname, fname) VALUES (1,'David','Etter'); Seite 37
DB Connection über JNDI auf dem Application Server einrichten Glassfish Admin-Console starten und unter Resourcen JDBC JDBC ConnectionPools einen neuen Pool anlegen. Hier wird unter einem Namen eine DB Connection String abgespeichert! Nicht als ein einziger String, sondern als einzelne Felder!) Nach next müssen folgende Properties gesetzt werden: (Anhand der DB Perspective) User admin Password admin Database onlineshop Url jdbc:mysql://localhost:3306/onlineshop URL jdbc:mysql://localhost:3306/onlineshop Abspeichern und mit Ping austesten Seite 38
Neue JNDI Resource definieren, welche auf diese DB-Connection verweist: JDBC Resources New. Seite 39
Common Help Finden der aktuelle IP eines Computers cmd ipconfig (Beispiel unten: Computer ist über Ethernet und WiFi connected, desshalb 2 IP- Adressen) Helpfull Links http://www.youtube.com/watch?v=9kf5m7bmu74 Part 1 (Installation) http://www.youtube.com/watch?v=ppgqtoehm-g Part 2 (Servlet calling EJB, JSP, timer-ejb) http://www.youtube.com/watch?v=culyhkqt0v0 Part 3 (JPA) http://www.http://www.youtube.com/watch?v=1epupqlkwme Part 4 (Facelets / JSF 2) http://www.youtube.com/watch?v=on557289gza Part 5 youtube.com/watch?v=abjlr9hor50 DB Connection, JPA, EJB, Web-Services Langes vollständiges Beispiel von JSP, Servlet, https://netbeans.org/downloads/ Seite 51