当从Eclipse运行程序时,它工作得很好。
当在Eclipse之外运行它时,我得到了这样的结果:
java.lang.ClassFormatError: Duplicate method name&signature in class file [Class Name]有问题的类是从接口实现的,程序还有其他几个类,这些类是从错误中提到的类扩展而来的。
是什么导致了这种情况,以及如何修复它?
发布于 2015-01-15 22:37:48
我也有同样的问题。对我来说,根本原因是aspectj插件编译了两次源代码。Aspect类留在“服务”模块中,使用aspectJ插件进行编译。然后它已经编译成顶级的“web”模块作为依赖项,并再次编译(因为“服务”模块在“web”模块的aspectJ插件配置中是“weaveDependency”)。解决方案:我已经替换了'web‘模块中的下一个配置
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<weaveDependencies>
<weaveDependency>
<groupId>com.taxi.core</groupId>
<artifactId>service</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
使用
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>com.taxi.core</groupId>
<artifactId>service</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
发布于 2012-04-05 10:10:25
当Java Virtual Machine尝试读取类文件并确定该文件的格式不正确或无法解释为类文件时抛出的
。
http://docs.oracle.com/javase/7/docs/api/java/lang/ClassFormatError.html
Javadoc是你的朋友。
发布于 2013-01-10 21:28:58
谷歌发现,禁用“保存时部署”可能有助于解决此问题。在测试平台上试用并投入生产!
https://stackoverflow.com/questions/10021752
复制相似问题