简体   繁体   English

需要有关NoClassDefFound错误的帮助

[英]Need help on NoClassDefFound error

I'm working on a service to prepare spreadsheet for a report. 我正在开发一项服务,以为报表准备电子表格。 I'm using jxl-2.4.2.jar to achieve this ( please note that I can't use the latest version due to compatibility constraints). 我正在使用jxl-2.4.2.jar来实现这一点(请注意,由于兼容性限制,我无法使用最新版本)。 When I execute the code locally on my eclipse it works fine. 当我在Eclipse上本地执行代码时,它可以正常工作。 My eclipse has java 1.5. 我的日食有Java 1.5。

When I deploy my code in my test environment, its giving NoClassdefFound error for jxl.* ( any classes in jxl ). 当我在测试环境中部署代码时,它给jxl.* (jxl中的任何类)提供了NoClassdefFound error My test environment has IBM's java 1.5. 我的测试环境具有IBM的Java 1.5。 I believe it doesn't make any difference if I use IBM's version or Sun's version of java in this context. 我相信,如果在这种情况下使用IBM版本或Sun版本的java,不会有任何区别。

I believe this error could happen when JVM fails to load the class at runtime or if the class has any static methods/properties. 我相信当JVM在运行时无法加载类或类具有任何静态方法/属性时,可能会发生此错误。 I checked the classes and none of them have static contents. 我检查了这些类,它们都没有静态内容。 So, this could be something else. 因此,这可能是另外一回事。

FYI.. I'm using ant to build the project & I check the build.xml. 仅供参考。.我正在使用ant构建项目,并检查build.xml。 It is showing the correct version of java 1.5. 它显示了Java 1.5的正确版本。 Could someone please help to fix this error? 有人可以帮忙解决此错误吗? Also Just FYI.. my project resides on AIX 5.0 server. 同样,仅供参考。我的项目位于AIX 5.0服务器上。

Any help in this regard much appreciated . 在这方面的任何帮助深表感谢 Thanks in advance. 提前致谢。

This error implies that your dependency is missing at runtime ie the set of dependent jars is not not correct. 此错误表示在运行时缺少依赖项,即,依赖罐的集合不正确。 jxl-2.4.2.jar is not getting shipped along with deployment, so just to resolve the issue , you can manually copy this jar in dependent lib folder of deployment. jxl-2.4.2.jar不会随部署一起提供,因此为了解决该问题,您可以手动将此jar复制到部署的相关lib文件夹中。

But proper fix will be to get your ANT build checked. 但是适当的修复将是检查您的ANT构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM