Instructions
Note : this application uses Metronic Theme v5. You must buy a license from metronic developers.
- Setup MySQL Database
Open MySQL workbench (on Windows MySQL service must be running)
Create Database named ‘sampledb.
Save database username, password, host, port you will need them to connect the application to the database later.
- Staring the Server
Copy “mysql-connector-java-8.0.19” under “locationofserver\payara201\glassfish\domains\domain1\lib”
Payara201 is the name of the folder your server is at. It could be any name.
Start Glassfish/Payara. (make sure your path environment variable is set to JDK 8.)
Go to http://localhost:4848/
Creating JDBC Connection Pool:
Got to Resources/JDBC/JDBC Connection Pools
Click <New> Button.
Fill in the fields like the followling image
Click <Next> Button.
Scroll down to Additional Properties.
Select and remove all properties and enter these ones:
Don’t forget to change user and password values.
Click Finish.
Go to Resources/JDBC/JDBC Resources
Enter JNDI Name and pool name:
Click OK
Setting up Security Realm:
Go to Configurations/server-config/Security/Realms
Click New
Enter:
Name: QTubeRealm
JAAS Context: jdbcRealm
JNDI: jdbc/qtube
User Table: sampledb.user
User Name Column: EMAIL
Password Column: PASSWORD
Group Table: sampledb.user_group_join
Group Table User Name Column: USER_ID
Group Name Column: GROUP_ID
Digest Algorithm: SHA-256
Click Save
Restart your server.
Running the application for the first time:
Deploy the project:
Run the application using your IDE, in intellij:
The first time you deploy the application it will create database tables and populate them with data.
Afterwards, you should remove this line from src/main/resources/META-INF/persistence.xml
<property name="javax.persistence.sql-load-script-source"
value="META-INF/data.sql" />
Package the project in .war file:
mvn package
the .war file will be located under ‘target’ folder.
And that’s is for setting up the application for the first time.