技术文章 - CS439388
将 Tomcat 更新至 9.0.97 或更高版本后,ThingWorx Java 扩展失败,并出现错误“运行时未找到 Java 类定义”(NoClassDefFoundError)
已修改: 12-May-2025
适用于
- ThingWorx Platform 9.4
- Tomcat 9.0.97 and later 10 and 11
说明
- 尝试从扩展加载 JAR 时出现“未找到 Class Def”错误
- ApplicationLog 中的错误消息:
[L: ERROR] [O: ctcpReflectionProcessor] ... Cause(<CLASS_NAME>), Reason(A Java class definition was not found at runtime.), Possible Resolutions([1]=Add the Jar file that contains the missing class in your Extension packaging zip., [2]=Add the Jar file that contains the missing class in your Extension manifest file as a Jar Resource.)- ThingWorx在运行时使用自定义URLClassLoader动态加载扩展 (JAR)
- Tomcat 9.0.97为搜索但未找到的类引入了 LRU 缓存(
notFoundClassResourceCacheSize) - 在扩展被动态加载之前,Tomcat 可能已经尝试找到该类
- 由于当时 JAR 不可用,Tomcat 将此类缓存为“未找到”
- 即使在动态添加 JAR 之后,Tomcat 也不会再次尝试查找该类,并会抛出NoClassDefFoundError ,假设该类仍然缺失
这是文章 439388 的 PDF 版本,可能已过期。最新版本 CS439388