技术文章 - CS439388

将 Tomcat 更新至 9.0.97 或更高版本后,ThingWorx Java 扩展失败,并出现错误“运行时未找到 Java 类定义”(NoClassDefFoundError)

已修改: 12-May-2025   


注意:本文已使用机器翻译软件翻译,以方便非英语客户阅读。但翻译内容可能包含语法错误或不准确之处。请注意, PTC对本文所含信息的翻译准确性及使用后果不承担任何责任。请在 此处 查看本文的英文原始版本以便参考。有关机器翻译的更多详情,请单击 此处
感谢您告诉我们。我们将尽快审阅此译文。

适用于

  • 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