java.lang.ClassFormatError:类文件中的方法名称和签名重复
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17102324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.ClassFormatError: Duplicate method name&signature in class file
提问by Pavel Rozenblioum
We are in the process of upgrading our application from Weblogic 10.3.0
to 10.3.6
. When we try to deploy it we get the error:
我们正在将我们的应用程序从 升级Weblogic 10.3.0
到10.3.6
。当我们尝试部署它时,我们收到错误:
java.lang.ClassFormatError: Duplicate method name&signature in class file...
Upon further investigation we discovered that the issue is caused by code that looks like this:
经过进一步调查,我们发现问题是由如下代码引起的:
interface Foo{
void foo();
}
interface Bar{
void foo();
}
interface Baz extends Foo, Bar{}
BazEJB implements Baz....
This leads to 2 foo methods being generated in the Baz....ELOImpl.class
which leads to this error when we try to deploy the ear files.
这会导致在 Baz 中生成 2 个 foo 方法....ELOImpl.class
当我们尝试部署 ear 文件时会导致此错误。
The obvious workaround is to remove this pattern, but are there any other suggestions? Are we the ones in the wrong here or should that be considered a bug in weblogic?
显而易见的解决方法是删除此模式,但还有其他建议吗?是我们错了还是应该将其视为 weblogic 中的错误?
We are still using EJB 2
and this pattern worked in Weblogic 8.1 and 10.3.0
我们仍在使用EJB 2
,这种模式在Weblogic 8.1 and 10.3.0
回答by Dr. Max V?lkel
Make sure to clean recompile the class having the error. Whatever flags you can set: Make it more clean and more forced, until it works.
确保清理重新编译有错误的类。无论你可以设置什么标志:让它更干净、更强制,直到它起作用。
回答by mahendra parihar
this is because class is getting reloaded again. Check if you added java_home or path variable twice. may be one in eclipse and one which default(OS level). remove duplicate path variables.
这是因为类再次被重新加载。检查您是否添加了 java_home 或 path 变量两次。可能是 eclipse 中的一个,另一个是默认的(操作系统级别)。删除重复的路径变量。