Key concepts and reference notes for Java Content Repository (JCR) in AEM.
CRX/DE & JCR — Debug Tips
Ghi chú các kỹ thuật sử dụng CRX/DE Lite để khám phá JCR, debug page content và rendering trong AEM 6.5.
Truy cập CRX/DE Lite
Cấu trúc JCR cần nắm
Debug Page Content
Xem node structure của 1 page
Mỗi AEM page = 1 node cq:Page + child node jcr:content:
Các property quan trọng trên jcr:content
Xem nhanh JSON của page
Dùng .tidy.infinity.json để format đẹp hơn.
Debug Rendering (Sling Resolution)
Hiểu Sling Resource Resolution
AEM dùng Sling để resolve URL → Resource → Script/Component:
Tool debug resolution
Sling Resource Resolver — test URL resolution:
Nhập path → xem resource resolve tới đâu.
Sling Script Resolution — xem script nào được chọn:
Recent Requests (Request Log)
Xem chi tiết từng request: timing, included scripts, selectors.
Query Builder — Tìm content trong JCR
Dùng UI
Dùng API URL
Các query hữu ích cho debug
Tìm tất cả page dùng 1 template:
Tìm component theo resourceType:
Tìm node chứa 1 property value cụ thể:
Full-text search:
Debug Component Dialog & Content
Xác định component nào render 1 section
- Trên page, bật Developer Mode (User icon → Developer)
- Hover lên component → thấy
sling:resourceTypevà path - Hoặc view page source → tìm comment
\{/* cq:include */\}markers
Tìm component code từ resourceType
Xem dialog field → JCR property mapping
Mở dialog XML trong CRX/DE:
Mỗi field có name property → map trực tiếp thành JCR property trên node.
Ví dụ:
→ Property location trên jcr:content node.
Debug Tips nâng cao
So sánh node giữa 2 language versions
Mở 2 tab CRX/DE, navigate tới cùng path nhưng khác language:
So sánh property list → thấy ngay field nào bị thiếu.
Hoặc dùng JSON diff:
Tìm ai/cái gì đã modify node
Kiểm tra property trên node:
jcr:lastModified— timestampjcr:lastModifiedBy— usercq:lastReplicated— last publish timecq:lastReplicatedBy— who publishedcq:lastReplicationAction— Activate/Deactivate
Tìm tất cả references tới 1 path
Xem node version history
Hoặc navigate trong CRX/DE:
Debug Sling Model đọc data
Nếu component dùng Sling Model inject property:
Nếu property không tồn tại trên node → field = null → UI render trống.
Check OSGi config ảnh hưởng rendering
Search Sling, Mapping, ResourceResolver → xem có URL mapping hay vanity URL nào redirect.
Checklist khi debug page hiển thị sai
- Mở CRX/DE → navigate tới page node → kiểm tra property có đúng không
- Check
.infinity.json→ xem data thực tế trả về - Xem
sling:resourceType→ tìm component code - Đọc HTL/Sling Model → xem logic render, có condition nào skip field không
- Check Sling Script Resolver → đúng script được pick chưa
- Kiểm tra dispatcher cache → có phải đang serve cached version cũ
- So sánh giữa author vs publish → data có được replicate chưa