20 KiB
| sidebar_position | title | description |
|---|---|---|
| 1 | Environment Setup Guide (TrizStock) | Complete guide to setting up the TrizStock development environment from scratch. |
Before You Start
Make sure you have the following before proceeding:
- Local administrator rights on your machine (required for most installations below)
- Access to our Gitea instance.
- Your Gitea account credentials (request from your team lead if you don't have one yet)
- The application database credentials (request from your team lead — these are never stored in any repository)
Overview of the Stack
| Component | Version | Purpose |
|---|---|---|
| Java SE (JDK) | 8 | Runtime and compiler |
| Apache Maven | Any recent | Dependency management and build |
| Apache Tomcat | 9 | Java EE application server |
| Microsoft SQL Server | 2012 | Database engine |
| SQL Server Management Studio | Any recent | Database GUI client |
| NetBeans IDE | 17 | Development environment |
Step 1 — Install Java SE Development Kit (JDK) 8
- Download JDK 8 from:
- Gitea release assets
- Oracle's official archive if you have an account
- Run the installer and complete the installation. Note the installation path (e.g.,
C:\Program Files\Java\jdk1.8.0_xxx). - Set the
JAVA_HOMEenvironment variable:- Open Start → Search → "Edit the system environment variables"
- Click Environment Variables
- Under System variables, click New:
- Variable name:
JAVA_HOME - Variable value:
C:\Program Files\Java\jdk1.8.0_xxx(your actual JDK path)
- Variable name:
- Find the
Pathvariable under System variables → click Edit → New, and add:%JAVA_HOME%\bin - Click OK on all dialogs.
- Open a new terminal window and verify:
java -version
javac -version
Both must return 1.8.x. If javac is not found, JAVA_HOME or PATH was not set correctly.
Step 2 — Install Apache Maven
- Download Maven from: (Download the binary zip archive)
- Extract it to a stable path with no spaces (e.g.,
C:\dev\maven). - Set environment variables:
- Create a new system variable:
- Variable name:
MAVEN_HOME - Variable value:
C:\dev\maven(your extraction path)
- Variable name:
- Add
%MAVEN_HOME%\binto thePathsystem variable (same way as Step 1).
- Create a new system variable:
- Open a new terminal and verify:
mvn -version
It should display the Maven version and confirm it is using your JDK 8.
Step 3 — Configure Maven for the Private Gitea Registry
The TrizStock project has several legacy dependencies that are not available on Maven Central. They are hosted on the team's private Maven registry in Gitea. Without this configuration, your build will fail to resolve those dependencies.
- Navigate to the Maven user settings file. If it does not exist, create it:
C:\Users\YOUR_WINDOWS_USERNAME\.m2\settings.xml
- Download the
settings.xml.templatefrom the team resources repository. - Copy the template content into your
settings.xmland replace the placeholders with your actual Gitea credentials:
<settings>
<servers>
<server>
<id>gitea</id>
<username>othmane</username>
<password>54465f0ce0fec1a357eb7d9f7055e3df873db114</password>
</server>
</servers>
</settings>
Verify the registry is accessible by running the following in a terminal (once you have the project cloned — see Step 7):
mvn dependency:resolve
All dependencies, including the legacy ones, should resolve without errors.
Step 4 — Install Apache Tomcat 9
- Download Tomcat 9 (zip distribution — do not use the Windows installer):
- Extract it to a stable path with no spaces (e.g.,
C:\dev\tomcat9). - Do not add Tomcat to your system PATH. NetBeans will manage it directly and only needs to know the directory.
📝 Note — Tomcat is not installed as a Windows service in this setup.
Using the zip distribution means Tomcat is managed entirely by NetBeans during development — it starts and stops automatically when you run or stop your project from the IDE. It does not run in the background, does not appear in
services.msc, and does not start with Windows. This is intentional for a development environment.If you ever need to run Tomcat outside of NetBeans (e.g., for a manual deployment or testing), you can start it directly by running
C:\dev\tomcat9\bin\startup.batfrom a terminal, and stop it withshutdown.bat. You can also register it as a Windows service separately if needed — ask your team lead.
Step 5 — Install Microsoft SQL Server 2012 and SSMS
5.1 — Install SQL Server 2012
- Obtain the SQL Server 2012 installer (
SQLEXPR_x64_ENU.exe) from: - Run the installer and choose New SQL Server stand-alone installation.
- On the "Database Engine Configuration" screen, under Authentication Mode, select Mixed Mode (SQL Server Authentication and Windows Authentication).
- Set the SA account password when prompted. Use the team standard password:
Root123456. - Complete the installation.
5.2 — Enable TCP/IP and Port 1433
SQL Server disables TCP/IP by default on fresh installations. The application needs it to connect.
- Open SQL Server Configuration Manager (search for it in the Start menu).
- Expand SQL Server Network Configuration → Protocols for MSSQLSERVER.
- Right-click TCP/IP → Enable.
- Double-click TCP/IP → go to the IP Addresses tab → scroll to IPAll → set TCP Port to
1433. - Click OK.
5.3 — Enable the SQL Server Browser Service
- In SQL Server Configuration Manager, go to SQL Server Services.
- Right-click SQL Server Browser → Properties → Service tab → set Start Mode to Automatic.
- Right-click SQL Server Browser → Start.
5.4 — Restart the SQL Server Service
- In SQL Server Services, right-click SQL Server (MSSQLSERVER) → Restart.
5.5 — Configure the Windows Firewall
- Open Windows Defender Firewall with Advanced Security (search in Start menu).
- Click Inbound Rules → New Rule.
- Select Port → TCP → Specific local ports:
1433. - Select Allow the connection.
- Apply to all profiles (Domain, Private, Public).
- Name the rule
SQL Server 1433and click Finish.
5.6 — Create the Application Database Login
- Install SQL Server Management Studio (SSMS). Download from Microsoft.
- Open SSMS and connect to your local instance:
- Server name:
localhost - Authentication: SQL Server Authentication
- Login:
sa - Password:
Root123456
- Server name:
📝 Note — Check your
database.propertiesbefore proceeding.Open your
database.propertiesfile and check the value ofdb.username.
- If it is
sa, skip steps 3–9 entirely. Thesaaccount already exists and was configured with the correct password (Root123456) during installation. No new login needs to be created.- If it is any other username, continue with steps 3–9 below to create that login.
- In Object Explorer, expand Security → Logins.
- Right-click Logins → New Login.
- Set the login name and password to match what is in
database.properties(provided by your team lead). - On the General page, make sure Login status at the bottom is set to Enabled (this is the default, but confirm it is not set to Disabled).
- On the Status page, under Login, confirm it is set to Enabled and under Permission to connect to database engine, confirm it is set to Grant.
- On the Server Roles page, check
dbcreatorandpublic. - Click OK.
Step 6 — Restore the Test Database
- Download the Stock project test database backup file from the Gitea release assets.
- Open SSMS and connect to your local SQL Server instance.
- In Object Explorer, right-click Databases → Restore Database…
- Select Device as the source, click … (Browse), then click Add and navigate to the downloaded
.bakfile. Click OK. - The backup details will populate in the Backup sets to restore grid. Confirm the correct entry is checked.
- Click OK to restore. A success dialog will appear when complete.
- In Object Explorer, right-click Databases → Refresh. The
TrizStockLifedatabase should now appear. - Verify the application login created in Step 5.6 has access:
- Expand TrizStockLife → Security → Users
- If your application login is not listed, right-click Users → New User, and map the login to this database with the
db_ownerrole.
Step 7 — Install and Configure Git
7.1 — Install Git
- Install Git if not already installed. Download from here.
- Run the installer. When prompted for the default editor, choose whichever you are comfortable with (Notepad is fine for occasional use).
- On the "Adjusting your PATH environment" screen, select "Git from the command line and also from 3rd-party software" — this makes Git available in CMD, PowerShell, and Cygwin.
- Complete the rest of the installation with default settings.
- Verify the installation by opening a new terminal and running:
git --version
7.2 — Configure Your Identity
Git requires a name and email to be set before you can make any commit. These are embedded in every commit you create and must match your Gitea identity.
git config --global user.name "Your Full Name"
git config --global user.email "your.email@company.com"
Use the same email address as your Gitea account.
7.3 — Configure Line Endings
This is a critical setting for the team. Incorrect line ending configuration causes unnecessary diffs, pollutes commit history, and can break file parsing on the server side.
Run the following commands exactly as written:
git config --global core.autocrlf false
git config --global core.eol lf
| Setting | Value | Reason |
|---|---|---|
core.autocrlf |
false |
Disables automatic line ending conversion. Git will not touch line endings on checkout or commit. |
core.eol |
lf |
Enforces LF (\n) as the line ending for all files in the working tree, consistent with the server and Linux environments. |
⚠️ Do not skip this step. If
autocrlfis left at its Windows default oftrue, Git will silently convert all line endings to CRLF on checkout and back to LF on commit. This causes every file to appear modified on Windows even when no real changes were made.
7.4 — Configure Default Branch Name
The team uses master as the default branch name. Set this to avoid a mismatch when creating new local branches:
git config --global init.defaultBranch master
7.5 — Verify Your Configuration
Run the following to confirm all settings were applied correctly:
git config --global --list
You should see at minimum:
user.name=Your Full Name
user.email=your.email@company.com
core.autocrlf=false
core.eol=lf
init.defaultbranch=master
Step 8 — Clone the Project Repository
- Open a terminal and clone the Stock repository:
git clone http://145.239.66.197:3000/TrizTech/TrizStockRepository.git
- When prompted, enter your Gitea username and password (or token if your Gitea instance requires it).
- Navigate into the project folder:
cd TrizStockRepository
Step 9 — Configure database.properties
The database.properties file contains the local database connection settings. It is never stored in the repository for security reasons. You need to create it manually.
- Download the template from the team resources repository.
- Copy the template into the correct location inside your local repository:
\src\main\resources\database.properties
- Open the file in any text editor and fill in your local values:
db.host=localhost
db.port=1433
db.name=TrizStockLife
db.username=YOUR_DB_USERNAME
db.password=YOUR_DB_PASSWORD
- Verify that
database.propertiesis listed in the project's.gitignore:
# In the project root, open .gitignore and confirm this line exists:
database.properties
If it is not there, add it. Never commit this file.
Step 10 — Install and Configure NetBeans 17
10.1 — Install NetBeans
- Download NetBeans 17 from:
- Run the installer and complete the installation with default settings.
10.2 — Register JDK 8
NetBeans may detect a newer JDK if you have one installed. Ensure it is using JDK 8 for this project.
- Open NetBeans → Tools → Java Platforms.
- Check that JDK 1.8 is listed. If not, click Add Platform, select Java Standard Edition, and navigate to your JDK 8 installation directory (your
JAVA_HOMEpath). - Click Finish, then Close.
10.3 — Register Tomcat 9
- Go to Tools → Servers → Add Server.
- Select Apache Tomcat or TomEE and click Next.
- Set the Server Location to your Tomcat 9 directory (e.g.,
C:\dev\tomcat9). - Set a username and password for the Tomcat manager (you can use any values for local development, e.g.,
admin/admin). - Click Finish.
10.4 — Configure Maven in NetBeans
- Go to Tools → Options → Java → Maven.
- Under Maven Home, click Browse and point it to your Maven installation directory (
C:\dev\maven). Do not use the "Bundled" option. - Click OK.
10.5 — Open the Project
- Go to File → Open Project.
- Navigate to your cloned
stockfolder and select it. NetBeans will recognize it as a Maven project. - Click Open Project.
Step 11 — Build and Verify
This final step confirms that your entire environment is wired up correctly.
11.1 — Build the Project
- In NetBeans, right-click the Stock project in the Projects panel.
- Select Clean and Build.
- Monitor the Output panel at the bottom. The build must end with:
BUILD SUCCESS
If you see BUILD FAILURE with dependency errors, revisit Step 3 (Maven settings.xml and Gitea registry).
11.2 — Deploy and Run
- Right-click the project → Run.
- NetBeans will deploy the application to your local Tomcat 9 instance and open it in the browser.
- The application should load without any database connection errors.
11.3 — Verify Database Connectivity
- Log in to the application using the test credentials (ask your team lead for the default test user).
- Navigate to any section that loads data from the database (e.g., the stock listing page).
- If data loads correctly, your environment is fully operational.
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
java -version shows wrong version or not found |
JAVA_HOME or PATH not set correctly |
Revisit Step 1, open a new terminal after changes |
javac not found |
JRE installed instead of JDK | Reinstall using the JDK download |
mvn -version not found |
mvn -version not found |
Revisit Step 2 |
| Maven build fails with dependency not found | settings.xml not configured or wrong credentials |
Revisit Step 3 |
| Cannot connect to SQL Server from SSMS | TCP/IP disabled or port 1433 blocked | Revisit Steps 5.2 and 5.5 |
| Application fails to connect to DB at runtime | Wrong credentials in database.properties, or TCP/IP not enabled |
Revisit Steps 5.2 and 9 |
database.properties not found at runtime |
File placed in wrong directory | Confirm the file is at \src\main\resources\database.properties |
| Tomcat not found in NetBeans | Server not registered | Revisit Step 10.3 |
| NetBeans using wrong JDK | JDK 8 not registered as a Java Platform | Revisit Step 10.2 |
| Build succeeds but app doesn't start | Tomcat configuration issue | Check the NetBeans Output panel for the full stack trace |
Reference Links
| Resource | URL |
|---|---|
| Team Resources Repository | LINK |
| Stock Project Repository | LINK |
| Stock Database Release Assets | LINK |
| Gitea Maven Registry | LINK |
database.properties Template |
LINK |
settings.xml Template |
LINK |