A simple Jakarta 10 MVC project using Jakarta Faces 4.0, Primefaces 12 and Jakarta Persistence 3.1.
Before getting started with the project, make sure you have the following prerequisites installed on your system:
-
Choose one of the following options to download and install JDK 17:
- Download NetBeans 18 from here.
- Download Payara 6.2023.6 from here.
- Download and install MySQL 8 from here.
Follow the steps below to install and set up the required components:
- Unzip the downloaded JDK to a desired location on your system.
-
Install MySQL using the downloaded installer.
-
Create the database and user to manage it. Execute the following SQL statements in your MySQL client:
CREATE DATABASE jakarta; CREATE USER 'jakarta'@'localhost' IDENTIFIED BY 'Jakarta@1!'; GRANT ALL PRIVILEGES ON jakarta.* TO 'jakarta'@'localhost'; FLUSH PRIVILEGES;
BEWARE AS OF 10/14/2025 THIS PROJECT INCLUDES MYSQL ON POM AND DEFINES RESOURCES IN DATASOURCECONFIG.JAVA MEANING THAT ALL STEPS RELATED TO CONFIGURING PAYARA ARE NO LONGER NECESSARY.
-
Unzip the downloaded Payara package.
-
Navigate to
payara/glassfish/domains/domain1folder and paste the MySQL Connector there. Also, paste it inside the "lib" folder. So, there should be one inpayara6/glassfish/domains/domain1/liband another inpayara6/glassfish/domains/domain1directory. -
Open a command prompt or terminal and navigate to
payara6/bindirectory. -
Run the
asadmin.bat(orasadmin.shfor Linux/Mac) file. -
Once in the
asadminconsole, type the following command and press Enter to start the domain:start-domain
-
Open your web browser and go to
http://localhost:4848. It will open the Payara admin console. -
In the admin console, navigate to Resources -> JDBC -> JDBC Connection Pools.
-
Click on New... to create a new JDBC connection pool.
-
Fill in the following details:
- Pool Name: MySQLPool
- Resource Type: javax.sql.DataSource
- Database Driver Vendor: MySQL
-
Click Next and scroll down to Additional Properties.
-
Add the following properties (or modify as needed):
- password: Jakarta@1!
- databaseName: jakarta
- serverName: localhost
- user: jakarta
- portNumber: 3306
- UseSSL: false
- allowPublicKeyRetrieval: true
-
Click Finish to create the JDBC connection pool.
-
Ping the resource pool to ensure it's working properly.
-
Next, add a JDBC resource using the pool you just created:
- JDNI Name: jdbc/MySQL
- Pool Name: MySQLPool
-
Click OK to save the JDBC resource.
-
Finally, go back to the
asadminconsole and type the following command to stop the domain:stop-domain
-
Follow the installation instructions for NetBeans 18, using the downloaded JDK as its default.
-
Once NetBeans is installed, open it and go to the Tools menu.
-
Select Servers from the menu.
-
In the Servers window, click on Add Server.
-
Choose Payara Server, browse to the location where you unzipped the Payara server, or download one directly via netbeans and click Next.
-
Leave the domain location unchanged and click Finish to add the Payara server.
Once all the above steps are completed, you can open your project in NetBeans. Make sure there are no issues related to the Java Platform. You should now be able to run your project, and NetBeans will handle deploying the application to the Payara server.
The web application should be available at http://localhost:8080/Jakarta10/index.xhtml.