java.lang.NoClassDefFoundError:ProceedingJoinPoint

发布于 2024-08-09 07:30:49 字数 1461 浏览 5 评论 0原文

我们有许多 Web 服务客户端应用程序,它们在我们面向客户的主要应用程序和后端 Web 服务之间进行交互。这些 Web 服务应用程序生成自己的 JAXWS 存根代码,以直接与 Web 服务和实现代码交互,从而在 JAXWS 代码和任何希望使用它的应用程序之间提供干净的接口。过去几周我们遇到了一些小问题,但大多数都已得到解决。

当将这些集成到面向客户的应用程序中时,我们遇到了许多问题,主要集中在 JDK1.5 和 1.6 不兼容上。这些现在已经解决了,但是我们遇到了另一个我们无法解决的问题。 Web 服务客户端使用 AOP 来设置常见的内容,例如标头凭据、异常处理和限制:

<aop:config>
    <aop:pointcut id="pointcut" expression="execution(* MyService.*(..))" />

    <aop:aspect id="throttling" ref="throttlingAdvisor">
        <aop:around pointcut-ref="pointcut" method="doThrottle" />
 </aop:aspect>
    <aop:aspect id="errorHandling" ref="errorHandlingAdvisor">
        <aop:around pointcut-ref="pointcut" method="handleExceptions" />

每个方面都引用一个POJO bean,这些bean包括配置中声明的方法,方法参数类型为org.aspectj.lang.ProceedingJoinPoint,这用于提取我正在拦截的方法的参数。

我们为每个 Web 服务客户端提供其中一个(在 applicationContext-webservicename.xml 中)。该 xml 文件包含在打包的 JAR 中,该 JAR 包含在面向客户的应用程序中,并导入到由面向客户的应用程序的 web.xml 加载的主 applicationContext.xml 中。

我们对这些网络客户端进行了许多单元测试,它们都通过了,证明它们单独没有任何问题。当所有服务都包含在面向客户的应用程序中时,我们会在启动时收到 java.lang.NoClassDefFoundError: ProceedingJoinPoint 异常(我们使用的是带有 JDK1.5.0_17 的 tomcat 5.5)。

我在 JavaDoc 中查找了 java.lang.NoClassDefFoundError ,以防万一它有特殊含义,看起来 JVM 认为该类不存在。然后我查找了包含它声称找不到的类的jar(aspectjrt-1.5.4.jar和aspectjweaver-1.5.4.jar),这些类有重复,所以我尝试依次删除每个jar以查看会发生什么,完全相同的错误。

我是否缺少必需的依赖项?这个问题有一个常见的原因吗(我昨天搜索过这个问题但没有找到太多)?任何帮助将不胜感激。

We have a number of web service client applications which interface between our main customer facing application and backend web services. These web service application generate their own JAXWS stub code to directly interface with the web services and implementation code to provide a clean interface between the JAXWS code and any application that wishes to use it. We've had some small problems with these over the last few weeks but most of them have been resolved.

When it was time to integrate these into the customer facing application we encountered numerous problems, mainly focused around JDK1.5 and 1.6 incompatibility. These have been resolved now, however we have hit another problem which we have no resolution for. The web service clients use AOP to set common things like header credentials, exception handling and throttling:

<aop:config>
    <aop:pointcut id="pointcut" expression="execution(* MyService.*(..))" />

    <aop:aspect id="throttling" ref="throttlingAdvisor">
        <aop:around pointcut-ref="pointcut" method="doThrottle" />
 </aop:aspect>
    <aop:aspect id="errorHandling" ref="errorHandlingAdvisor">
        <aop:around pointcut-ref="pointcut" method="handleExceptions" />

Each aspect refers to a POJO bean, these beans include the method stated in the configuration with the method parameter type of org.aspectj.lang.ProceedingJoinPoint, this is used to extract the arguments of the method I'm intercepting.

We have one of these for each of the web service clients (in an applicationContext-webservicename.xml). This xml file is included in the packaged JAR which is included in the customer facing application and imported into the main applicationContext.xml loaded by the web.xml of the customer facing application.

We have a number of unit tests for these web clients, they all pass proving there's nothing wrong with them individually. When all the services are included in the customer facing applications we get a java.lang.NoClassDefFoundError: ProceedingJoinPoint exception when it starts up (we're using tomcat 5.5 with JDK1.5.0_17).

I looked up the JavaDoc for java.lang.NoClassDefFoundError just in case it had a special meaning, looks like the JVM thinks the class does not exist. I then looked for the jar which contains the classes it's claiming it cannot find (aspectjrt-1.5.4.jar and aspectjweaver-1.5.4.jar), there is a duplication of these classes so I tried removing each jar in turn to see what would happen, exactly the same error.

Am I missing a required dependency? Is there a common cause to this problem (I've searched for this yesterday not finding much)? Any help would be most appreciated.

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

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

发布评论

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

评论(3

挽袖吟 2024-08-16 07:30:49

经过这么长时间,我们设法找到了这个问题的解决方案,当检测到 SVN 提交时,我们使用 Bamboo 来构建我们的项目。尽管在构建依赖项目时,bamboo 环境是为了匹配我们的开发机器而设置的,但它却产生了这个奇怪的问题。

我们仍然不确定它为什么这样做,但与此同时我们正在手动构建和部署这个特定的项目。

我对任何遇到类似问题的人的建议是,将自己与内部 Maven 存储库隔离并在本地重建所有项目。

感谢大家的帮助。

After all this time we managed to find the solution to this problem, we use Bamboo to build our projects when a SVN commit is detected. Although the bamboo environment was set up to match our development machines when it built a dependent project it produced this weird problem.

We're still not sure why it did this, however in the meantime we're manually building and deploying this particular project.

My advice to anyone experiencing a similar problem, just isolate yourself from internal maven repos and rebuild all your projects locally.

Thanks for everyone's help.

戏蝶舞 2024-08-16 07:30:49

可能是类加载器问题。 AspectJ JAR 在哪里?如果您现在将它们放在 WEB-INF/lib 中,也许您可​​以尝试将它们复制到 Tomcat common/lib 中,看看是否有帮助。

应用程序服务器类加载器可能在启动时需要它们,但应用程序类加载器尚未从 WEB-INF 获取它们,因为它在类加载器层次结构中处于较低位置。

Could be a class loader issue. Where are the AspectJ JARs? If you have them in your WEB-INF/lib now, perhaps you could try copying them to the Tomcat common/lib and see if that helps.

It could be that the app server class loader needs them on startup, but the application class loader hasn't gotten them from WEB-INF because it's lower in the class loader hierarchy.

逆光飞翔i 2024-08-16 07:30:49

仅将aspectjrt.jar 添加到server/lib 文件夹,而不是aspectjweaver.jar。重复的类也会导致混乱。运行时 jar(“rt”代表运行时)应该用于运行时。 weaver jar 用于编译/编织时间。您使用的是 LTW 还是 CTW?

Only add aspectjrt.jar to the server/lib folder, NOT the aspectjweaver.jar. Duplicate classes can also lead to confusion. The runtime jar (the "rt" stands for runtime) is supposed for the runtime. The weaver jar is used for compile/weave time. Are you using LTW or CTW?

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