Testing the 'Java Web Programming 2' final source on Windows 11
Install Java
https://www.oracle.com/java/technologies/downloads
Run the JDK Installer.
You can complete the installation simply by clicking the Next button.
The installed JDK directory is C:\Program Files\Java\jdk-21.
Create the JAVA_HOME environment variable as follows:
Open Start System Advanced System Settings Environment Variables(N)... Under the "User variables for someson" section, click the New button. Type JAVA_HOME in the "Variable name" setting. Type C:\Program Files\Java\jdk-21 in the "Variable values" setting. Click the OK button. Click the OK button.
Install Maven
https://maven.apache.org/download.cgi
Download and unzip the latest binary version, copy the created directory to the location you want, and add Maven's bin directory to the Path of the system variable.
Install Git
https://git-scm.com/downloads
Download 64-bit Git for Windows Setup.
You can complete the installation simply by clicking the Next button.
Add your name and email to your git config.
C:\ Command Promptgit config --global user.name "Jo Maso" git config --global user.email jo@gmail.org
Verify.
C:\ Command Promptgit config --global --list
Install Oracle Database 11gR2 Express Edition
https://www.oracle.com/database/technologies/xe-prior-release-downloads.html
If you have a 64-bit Windows system -- most systems are 64-bit systems -- download Oracle Database 11gR2 Express Edition for Windows x64. You need an account on the Oracle website to download this version. After registering as a member and logging in, the download will start.
After unpacking the downloaded compressed file, run setup.exe in the Disk1 subdirectory created and click the Next button to install it. You can install Oracle easily since Oracle 11g version officially supports Windows 10. Do not forget the administrator password you entered during the installation.
Since Oracle Application Express, one of the 11g XE components, uses port 8080, stop Tomcat if it is in service before installation.
For Windows, the default port of Oracle Application Express, 8080, cannot be changed during installation. After installation, the method to change the 8080 port of Apex to 9090 is as follows:
C:\ Command PromptC:\Users> sqlplus Enter user-name: system Enter password: Connected. SQL> Exec DBMS_XDB.SETHTTPPORT(9090); PL/SQL procedure successfully completed. SQL>
Install Tomcat 10.1.xx
https://tomcat.apache.org/download-10.cgi
Download 64-bit Windows zip of the 10.1.xx version.
Unpack the downloaded file, copy the created directory to the location you want.
Tomcat start: run startup.bat of the bin folder.
Tomcat stop: run shutdown.bat of the bin folder.
Test
Clone the Java Web Programming 2 final source.
git clone https://github.com/kimjonghoon/JavaWebProgramming2
Move the created JavaWebProgramming2 folder to the C:\. (C:\JavaWebProgramming2)
Edit the upload directory
Open the WebContants.java file in the net.java_school.commons package and modify the upload directory to match your system.
Edit the log file path
Open the log4j2.xml file in the src/main/resources folder and modify the log file path to match your system.
Oracle database schema
sqlplus sys as sysdba Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO java IDENTIFIED BY school; conn java/school Connected. create table member ( email varchar2(60) PRIMARY KEY, passwd varchar2(200) NOT NULL, name varchar2(20) NOT NULL, mobile varchar2(20) ); create table board ( boardcd varchar2(20), boardnm varchar2(40) NOT NULL, boardnm_ko varchar2(40), constraint PK_BOARD PRIMARY KEY(boardcd) ); create table article ( articleno number, boardcd varchar2(20), title varchar2(200) NOT NULL, content clob NOT NULL, email varchar2(60), hit number, regdate date, constraint PK_ARTICLE PRIMARY KEY(articleno), constraint FK_ARTICLE FOREIGN KEY(boardcd) REFERENCES board(boardcd) ); create sequence SEQ_ARTICLE increment by 1 start with 1; create table comments ( commentno number, articleno number, email varchar2(60), memo varchar2(4000) NOT NULL, regdate date, constraint PK_COMMENTS PRIMARY KEY(commentno) ); create sequence SEQ_COMMENTS increment by 1 start with 1; create table attachfile ( attachfileno number, filename varchar2(50) NOT NULL, filetype varchar2(30), filesize number, articleno number, email varchar2(60), constraint PK_ATTACHFILE PRIMARY KEY(attachfileno) ); create sequence SEQ_ATTACHFILE increment by 1 start with 1; create table authorities ( email varchar2(60) NOT NULL, authority varchar2(20) NOT NULL, constraint fk_authorities FOREIGN KEY(email) REFERENCES member(email) ); CREATE UNIQUE INDEX ix_authorities ON authorities(email, authority); create table views ( no number, articleNo number, ip varchar(60), yearMonthDayHour char(10), constraint PK_VIEWS PRIMARY KEY(no), constraint UNIQUE_VIEWS UNIQUE(articleNo, ip, yearMonthDayHour) ); create sequence SEQ_VIEWS increment by 1 start with 1; -- for test records insert into board values ('chat', 'Chat', '자유게시판'); commit;
Create ROOT.xml
C:\JavaWebProgramming2 is the progject's root directory.
Create ROOT.xml as shown below and copy it to the conf/Catalina/localhost folder of Tomcat.
(Create this folder if it doesn't exist)
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="C:/JavaWebProgramming2/src/main/webapp" reloadable="true"> </Context>
Compile.
C:\ Command Promptmvn clean compile war:inplace
Restart Tomcat.
Visit http://localhost:8080 to sign up and test the bulletin board.
Test Admin mode
Grant the admin role to a registered someone.
C:\ Command Promptsqlplus java/school insert into authorities values ('User Email','ROLE_ADMIN'); commit; exit;
Log in as a member with an administrator role and check if the administrator menu is visible.
Test in Jetty
Stop Tomcat and run the following.
C:\ Command Promptmvn clean jetty:run