Geo Thomas
Geo Thomas

Reputation: 1159

How to fix java.lang.NoSuchMethodError even if such a method exist, and error do not occur in local server

I am getting the following error in my Spring MVC web Application.

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.smartwcm.core.reservation.service.CrentalReservationService.saveOrUpdateReservation(Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;)Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;

I have no issues when I execute the code in my local server. But when the code is deployed to a QA server, I get the above error.

The method that is specified in the error is :

public void saveOrUpdateReservation(CrentalReservationTO reservation) throws CrentalException 
    {
        crentalReservationDao.saveOrUpdateReservation(reservation);
    }

and the CrentalReservationTO is:

public class CrentalReservationTO 
{
    public CrentalReservationTO() 
    {
        super();
    }

    private int reservationId;
    private String reservationStatus;
    private int userCreated;
    private int userModified;
    private Date createdTime;
    private Date updatedTime;
    private int userId;
}

The default constructor was added once I started getting the error, but it has not resolved the issue.

Upvotes: 0

Views: 308

Answers (1)

SubOptimal
SubOptimal

Reputation: 22973

The method signature you posted is

void saveOrUpdateReservation(CrentalReservationTO reservation)

but from the exception message

saveOrUpdateReservation(Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;)
Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;

Your code is calling

CrentalReservationTO saveOrUpdateReservation(CrentalReservationTO reservation)

You might have changed a class and not recompiled all dependent classes.

Upvotes: 1

Related Questions