RestartClassLoader的未命名模块

RestartClassLoader的未命名模块

本文介绍了类加载器错误-加载器org.springframework.boot.devtools.restart.classloader.RestartClassLoader的未命名模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Spring和Java整体来说还很陌生,目前正在研究API.我有这段代码可以访问MSSQL数据库,检索结果并可以可视化它,但是它不起作用.我的意思是,如果只调用该过程并可视化结果集,它将正常运行.问题是我无法使用"RatingProcedure"对象.当我尝试获取某个对象的值时,它显示以下错误:

I am quite new to Spring and Java as a whole and I am currently working on an API. I've got this code which accesses MSSQL database, retrieves the results and IS SUPPOSED TO visualize it, but it doesn't work. I mean, if I would only call the procedure and visualize the result set, it would work normally. The problem is that I can't work with the "RatingProcedure" object. When I try get some object's value, it shows me following error:

代码:

@GetMapping("/replacements/{sourceId}/workers")
    public ResponseEntity<List<PossibleReplacementResponseModel>> getReplacements(@PathVariable Integer sourceId,
            @RequestParam(required = false) Integer targetWorkerId,
            @RequestParam(required = false) Integer targetLineId,
            @RequestParam(required = false) String targetWorkplaces) {

        List<PossibleReplacementResponseModel> response = new ArrayList<>();

        // 400 Bad Request
        if ((targetLineId != null && targetWorkerId != null) || (targetWorkplaces != null && targetLineId == null))
            return ResponseEntity.badRequest().build();

        StoredProcedureQuery ratingProcedure = entityManager.createNamedStoredProcedureQuery("dcmrating");

        StoredProcedureQuery storedProcedure = ratingProcedure.setParameter("pk_target_worker", targetWorkerId)
                .setParameter("pk_target_sdl", targetLineId).setParameter("pk_target_workplaces", targetWorkplaces)
                .setParameter("pk_source_sdl", sourceId);

        List<RatingProcedure> ratings = storedProcedure.getResultList();

        for(RatingProcedure rating : ratings) {
            PossibleReplacementResponseModel responseModel = new PossibleReplacementResponseModel();
            Optional<Worker> _worker = workerRepository.findById(rating.getPersonalId());

            if(_worker.isPresent()) {
                Worker worker = _worker.get();
                responseModel.setId(worker.getId());
                responseModel.setName(worker.getFullName());
                responseModel.setSkills(findWorkersSkills(worker));
                responseModel.setPhysicalExamination(findWorkersMedicalExaminationEndDate(worker));
                responseModel.setExams(findWorkersExams(worker));
                responseModel.setRestrictions(findWorkersRestrictions(worker));
                responseModel.setRating(rating.getRating());
            }
            response.add(responseModel);
        }

        return ResponseEntity.ok(response);
    }

我甚至可能对解决方案有个想法!如此处,但是我的技能到此结束了,我也不知道应该在文件中指定什么内容.

I probably even have an idea about the solution! I probably should customize my Restart Classloader as seen in here, but there my skills end and I have no idea what I should specify in the file.

有什么想法吗?

非常感谢您.

推荐答案

java.lang.ClassCastException: class <Class_Name> cannot be cast to class <Class_Name> (<Class_Name> is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader <Class_Name> is in unnamed module of loader 'app')

这与spring dev工具包有关.如果不需要,请尝试删除该软件包.

This is related to spring dev tools package. Try removing the package if it is not required.

这篇关于类加载器错误-加载器org.springframework.boot.devtools.restart.classloader.RestartClassLoader的未命名模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:47