diff --git a/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplateService.java b/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplateService.java index ccdd8ad..5e452a8 100644 --- a/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplateService.java +++ b/platform-flow-gateway/src/main/java/com/eip4/platform/flowgateway/aggregate/WfTemplateService.java @@ -110,10 +110,23 @@ public class WfTemplateService { } } + /** JAXP 1.4 兼容的 DocumentBuilderFactory:钉到 JDK 内置实现,绕开 platform-report(jatools)带入的 + * 上古 xerces-eip3.jar(2004) —— 后者不实现 setFeature(JAXP 1.4),classpath 发现机制选中它会致 + * AbstractMethodError,击穿 WfTemplate 全部 XML 解析。显式指定 JDK 实现类(总在),不删/不动 report 的 xerces。 */ + private static DocumentBuilderFactory newJdkDbf() { + try { + return DocumentBuilderFactory.newInstance( + "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", null); + } catch (Throwable t) { + // 极端兜底:JDK 实现类不可用时回退默认发现(正常 JDK 21 不会走到这) + return DocumentBuilderFactory.newInstance(); + } + } + /** DOM 解析模板 XML(禁 DOCTYPE/外部实体,防 XXE)。public 供单测直接验证解析(纯函数)。 */ public WfTemplateMeta parseXml(String xml) { try { - DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); + DocumentBuilderFactory f = newJdkDbf(); f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); f.setFeature("http://xml.org/sax/features/external-general-entities", false); f.setFeature("http://xml.org/sax/features/external-parameter-entities", false);