如何解决Java LinkageError异常?
我正在为 WebSphere 6.0 开发一个使用 Java servlet 的应用程序。部署并运行我的应用程序后,我收到以下类型的 LinkageError(来自服务器日志):
Error 500: java.lang.LinkageError: LinkageError while定义类:无法定义学生.操作.操作,因为:学生/操作/操作(不支持的major.minor版本50.0)这通常是由于在类加载器中的多个位置定义了一个类引起的 等级制度。其他潜在原因包括针对具有不兼容方法签名的旧版本或新版本的类进行编译。转储当前上下文类加载器层次结构:==>指示定义类加载器 ==>[0] com.ibm.ws.classloader.CompoundClassLoader@666bc7e8 本地类路径:E:\Program Files\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR。 Ear\Student.war\WEB-INF\classes;E:\Program文件\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR.ear\Student.war\WEB-INF\lib\asm.jar;E:\Program文件\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR.ear\Student.war\WEB-INF\lib\c3p0-0.9.0.4.jar;
I am developing an application for WebSphere 6.0 which uses a Java servlet.After deploying and running my application, I am receiving a LinkageError of the following type (from the server log):
Error 500: java.lang.LinkageError: LinkageError while defining class: student.operation.Action Could not be defined due to: student/operation/Action (Unsupported major.minor version 50.0) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader@666bc7e8 Local ClassPath: E:\Program Files\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR.ear\Student.war\WEB-INF\classes;E:\Program Files\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR.ear\Student.war\WEB-INF\lib\asm.jar;E:\Program Files\IBM\SDP\runtimes\base_v6\profiles\WTE_APPSRV61\installedApps\gh-vdikcisv206Node1Cell\DefaultEAR.ear\Student.war\WEB-INF\lib\c3p0-0.9.0.4.jar;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加到 Nivas 答案中,请检查您在部署期间是否还在任何其他 jar 中包含相同的 Student.operation.action 。
如果你想在 JDK5 中运行 JDK6 编译的类,请在编译过程中传递 -source 选项。
Adding to Nivas answer, Please check whether you are also including the same student.operation.action in any other jars during deployment.
If you are want to run a JDK6 compiled class in JDK5 pass -source option during compilation.
类
student.operation.Action
已在 Java 6 下编译(50.0 对应 JDK 1.6 编译的类版本),但您在运行时使用的是较低版本的 JVM/JRE。确保您的运行环境也是 JDK 1.6
Class
student.operation.Action
has been compiled under Java 6 (50.0 corresponds to JDK 1.6 compiled class version), but you are using a lower version of JVM/JRE at runtime.Make sure your runtime environment is also JDK 1.6