处理程序处理失败;嵌套的异常是java.lang.nosuchmethoderror

yacmzcpb  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(329)

我运行本地没有bug,但我在服务器上发布它时发生错误处理程序处理失败;嵌套的异常是java.lang.nosuchmethoderror。这是我公司的旧项目。使用了spring+hibernate+struts2。此错误使我困惑了2周这是服务器异常:

<html><head><title>Apache Tomcat/5.5.20 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.golden.ex.bs.app.menber.dao.MenberDao.getComp(Ljava/lang/String;)Ljava/util/List;
    org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    com.golden.ex.framework.core.filter.FlashFilter.doFilterInternal(FlashFilter.java:30)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    com.golden.ex.framework.core.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:43)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: com.golden.ex.bs.app.menber.dao.MenberDao.getComp(Ljava/lang/String;)Ljava/util/List;
    com.restful.CompService.getCompRemote(CompService.java:39)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    com.golden.ex.framework.core.filter.FlashFilter.doFilterInternal(FlashFilter.java:30)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    com.golden.ex.framework.core.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:43)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.20</h3></body></html>

控制器:

package com.restful;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.golden.ex.bs.app.menber.dao.MenberDao;
import com.golden.ex.bs.app.menber.service.MbOptService;

@Controller
@RequestMapping("/CompService")
public class CompService 
{
    @Autowired
    private MbOptService  mboptService; 
    @Autowired
    private MenberDao        menberDao;
    @ResponseBody 
    @RequestMapping(value = "/getCompRemote" ,produces = {"text/html;charset=UTF-8"})  
    public String getCompRemote(@RequestParam("company") String test)
    {  
        String comp=test;
        System.out.println("=============进入接口==========");
        String company=comp;
        List<Map> menber =this.menberDao.getComp(company);
        if(menber==null||menber.equals(""))
        {
            return ApiResponse.buildSuccessResponse(201,"不存在公司",menber);
        }
        else
        {

            return ApiResponse.buildSuccessResponse(200,"成功",menber);

        }
    }

    @ResponseBody 
    @RequestMapping(value = "/joinCompRemote" ,produces = {"text/html;charset=UTF-8"})  
    public String joinCompRemote(@RequestParam("company") String company,@RequestParam("userid") String userid)
    {  
        System.out.println("=============进入接口==========");

        boolean check=this.mboptService.checkJoinUser(userid);
        if(check==true)
        {
            //修改,更新optemp公司代码 status 0未审核 1通过 2未通过
            this.mboptService.joinUpdate(userid,company);
        }
        else
        {
            //新增,增加一笔
            this.mboptService.joinInsert(userid,company);
        }
        return ApiResponse.buildSuccessResponse(200,"您的审核已提交,等待该公司确认");
    }
}

道:

public List<Map> getComp(String company)
{
    String sql="select HYDM,MBNAME from BS_MENBER where MBNAME like '%"+company+"%'";
    List<Map> bs=this.listSQL(sql);

    return bs;

}

我查过相关的问题,但大部分都不符合我的情况,我的ide是myeclipse 6.0和jboss4.0.5ga谢谢

jyztefdp

jyztefdp1#

我想你有不同版本的 MemberDao 在服务器上初始化,然后在本地初始化。检查你的jboss容器,你的打包jar包括“ MemberDao.java “在部署应用程序时被覆盖。也许你部署了你的“ compservice.jar “”到容器的全局库文件夹中。

相关问题