You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
2.9 KiB
118 lines
2.9 KiB
# 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
|
|
<Context antiResourceLocking="true" antiJARLocking="true">
|
|
<!-- keep existing configuration -->
|
|
</Context>
|
|
|
|
# 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: `<Connector port="8080" ...`
|
|
|
|
4. **Tomcat 10 compatibility issues**:
|
|
- Tomcat 10 uses Jakarta EE (jakarta.* packages instead of javax.*)
|
|
- Ensure all dependencies are compatible with Jakarta EE
|
|
|
|
## UPDATING THE APPLICATION
|
|
|
|
1. Stop Tomcat: `sudo /opt/tomcat/bin/shutdown.sh`
|
|
2. Remove old deployment: `sudo rm -rf /opt/tomcat/webapps/DL*`
|
|
3. Upload new DL.war file
|
|
4. Start Tomcat: `sudo /opt/tomcat/bin/startup.sh`
|
|
|
|
---
|
|
|
|
DEPLOYMENT GUIDE CREATED: 2024
|
|
Tomcat Version: 10.1.48
|
|
Application Context: DL
|