11

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:

 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.

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?

We are still using EJB 2 and this pattern worked in Weblogic 8.1 and 10.3.0

Gaurav Manral
  • 600
  • 4
  • 7
  • 24
Pavel Rozenblioum
  • 144
  • 1
  • 2
  • 5
  • 8
    Wrong. Interfaces `extends` other interfaces. Classes `implements` interfaces. – Guillaume Darmont Jun 14 '13 at 06:47
  • 1
    Is it only weblogic that was upgraded? Nothing else? Also, why this pattern to start with? What was this pattern trying to solve? – fge Jun 14 '13 at 06:56
  • Yes, weblogic is the only thing updated. The pattern is there mostly by accident. I've just cleaned up one of beans like this and all I had to do was remove methods from one of interfaces, so it's probably a case of someone being overeager. – Pavel Rozenblioum Jun 14 '13 at 07:47
  • I've definitely used that sort of pattern before; normally the compiler would make sure you don't get those errors. It sounds like there may be a problem with your compiler? – Krease Feb 10 '14 at 06:48
  • Have you seen: https://stackoverflow.com/questions/19546357/can-an-interface-extend-multiple-interfaces-in-java – Thiago Chagas - Batata Jan 13 '18 at 13:14
  • What JVM version are you using, did that change? – Martin van Wingerden Aug 15 '19 at 06:18

2 Answers2

-1

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.

Dr. Max Völkel
  • 1,780
  • 2
  • 17
  • 24
-3

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.

  • 2
    Thanks for your first answer on StackOverflow. However, "Duplicate method name in class file" error won't appear due to classes load twice. Also, mentioning JAVA_HOME twice does not make classes load again. – DinushaNT Dec 17 '19 at 11:31