原因:GAE中的java.lang.ClassNotFoundException:org.springframework.util.StreamUtils

原因:GAE中的java.lang.ClassNotFoundException:org.springframework.util.StreamUtils,java,spring,google-app-engine,Java,Spring,Google App Engine,我的项目在全局方面不在GAE中工作,但在本地GAE服务器中工作正常。 来自全局服务器的日志: Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils @RequestMapping(value="/getSalesInfo", method = RequestMethod.GET) public @ResponseBody String getLogin(){

我的项目在全局方面不在GAE中工作,但在本地GAE服务器中工作正常。 来自全局服务器的日志:

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}
我在调用
getLogin()
方法时看到这个异常,但是methos
setUserINN()
工作是正确的

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}

我对这个问题一无所知。请帮忙。

我不知道ant是如何在本地机器上编译的

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}
org.springframework.util.StreamUtils
只存在于
spring-core-4.0.jar中
我使用了3.1.1版本,没有这个包

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}

我是战争中的insert library v4.0,一切正常。

StreamUtils是在Spring 3.2.2中添加的。您至少需要升级到该版本的Spring才能正常工作

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}

将您的spring版本升级到至少(4.2.1.RELEASE)或最新版本,以使其正常工作

Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}

欢迎使用堆栈溢出!虽然这在理论上可以回答这个问题,但在这里包括答案的基本部分,并提供链接供参考。
Caused by: java.lang.ClassNotFoundException: org.springframework.util.StreamUtils
@RequestMapping(value="/getSalesInfo", method = RequestMethod.GET)  
    public @ResponseBody String getLogin(){
        MasterAccountInfo msi = dataMethods.getMasterAccountInfo();
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.writeValueAsString(msi);
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "failed transform";
        }
    }

    @RequestMapping(value="/setuserINN", method = RequestMethod.POST)
    public String setUserINN(@RequestParam("INN") String INN){
        Principal pr = SecurityContextHolder.getContext().getAuthentication();
        String str = pr.getName();
        dataMethods.changeUserInfo(str, INN);
        return "redirect:/myaccount";
    }
}