# TOMCAT 10.1.48 DEPLOYMENT STEPS
## PREREQUISITES
1. Tomcat 10.1.48 installed at /opt/tomcat
2. JDK 17 or higher installed on the server
3. Generated DL.war file in target directory
## DEPLOYMENT STEPS
### 1. Prepare Deployment File
The DL.war file has been successfully created and is ready for deployment.
### 2. Upload WAR File to Server
```bash
# From Windows using WinSCP or FileZilla:
# - Connect to your server
# - Upload d:\java\project\web(8)\web\target\DL.war to /opt/tomcat/webapps/
# Or from command line using scp (open Command Prompt as Administrator):
scp "d:\java\project\web(8)\web\target\DL.war" user@your-server:/opt/tomcat/webapps/
```
### 3. Set Permissions on Server
Connect to your server via SSH and run:
```bash
cd /opt/tomcat
sudo chown -R tomcat:tomcat webapps/
sudo chmod -R 755 webapps/
```
### 4. Configure Tomcat (Recommended)
```bash
# Edit context.xml to prevent resource locking issues
sudo nano /opt/tomcat/conf/context.xml
# Add antiResourceLocking and antiJARLocking attributes to Context element
# Save and exit (Ctrl+O, Enter, Ctrl+X)
# Create setenv.sh for memory optimization
sudo nano /opt/tomcat/bin/setenv.sh
# Add these lines:
#!/bin/bash
JAVA_OPTS="-Xms512m -Xmx1024m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m"
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.lang=ALL-UNNAMED"
# Save and exit
# Make it executable
sudo chmod +x /opt/tomcat/bin/setenv.sh
```
### 5. Restart Tomcat
```bash
cd /opt/tomcat/bin
# Stop Tomcat
sudo ./shutdown.sh
# Wait for Tomcat to stop completely
sleep 30
# Start Tomcat
sudo ./startup.sh
```
### 6. Verify Deployment
```bash
# Monitor Tomcat logs
tail -f /opt/tomcat/logs/catalina.out
# Access the application in a browser
# http://your-server-ip:8080/DL
# http://your-server-ip:8080/DL/loginmm.html (for login page)
```
## TROUBLESHOOTING
1. **Application not accessible**:
- Check if Tomcat is running: `ps aux | grep tomcat`
- Verify WAR file was deployed: `ls -la /opt/tomcat/webapps/`
- Look for errors in logs: `cat /opt/tomcat/logs/catalina.out`
2. **Database connection issues**:
- Ensure database server is reachable from Tomcat server
- Verify database credentials in application.yaml
3. **Port conflicts**:
- If port 8080 is in use, change it in server.xml:
`sudo nano /opt/tomcat/conf/server.xml`
Find and modify: `