如何修复 java.lang.NoSuchMethodError 即使存在这样的方法,并且本地服务器不会发生错误
How to fix java.lang.NoSuchMethodError even if such a method exist, and error do not occur in local server
我的 Spring MVC 网络应用程序出现以下错误。
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;
我在本地服务器上执行代码时没有问题。但是当代码部署到QA服务器时,我得到了上面的错误。
错误中指定的方法是:
public void saveOrUpdateReservation(CrentalReservationTO reservation) throws CrentalException
{
crentalReservationDao.saveOrUpdateReservation(reservation);
}
而 CrentalReservationTO
是:
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;
}
默认构造函数是在我开始收到错误后添加的,但它没有解决问题。
您发布的方法签名是
void saveOrUpdateReservation(CrentalReservationTO reservation)
但是从异常信息来看
saveOrUpdateReservation(Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;)
Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;
您的代码正在调用
CrentalReservationTO saveOrUpdateReservation(CrentalReservationTO reservation)
您可能更改了 class 而不是重新编译所有相关的 classes。
我的 Spring MVC 网络应用程序出现以下错误。
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;
我在本地服务器上执行代码时没有问题。但是当代码部署到QA服务器时,我得到了上面的错误。
错误中指定的方法是:
public void saveOrUpdateReservation(CrentalReservationTO reservation) throws CrentalException
{
crentalReservationDao.saveOrUpdateReservation(reservation);
}
而 CrentalReservationTO
是:
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;
}
默认构造函数是在我开始收到错误后添加的,但它没有解决问题。
您发布的方法签名是
void saveOrUpdateReservation(CrentalReservationTO reservation)
但是从异常信息来看
saveOrUpdateReservation(Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;)
Lcom/smartwcm/commons/reservation/to/CrentalReservationTO;
您的代码正在调用
CrentalReservationTO saveOrUpdateReservation(CrentalReservationTO reservation)
您可能更改了 class 而不是重新编译所有相关的 classes。