{"id":15009065,"url":"https://github.com/nhanpham03/pc-parts-shop-java","last_synced_at":"2025-10-03T17:31:41.081Z","repository":{"id":209405274,"uuid":"723965531","full_name":"NhanPham03/pc-parts-shop-java","owner":"NhanPham03","description":"Online store built using native Java, Maven and Tomcat, uses MySQL database with EclipseLink ORM.","archived":true,"fork":false,"pushed_at":"2024-08-04T00:58:43.000Z","size":78024,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-29T16:24:01.141Z","etag":null,"topics":["apache-maven","apache-tomcat","css","eclipselink","html","java","javascript","mysql-database"],"latest_commit_sha":null,"homepage":"https://pcpartsshop.onrender.com/com.pcpartsshop/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NhanPham03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-27T05:54:37.000Z","updated_at":"2024-08-04T00:59:01.000Z","dependencies_parsed_at":"2024-05-09T06:47:08.625Z","dependency_job_id":null,"html_url":"https://github.com/NhanPham03/pc-parts-shop-java","commit_stats":null,"previous_names":["nhanpham03/pc-parts-shop","nhanpham03/pc-parts-shop-java"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NhanPham03%2Fpc-parts-shop-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NhanPham03%2Fpc-parts-shop-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NhanPham03%2Fpc-parts-shop-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NhanPham03%2Fpc-parts-shop-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NhanPham03","download_url":"https://codeload.github.com/NhanPham03/pc-parts-shop-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235165454,"owners_count":18946241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-maven","apache-tomcat","css","eclipselink","html","java","javascript","mysql-database"],"created_at":"2024-09-24T19:22:46.807Z","updated_at":"2025-10-03T17:31:33.924Z","avatar_url":"https://github.com/NhanPham03.png","language":"Java","readme":"# PC Parts Shop (Java)\n\n### This repository has been archived and will no longer be updated.\n\n[![Apache Maven](https://img.shields.io/badge/apache_maven-C71A36?style=for-the-badge\u0026logo=apachemaven\u0026logoColor=white)](https://maven.apache.org/)\n[![MySQL](https://img.shields.io/badge/MySQL-005C84?style=for-the-badge\u0026logo=mysql\u0026logoColor=white)](https://www.mysql.com/)  \n\nPC Parts Shop is a mock-up website for any computer hardware retailer.  \nThis web application uses basic Java Servlets, Java Database Connectivity and Java Persistence API.  \n\nThe entire **Apache Maven** project is made and tested on **Eclipse IDE for Enterprise Java and Web Developers** with **MySQL database**.  \nTo make sure this web application runs smoothly, it is recommended to run using the aforementioned programs.  \n\nYou can access the website on:  \n[![Render](https://img.shields.io/badge/Render-46E3B7?style=for-the-badge\u0026logo=render\u0026logoColor=white)]()\n\n## Table of Contents\n- [Notes](#notes-for-accessing-render)\n- [Prerequisites](#prerequisites)\n- [How to run (Eclipse IDE)](#how-to-run-eclipse-ide-for-enterprise-java-and-web-developers)\n    - [Install dependencies](#install-dependencies)\n    - [Setting up environment](#set-up-environment)\n- [How to run (IntelliJ IDEA)](#how-to-run-jetbrains-intellij-idea)\n    - [Install dependencies](#install-dependencies-1)\n    - [Setting up environment](#set-up-environment-1)\n- [Known problems](#known-problems)\n\n## Notes for accessing Render\n### The first time accessing this website will take a long time to load.\n\u003e PC Parts Shop is hosted on Render's Free plan, therefore resources are limited and slowed down when inactive.\n\n### When accessing the website 1-2 months AFTER it's been updated, you might encounter lots of 404 errors when browsing items.\n\u003e The service that is hosting the MySQL database has been _powered down_ as this project only serves as a college project and has no commercial use.\n\n## Prerequisites\nInstall MySQL database at: https://dev.mysql.com/downloads/installer/  \nDownload and Extract Apache Maven *(Preferred version: 3.9.5+)* from: https://maven.apache.org/download.cgi  \nDownload and Extract Apache Tomcat *(Preferred version: 8.0+)* from: https://tomcat.apache.org/  \nProject source code:  \n- To clone the repository, simply press the `Code` button and copy the link.\n- Then open the Terminal (or Windows PowerShell) at the desired location to clone this project.\n- Run `git clone https://github.com/NhanPham03/pc-parts-shop-java.git`.\n- Open the project in your preferred IDE.\n\nRecommended plugins (For *IntelliJ IDEA* users):\n- Maven Helper (Vojtěch Krása): https://plugins.jetbrains.com/plugin/7179-maven-helper  \n- Smart Tomcat (zeng kid): https://plugins.jetbrains.com/plugin/9492-smart-tomcat  \n\n# How to run (Eclipse IDE for Enterprise Java and Web Developers)\nDon't forget to check [this section](#known-problems) if you happen to run into any unexpected errors!  \n\n## Install dependencies\n### Java libraries\n**NOTE**: All .jar files are located in `src/main/webapp/WEB-INF/libs`\n1. Right click on com.pcpartsshop (root) \u003e Build Path \u003e Configure Build Path...\n2. Make sure you are seeing Java Build Path and on the Libraries tab.\n3. Select External JARs \u003e Select all .jar files \u003e Open.\n4. Apply and Close.\n\n### Create the Database\n**NOTE**: If you want to change the database name, don't forget to change it in the `persistence.xml` and `context.xml` too!\n1. Open the MySQL Command Line Client and log in to your account.\n2. Run `create database pc_parts_shop;` (Don't forget the semicolon!)\n\n## Set up environment\n### Modify persistence.xml\n**NOTE**: persistence.xml is located in `src/main/resources/META-INF`.  \n- Locate the `persistence.xml`.\n- Look for the `\u003cproperties\u003e` tag and change these values:\n    + *jakarta.persistence.jdbc.url*: jdbc:mysql://localhost:3306/pc_parts_shop\n    + *jakarta.persistence.jdbc.user*: MySQL_username (Default: root)\n    + *jakarta.persistence.jdbc.password*: MySQL_password\n\n### Set up Apache Tomcat server\n\u003e Follow the steps [here](https://www.javatpoint.com/how-to-configure-tomcat-server-in-eclipse-ide#:~:text=For%20configuring%20the%20tomcat%20server,%2D%3E%20addAll%20%2D%3E%20Finish.)!\n\n### Modify batch script\n**NOTE**: You need to *EDIT* the script, not *RUN* it!\n1. Locate `run-commands.bat` (src/main/webapp/scripts) and open the script.\n2. Change the value of `mysql_path` to the setup path of your mysql.exe .\n```\nset mysql_path=path\\to\\your\\mysql.exe\n# mysql.exe can be found at (...\\Program Files\\MySQL\\MySQL Server (Version)\\bin\\).\n```\n3. Change the values of `username` and `password` values to your respective credentials.\n```\nset username=your_username\nset password=your_password\n```\n4. Save the `.bat` script and run it.\n5. If step 4 fails, troubleshoot [here](#troubleshoot-batch-script-not-running).\n\n# How to run (JetBrains IntelliJ IDEA)\nDon't forget to check [this section](#known-problems) if you happen to run into any unexpected errors!  \n\n## Install dependencies\n### Java libraries\n**NOTE**: All .jar files are located in `src/main/webapp/WEB-INF/libs`.  \n1. Right click on pcpartsshop (root) \u003e Open Module Settings.\n2. Navigate to Global Libraries tab \u003e Add Java library \u003e Select all the .jar files.\n3. Navigate to Module tab \u003e Select Dependencies \u003e Add the Library (*Step 2*) and tick the checkbox \u003e Apply.\n\n### Create the Database\n**NOTE**: If you want to change the database name, don't forget to change it in the `persistence.xml` and `context.xml` too!\n1. Open the MySQL Command Line Client and log in to your account.\n2. Run `create database pc_parts_shop;` (Don't forget the semicolon!)\n\n## Set up environment\n### Modify persistence.xml\n**NOTE**: persistence.xml is located in `src/main/resources/META-INF`.  \n- Locate the `persistence.xml`.\n- Look for the `\u003cproperties\u003e` tag and change these values:\n    + *jakarta.persistence.jdbc.url*: jdbc:mysql://localhost:3306/pc_parts_shop\n    + *jakarta.persistence.jdbc.user*: MySQL_username (Default: root)\n    + *jakarta.persistence.jdbc.password*: MySQL_password\n\n### Set up Smart Tomcat server\n**NOTE**: If Smart Tomcat configurations are all blank, proceed past step 1.\n1. Go to `Run/Debug Configurations \u003e Add Smart Tomcat` (At this step, the Tomcat server should automatically configure itself).\n2. Tomcat Server: Extract and Select the `Apache Tomcat`'s root directory from the .zip.\n3. Catalina base: Select `C:\\Users\\\u003cYour user\u003e\\.SmartTomcat\\com.pcpartsshop\\com.pcpartsshop`.  \n4. Deployment Directory: Select `com.pcpartsshop/src/main/webapp`.  \n5. Use classpath of module: Select `com.pcpartsshop`.  \n   If you can't select classpath of module, `Right click on the project's root directory \u003e Run Maven \u003e Reimport \u003e Retry select module`.  \n6. Context path: `/pcpartsshop`.  \n\n### Modify batch script\n**NOTE**: You need to *EDIT* the script, not *RUN* it!\n1. Locate `run-commands.bat` (src/main/webapp/scripts) and open the script.\n2. Change the value of `mysql_path` to the setup path of your mysql.exe.\n```\nset mysql_path=path\\to\\your\\mysql.exe\n# mysql.exe can be found at (...\\Program Files\\MySQL\\MySQL Server (Version)\\bin\\).\n```\n3. Change the values of `username` and `password` values to your respective credentials.\n```\nset username=your_username\nset password=your_password\n```\n4. Save the `.bat` script and run it.\n5. If step 4 fails, troubleshoot [here](#troubleshoot-batch-script-not-running).\n\n# KNOWN PROBLEMS\n### Why can't the website access the database despite having correctly modified the \"persistence.xml\"?\nThis problem tends to be unique for **Eclipse IDE** users.  \n\u003e Go to `Project Explorer \u003e Servers \u003e Tomcat vX.X Server at localhost-config \u003e context.xml \u003e Open With \u003e Generic Text Editor`.  \n\u003e Change the \"url\" `HOST` (localhost or 127.0.0.1), `PORT` (Default: 3306).  \n\u003e Change the `username` and `password` values.  \n\u003e Then insert the tags below in between `\u003cContext\u003e`.  \n```\n\u003cResource name=\"jdbc/pc_parts_shop\" auth=\"Container\" driverClassName=\"com.mysql.cj.jdbc.Driver\" \nurl=\"jdbc:mysql://HOST:PORT/pc_parts_shop?autoReconnect=true\" \nusername=\"USERNAME\" password=\"PASSWORD\" \nmaxActive=\"100\" maxIdle=\"30\" maxWait=\"10000\" logAbandoned=\"true\" removeAbandoned=\"true\" removeAbandonedTimeout=\"60\" type=\"javax.sql.DataSource\" /\u003e\n```\n\n### Troubleshoot batch script not running\n\u003e Make sure you have followed all the steps provided to modify this script!  \n\u003e Run `com.pcpartsshop` on Tomcat Server, then access any Catalog page or Account information page.  \n\u003e The reason this happens is because the ORM hasn't fired up and hasn't created any tables in the database.  \n\u003e After this, open MySQL Command Line Client and run these commands to see if tables have been created or not, then run the batch script again. \n```\nuse pc_parts_shop;\n\nshow tables;\n```\n\n### If you encounter either of these errors:\norg.apache.jasper.JasperException: org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: [org.apache.taglibs.standard.tlv.JstlCoreTLV]  \norg.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.home_jsp  \n\u003e Make sure you have already added the necessary libraries located in src/main/webapp/WEB-INF/libs.  \n\u003e Locate the `pom.xml` file (src/main/webapp/WEB-INF).  \n\u003e Add `\u003cscope\u003e` tags with `provided` value to **ALL** dependencies.  \n```\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ejunit\u003c/groupId\u003e\n        \u003cartifactId\u003ejunit\u003c/artifactId\u003e\n        \u003cversion\u003e3.8.1\u003c/version\u003e\n        \u003cscope\u003eprovided\u003c/scope\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependencies\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhanpham03%2Fpc-parts-shop-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhanpham03%2Fpc-parts-shop-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhanpham03%2Fpc-parts-shop-java/lists"}