Skip to content

Commit 79f17a6

Browse files
committed
fix to moqui.war on AGENTS.md
1 parent 58d2923 commit 79f17a6

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

AGENTS.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ps aux | grep opensearch | grep -v grep
3535
ls -lh runtime/db/h2/moqui.mv.db
3636
# Should exist and be > 50MB after loading demo data
3737

38-
# 3. Server ready (run after ./gradlew run)
38+
# 3. Server ready (run after starting server with java -jar moqui.war)
3939
grep "Started oejs.ServerConnector.*8080" runtime/log/moqui.log | tail -1
4040
# Should show: Started oejs.ServerConnector@...{0.0.0.0:8080}
4141

@@ -120,16 +120,17 @@ Moqui requires 3 servers: database (embedded H2), OpenSearch, and Moqui itself.
120120

121121
**Server lifecycle commands:**
122122
```bash
123-
# Start (always stop first to avoid port conflicts)
124-
pkill -f "gradlew run"; kill -9 $(ss -tlnp 2>/dev/null | grep :8080 | grep -oP 'pid=\K\d+') 2>/dev/null; sleep 2
125-
nohup ./gradlew run > /tmp/moqui-server.log 2>&1 &
126-
# Wait: grep -q "Started.*8080" /tmp/moqui-server.log (or use strings if binary)
127-
128123
# Stop
129-
pkill -f "gradlew run"; kill -9 $(ss -tlnp 2>/dev/null | grep :8080 | grep -oP 'pid=\K\d+') 2>/dev/null; sleep 2
124+
pkill -9 -f "java.*moqui.war"; sleep 2
125+
126+
# Start
127+
nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
128+
# Wait: grep -q "Started.*8080" /tmp/moqui-server.log
130129

131130
# Restart (required for: entity changes, configuration changes, SECA/EECA changes)
132131
# No restart needed for: service changes, screen changes, data file changes
132+
pkill -9 -f "java.*moqui.war"; sleep 2
133+
nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
133134
```
134135

135136
**Verify running:**
@@ -152,9 +153,19 @@ loaded and verified before testing.
152153
custom types (default for `./gradlew load`)
153154

154155
**Loading Data**:
156+
157+
**CRITICAL: The Moqui server MUST be stopped before loading data. Data loading will fail or cause database conflicts if the server is running.**
158+
155159
```bash
160+
# Stop server first
161+
pkill -9 -f "java.*moqui.war"; sleep 2
162+
163+
# Then load data
156164
./gradlew load # Loads all data types (safest - handles dependencies)
157165
./gradlew load -Ptypes=demo # Load only demo (requires other data to be loaded first)
166+
167+
# Restart server after loading
168+
nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
158169
```
159170

160171
**Data File Format** - Use full entity names in component's `data/` directory:
@@ -168,12 +179,14 @@ loaded and verified before testing.
168179

169180
**Data Development Workflow**:
170181
1. Create data XML in `component-name/data/*.xml` using full entity names
171-
2. Load data: `./gradlew load -Ptypes=demo` (or `./gradlew load` for all)
172-
3. Verify via REST (`curl -u john.doe:moqui
182+
2. **Stop the server** (required): `pkill -9 -f "java.*moqui.war"; sleep 2`
183+
3. Load data: `./gradlew load -Ptypes=demo` (or `./gradlew load` for all)
184+
4. **Restart the server**: `nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &`
185+
5. Verify via REST (`curl -u john.doe:moqui
173186
http://localhost:8080/rest/s1/mantle/parties`) or EntityDataFind UI
174-
4. Monitor server output for parsing/constraint/foreign key errors
175-
5. Test service with loaded data
176-
6. Iterate: modify data files and reload until working
187+
6. Monitor server output for parsing/constraint/foreign key errors
188+
7. Test service with loaded data
189+
8. Iterate: modify data files and reload until working (repeat from step 2)
177190

178191
**Ad-hoc Testing** (non-persistent):
179192
- **DataImport UI**: http://localhost:8080/qapps/tools/Entity/DataImport
@@ -438,7 +451,7 @@ Four types of REST APIs are available:
438451

439452
### Reading Server Output for Errors
440453

441-
The server console output (`./gradlew run` stdout/stderr) shows all logging.
454+
The server console output (written to `/tmp/moqui-server.log`) shows all logging.
442455
Common error patterns:
443456

444457
- **Service not found**: `Could not find service with name [...]` → Check
@@ -466,7 +479,7 @@ review past output.
466479

467480
**Port 8080 conflict** (`Failed to bind`, `Address already in use`):
468481
```bash
469-
pkill -f "gradlew run"; kill -9 $(ss -tlnp 2>/dev/null | grep :8080 | grep -oP 'pid=\K\d+') 2>/dev/null; sleep 2
482+
pkill -9 -f "java.*moqui.war"; sleep 2
470483
```
471484

472485
**OpenSearch not running**:

0 commit comments

Comments
 (0)