java.lang.AbstractMethodError running a webapp in Eclipse with jetty.

12,137

Solution 1

Try rebuilding your code.

I'm guessing that you've got a DAO interface, and the signatures of the interface and the impl differ slightly enough that the compiler doesn't see the interface as fully implemented by the concrete impl class. Maybe Eclipse is out of synch.

If that doesn't work, see if Eclipse lets you navigate from the interface method to the concrete implementation. If it can't, that's a clue reinforcing what the compiler is telling you.

Check your CLASSPATH. Maybe the impl that you think is being loaded by the JVM isn't.

Check the bug list if you think it's a problem with the compiler.

If you don't see a bug in list, assume that you're the problem. Lots of people use it; a bug that serious would have been discovered and fixed long ago.

Clean out the Jetty deployment - the WAR and all temp files. Rebuild and redeploy. Maybe Jetty is holding onto an older version of the .class file, which would explain why it works on the command line and not when you deploy to the web.

Assume that you're the problem first, last, and always.

UPDATE: Is there a way to switch the JDK that Eclipse uses? Can you point to a Sun JDK?

This is another reason why I detest Eclipse. Your story, if true, would make me even happier to be an IntelliJ user.

Question: Are you implementing IBM's generic DAO?

Solution 2

Try disabling internal-weaving: (eclipselink.weaving.internal=false in persistence.xml)

Share:
12,137

Related videos on Youtube

stevemac
Author by

stevemac

Umm what to write.

Updated on April 18, 2022

Comments

  • stevemac
    stevemac about 2 years

    I am working on a project in eclipse that when I launch using the jetty plugin gives me a

    java.lang.AbstractMethodError: 
    au.com.mycopmpany.impl.MyClassDAOImpl.findById(Ljava/lang/Integer;)Ljava/lang/Object;.
    

    This file compiles fine in Eclipse and the code is implementing the method that the error talks about. From my reading this error indicates that "at runtime" the JVM finds a class that doesn't have this method implemented.

    But I can assure you that the MyClassDAOImpl most definitely does have the findById method implemented with the correct signature.

    This seems like a bug in the Eclipse compiler; I can fix the issue by running maven package from a command prompt and then running the application within Eclipse works fine.

    It seems that the Eclipse compiler has some sort of bug in relation to this class. I did read something online about a bug with generics in the Eclipse compiler (which this class does use Generics) but this base class / interface is re-implemented over and over in our code base and it is this class that always has problems.

    Does anyone know a workaround, or better yet, a fix for this problem?

    I can replicate this exception every time, so if an Eclipse compiler developer reads this and this is a known issue, please feel free to contact me for assistance in tracking down the issue.

    Update:

    The class with the issue is one of many that implement GenericDAO where the Generic interface is defined as:

    public interface GenericDAO<T, TList> 
    

    The method in question that is failing is:

    public T findById(Integer integer) throws APIException;   
    
    • lumpynose
      lumpynose almost 15 years
      What does the base class or interface declare the parameter as; Integer, or something up the chain, like Serializable? I'm wondering if it's generating code that requires something higher up (like Serializable) for the parameter but it's getting Integer and somehow not realizing that it implements Serializable.
    • lumpynose
      lumpynose almost 15 years
      Could it be that you need to declare your id parameter's type with super or extends? E.g., public abstract class BaseDao<T, I<? super Serializable>> Note that I'm just stabbing in the dark and guessing.
  • stevemac
    stevemac almost 15 years
    I agree that if this was a problem I would find more online about it. My pointer that says its something wrong in eclipse is that I can navigate the code and all is good, and I can compile from command line and then RUN in eclipse (using the sun compiler's classes) without changing anything and it works. Until I make a change on that class that requires eclipse to re-compile it, the code runs fine.
  • stevemac
    stevemac almost 15 years
    You are right, navigating at runtime gives me classes with no source, but I can navigate at compile time correctly.
  • Dangling Piyush
    Dangling Piyush almost 12 years
    @duffymo i know its an old thread but i am getting the same error and using IBM generic DAO.