BeanDefinitionStoreException: Error registering bean 'LuceneContext' ...
depends on not found; nested exception is NoClassDefFoundError: org/apache/lucene/index/CorruptIndexException
...
NoClassDefFoundError: Could not initialize class com.trs.components.common.publish.widget.LayoutMgr
LuceneContext 依賴 Lucene 核心包,但項目中未正確引入 lucene-core JAR (或版本不匹配),導致 CorruptIndexException 類找不到。LayoutMgr 類靜態塊/字段初始化拋出異常 (如缺少配置文件、依賴 Bean 未就緒),導致 NoClassDefFoundError: Could not initialize class。applicationContext.xml) 未放在 src/main/resources 或未在 web.xml contextConfigLocation 正確指定,導致 Bean 定義未加載。mvn dependency:tree | grep lucene 確認 lucene-core 版本存在且無衝突。LayoutMgr 源碼靜態塊,嘗試延遲初始化或添加異常捕獲。web.xml 中 contextConfigLocation 指向正確路徑 (如 classpath*:applicationContext*.xml)。執行 mvn clean compile dependency:copy-dependencies 檢查輸出 target/dependency 中是否包含 Lucene JAR。