@@ -118,27 +118,40 @@ Moqui requires 3 servers: database (embedded H2), OpenSearch, and Moqui itself.
118118./gradlew downloadOpenSearch startElasticSearch load
119119```
120120
121- ** Server lifecycle commands:**
121+ ** Server lifecycle commands** - Use these exact commands throughout development:
122+
122123``` bash
123- # Stop
124+ # === STOP SERVER ===
124125pkill -9 -f " java.*moqui.war" ; sleep 2
125126
126- # Start
127+ # === START SERVER ===
127128nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
128- # Wait: grep -q "Started.*8080" /tmp/moqui-server.log
129129
130- # Restart (required for: entity changes, configuration changes, SECA/EECA changes)
131- # 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 &
134- ```
130+ # Wait for startup (with timeout)
131+ for i in {1..40}; do
132+ if grep -q " Started.*8080" /tmp/moqui-server.log 2> /dev/null; then
133+ echo " Server started after $i seconds"
134+ break
135+ fi
136+ sleep 1
137+ done
135138
136- ** Verify running:**
137- ``` bash
138- curl -u john.doe:moqui http://localhost:8080/rest/s1/mantle/parties
139+ # CRITICAL: Wait for warmup - server needs 5 seconds after "Started" message
140+ sleep 5
141+
142+ # Verify running
143+ curl -s -u john.doe:moqui http://localhost:8080/rest/s1/mantle/parties
144+
145+ # === RESTART SERVER ===
146+ # Use stop + start commands above
147+ # Required for: entity changes, configuration changes, SECA/EECA changes
148+ # No restart needed for: service changes, screen changes, data file changes
139149```
140150
141- Server at http://localhost:8080 , credentials: ` john.doe ` / ` moqui ` (from demo data).
151+ ** Server details:**
152+ - URL: http://localhost:8080
153+ - Credentials: ` john.doe ` / ` moqui ` (from demo data)
154+ - Log file: ` /tmp/moqui-server.log `
142155
143156### Data Management and Loading
144157
@@ -154,18 +167,18 @@ loaded and verified before testing.
154167
155168** Loading Data** :
156169
157- ** CRITICAL: The Moqui server MUST be stopped before loading data. Data loading will fail or cause database conflicts if the server is running.**
170+ ** CRITICAL: The Moqui server MUST be stopped before loading data. Data loading
171+ will fail or cause database conflicts if the server is running.**
158172
159173``` bash
160- # Stop server first
174+ # Stop server first (see "Server Management" section above)
161175pkill -9 -f " java.*moqui.war" ; sleep 2
162176
163177# Then load data
164178./gradlew load # Loads all data types (safest - handles dependencies)
165179./gradlew load -Ptypes=demo # Load only demo (requires other data to be loaded first)
166180
167- # Restart server after loading
168- nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
181+ # Restart server (use START SERVER commands from "Server Management" section above)
169182```
170183
171184** Data File Format** - Use full entity names in component's ` data/ ` directory:
@@ -179,11 +192,11 @@ nohup java -jar moqui.war > /tmp/moqui-server.log 2>&1 &
179192
180193** Data Development Workflow** :
1811941 . Create data XML in ` component-name/data/*.xml ` using full entity names
182- 2 . ** Stop the server** (required): ` pkill -9 -f "java.*moqui.war"; sleep 2 `
195+ 2 . ** Stop the server** (required): See "Server Management" section - STOP SERVER
1831963 . 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
186- http://localhost:8080/rest/s1/mantle/parties` ) or EntityDataFind UI
197+ 4 . ** Start the server** : See "Server Management" section - START SERVER
198+ (includes startup wait and warmup)
199+ 5 . Verify via REST or EntityDataFind UI
1872006 . Monitor server output for parsing/constraint/foreign key errors
1882017 . Test service with loaded data
1892028 . Iterate: modify data files and reload until working (repeat from step 2)
@@ -226,8 +239,8 @@ access. Service scripts go in `service/` or `src/main/resources/` (with
226239` classpath:// ` location).
227240
228241** Service Naming** : Service file ` service/mantle/order/OrderServices.xml `
229- creates namespace ` mantle.order.OrderServices ` . Services defined as
230- ` <service verb="get" noun="OrderInfo">` are called as
242+ creates namespace ` mantle.order.OrderServices ` . Services defined as `<service
243+ verb="get" noun="OrderInfo">` are called as
231244` mantle.order.OrderServices.get#OrderInfo ` .
232245
233246** Three Ways to Access Services** :
@@ -237,32 +250,36 @@ creates namespace `mantle.order.OrderServices`. Services defined as
237250
238251 ** Browser UI** :
239252 - Navigate to: http://localhost:8080/qapps/tools/Service/ServiceRun
240- - Enter service name: ` org.moqui.impl.BasicServices.get#GeoRegionsForDropDown `
253+ - Enter service name:
254+ ` org.moqui.impl.BasicServices.get#GeoRegionsForDropDown `
241255 - Fill parameters in the form and submit
242256 - See results immediately
243257
244258 ** Programmatic (curl)** :
245259 ``` bash
246260 # Basic pattern - all parameters go in JSON body
247- curl -X POST -H " Content-Type: application/json" \
261+ # Use -s flag to suppress curl progress output and get clean JSON
262+ curl -s -X POST -H " Content-Type: application/json" \
248263 -u john.doe:moqui \
249264 -d ' {"serviceName": "service.path.verb#Noun", "param1": "value1", "param2": "value2"}' \
250265 http://localhost:8080/apps/tools/Service/ServiceRun/runJson
251266
252267 # Example: Get geo regions with parameters
253- curl -X POST -H " Content-Type: application/json" \
268+ curl -s - X POST -H " Content-Type: application/json" \
254269 -u john.doe:moqui \
255270 -d ' {"serviceName": "org.moqui.impl.BasicServices.get#GeoRegionsForDropDown", "geoId": "USA"}' \
256271 http://localhost:8080/apps/tools/Service/ServiceRun/runJson
257272
258273 # Example: Service with no parameters (noop)
259- curl -X POST -H " Content-Type: application/json" \
274+ curl -s - X POST -H " Content-Type: application/json" \
260275 -u john.doe:moqui \
261276 -d ' {"serviceName": "org.moqui.impl.BasicServices.noop"}' \
262277 http://localhost:8080/apps/tools/Service/ServiceRun/runJson
263278 ```
264279
265- ** Note** : The ` runJson ` endpoint accepts ANY service name and returns JSON responses - perfect for testing and automation without creating custom REST definitions.
280+ ** Note** : The ` runJson ` endpoint accepts ANY service name and returns JSON
281+ responses - perfect for testing and automation without creating custom REST
282+ definitions.
266283
2672842 . ** Custom REST API** (For production/integration):
268285 - Define in ` *.rest.xml ` files using resource/id structure (see
@@ -303,11 +320,13 @@ When implementing or modifying services, follow this iterative workflow:
303320
304321 ** Option A: ServiceRun UI** (Fastest - no REST config needed):
305322 - Navigate to: http://localhost:8080/qapps/tools/Service/ServiceRun
306- - Enter service name: ` org.moqui.impl.BasicServices.get#GeoRegionsForDropDown `
323+ - Enter service name:
324+ ` org.moqui.impl.BasicServices.get#GeoRegionsForDropDown `
307325 - Fill parameters in the form and submit
308326 - View results immediately in the UI
309327
310- ** Option A (Programmatic)** : Use the ` runJson ` endpoint (see "Three Ways to Access Services" above for curl examples)
328+ ** Option A (Programmatic)** : Use the ` runJson ` endpoint (see "Three Ways to
329+ Access Services" above for curl examples)
311330
312331 ** Option B: Custom REST API** (if service already exposed in ` *.rest.xml ` ):
313332 ``` bash
@@ -342,7 +361,8 @@ When implementing or modifying services, follow this iterative workflow:
342361 - Parameter validation failures
343362 - Transaction issues
344363 - SQL errors for entity operations
345- - ** Note** : Successful service calls typically don't generate detailed logs in production mode
364+ - ** Note** : Successful service calls typically don't generate detailed logs
365+ in production mode
346366
3473674 . ** Examine the response** :
348368 - Check the JSON response from curl for service output parameters
@@ -355,7 +375,8 @@ When implementing or modifying services, follow this iterative workflow:
355375
356376When adding or modifying entities:
3573771 . ** Define/modify entity** in ` entity/*.xml ` files
358- 2 . ** Restart the server** (entity definition changes require restart - see "When to Restart the Server" section above)
378+ 2 . ** Restart the server** (entity definition changes require restart - see "When
379+ to Restart the Server" section above)
3593803 . ** Test entity operations** :
360381
361382 ** Option A: EntityDataFind UI** (Recommended - most visual and interactive):
@@ -451,8 +472,8 @@ Four types of REST APIs are available:
451472
452473# ## Reading Server Output for Errors
453474
454- The server console output (written to ` /tmp/moqui-server.log` ) shows all logging.
455- Common error patterns:
475+ The server console output (written to ` /tmp/moqui-server.log` ) shows all
476+ logging. Common error patterns:
456477
457478- ** Service not found** : ` Could not find service with name [...]` → Check
458479 service name spelling and path
@@ -479,6 +500,7 @@ review past output.
479500
480501** Port 8080 conflict** (` Failed to bind` , ` Address already in use` ):
481502` ` ` bash
503+ # See "Server Management" section - STOP SERVER
482504pkill -9 -f " java.*moqui.war" ; sleep 2
483505` ` `
484506
@@ -497,7 +519,8 @@ ps aux | grep opensearch | grep -v grep # Verify
497519- 403 → Check permissions
498520- 500 → Check ` tail runtime/log/moqui.log`
499521
500- ** Data load fails** : Server must be stopped first.
522+ ** Data load fails** : Server must be stopped first (see Server Management
523+ section).
501524
502525# # Coding standards and criteria
503526
0 commit comments