Tomcat 6 javagent 类加载器问题

发布于 2024-08-26 12:53:24 字数 401 浏览 3 评论 0原文

我正在使用 Salve 依赖注入库来检测 Web 应用程序的字节代码。我在 Tomcat VM 选项中指定了 -javaagent 并将其指向 Salve 代理 jar。

代理 jar 被加载,但随后它抛出 java.lang.NoClassDefFoundError 无法找到位于我的 Web 应用程序的 WEB-INF/lib 文件夹中的其他 Salve jar 中的类。

我可以通过将这些 JAR 放在 Tomcat/endorsed 文件夹中来解决这个问题。但是,其中一些 jar 依赖于第三方库,例如 Spring 和 servlet-api.jar。因此,我被迫将所有这些依赖项也放入 Tomcat/endorsed 中。

有人能建议一种更好的方法来处理 Tomcat javaagent 的依赖关系吗?

谢谢。

I am using Salve Dependency Injection library that instruments the byte code of the web application. I specified -javaagent in Tomcat VM options and pointed it to the Salve agent jar.

The agent jar gets loaded, but then it throws a java.lang.NoClassDefFoundError unable to find classes that are in other Salve jars which are located in WEB-INF/lib folder of my web app.

I can solve this problem by putting those JARs in Tomcat/endorsed folder. However, some of those jars depend on third-party libraries, such as Spring and servlet-api.jar. Therefore, I am forced to put all these dependencies in Tomcat/endorsed as well.

Could anybody suggest a better way for handling dependencies of a Tomcat javaagent?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情话难免假 2024-09-02 12:53:24

这听起来很奇怪。代理通常不依赖于其他类,因为这会使它们完全无用。我认为你误解了这个错误。依赖项是否有可能来自已检测的类,并且最终检测了错误的类?

This sounds very weird. Agents usually do not depend on other classes, as it would make them completely useless. I think you are misunderstanding the error. Is it possible that the dependency is from the instrumented classes and wrong classes are ending up instrumented?

桃酥萝莉 2024-09-02 12:53:24

药膏?搞什么?使用 AspectJ。

“依赖于 Spring 的依赖注入框架” - o_O ?!

Salve? WTF? Use AspectJ.

"Dependency injection framework that depends on Spring" - o_O ?!

找回味觉 2024-09-02 12:53:24

Salve 库由多个 JAR 组成。其中一些依赖于第三方库,例如Spring。我最终将这些 JAR 从 tomcat/endorsed 移至我的 web 应用程序的 WEB-INF/lib。我的发现和最终工作目录结构记录在此处

Salve library consists of several JARs. Some of them depend on third-party libraries, such as Spring. I ended up moving those JARs from tomcat/endorsed to my webapp's WEB-INF/lib. My findings and the final working directory structure are documented here?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文