J2EE-Application
Server
(inkl windows-8)
Installation-Guide
F:\_Daten\Hochschule Zurich\Web-Technologie\ApplicationServerSetUp.docx
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
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
Office installation ... 50
Other installations ... 50
Common Help ... 51
Finden der aktuelle IP eines Computers ... 51
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
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/.
Install JDK in Eclipse
In Eclipse, navigate toWindows > Preferencesand go to the menuJava > Installed JREs.
On the right, click onAdd... and navigate to the JDK installation directory. (jdk has to be there not just the JRE!!!)
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.
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.
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
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.
Create first Servlet, deploy and run it
Create Servlet:
Automated publishing when source has been saved
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)");
}
Double click
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.
MySql
http://www.youtube.com/watch?v=Rnq8DS05PwQ http://www.youtube.com/watch?v=4oChG9--iMM
Download and Install MySql
http://dev.mysql.com/downloads/mysql/mysql-installer-community-5.6.22.0.msi Start installation
Fix if “Developer Default” doesn’t work:
Choose “Custom” and select the components manually. The specific components are in the second picture below.
Create local User in MySQL Workbench
Start MySQL Workbench Goto User and Privileges
Test MySQL
Start-Menu à MySQL à MySQL Server 5.5 àMySql Command Line Client
Password: admin
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.
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
Download and Install MySql Eclipse Plugin
Toad extensionDBeaver
Select the MySQL JDBC Driver with the matching System Version (January 2015: 5.1) and select the «Jar List»-Tab.
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».
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');
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
Neue JNDI Resource definieren, welche auf diese DB-Connection verweist: JDBC Resources à New….
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 Langes vollständiges Beispiel von JSP, Servlet, DB Connection, JPA, EJB, Web-Services