Имеется приложение на spring-e
неожиданно оно стало выдавать такой стектрейс на определенный контроллер:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/ui] threw exception [Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.List]: Specified class is an interface] with root cause
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.List]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:102)
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:81)
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:101)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
at org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123)
at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:722)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
определенный контроллер это:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
@Controller
public class CandidateMenuController extends AbstractController{
@RequestMapping("/goToCandidateMenu")
public String goToCandidateMenu() {
return "candidateMenu";
}
@RequestMapping("/getAllCandidates")
public String getAllCandidates(Model model) {
model.addAttribute("candidates", candidateService.getAll());
return "candidates";
}
@RequestMapping("/findById")
public String findById(Model model, @RequestParam Integer id) {
model.addAttribute("candidate", candidateService.findById(id));
return "singleCandidate";
}
@RequestMapping("/loadCandidateById")
public String loadCandidateById(Model model, @RequestParam Integer id, @RequestParam(required=false) String message) {
model.addAttribute("candidate", candidateService.findById(id));
model.addAttribute("vacancies",vacancyService.getAll());
model.addAttribute("message",message);
return "candidateDetails";
}
@ModelAttribute(value = "vacancies")
public List<Vacancy> loadVacancies() {
return vacancyService.getAll();
}
@ModelAttribute(value = "candidateFromRequest")
public Candidate loadCandidateById(@RequestParam(required = false) Integer candidateId) {
if (candidateId!= null)
return candidateService.findById(candidateId);
return null;
}
@ModelAttribute(value = "vacanciesForCandidate")
public Set<Vacancy> vacanciesForCandidate(@RequestParam(required = false) List<Integer> vacanciesSelected,@ModelAttribute("vacancies")List<Vacancy> allVacancies ) {
if (vacanciesSelected== null)
return null;
Set<Vacancy> returnList = new HashSet<Vacancy>();
for(Integer vacancyId:vacanciesSelected){
for(Vacancy vacancy:allVacancies){
if(vacancyId.equals(vacancy.getId())){
returnList.add(vacancy);
break;
}
}
}
return returnList;
}
@RequestMapping("/findByName")
public String findByName(Model model, @RequestParam String name) {
model.addAttribute("candidates", candidateService.findByName(name));
return "candidates";
}
@RequestMapping("/saveCandidate")
public String saveCandidate(Model model,HttpServletRequest request,HttpResponse response
,@ModelAttribute("candidateFromRequest") Candidate candidateFromRequest
,@ModelAttribute("skillsIdList") Set<Skill> skills
,@ModelAttribute("vacanciesForCandidate") Set<Vacancy> vacanciesForCandidate
,RedirectAttributes redirectAttributes
)
{
// candidateFromRequest.setSkills(skills);
// candidateFromRequest.setVacancies(vacanciesForCandidate);
// for(Vacancy vacancy:vacanciesForCandidate){
// vacancy.getCandidates().add(candidateFromRequest);
// }
// candidateService.update(candidateFromRequest);
candidateService.linkWith(candidateFromRequest, vacanciesForCandidate, skills);
redirectAttributes.addAttribute("message", "Submitted Correctly");
redirectAttributes.addAttribute("id",candidateFromRequest.getId());
return "redirect:loadCandidateById";
}
// @RequestMapping("/addCandidate")
// public ModelAndView addCandidate(Model model
// ,@ModelAttribute Candidate myCandidate
// ,@ModelAttribute("skillsIdList") Set<Skill> skills
// ,@ModelAttribute("vacanciesForCandidate") Set<Vacancy> vacanciesForCandidate)
// {
// myCandidate.setSkills(skills);
// myCandidate.setVacancies(vacanciesForCandidate);
// candidateService.add(myCandidate);
// ModelAndView modelAndView = new ModelAndView("redirect:candidateMenu");
// //return "candidateMenu";
// return modelAndView;
// }
@RequestMapping("/findBySkills")
public String processSkill(Model model, @ModelAttribute SkillDTO skillDTO) {
List<Integer> skills = skillDTO.getSkills();
List<Candidate> candidates = candidateService.findBySkills(skills);
model.addAttribute("candidates", candidates);
return "candidates";
}
@RequestMapping("/loadSkillsAndGoToFindCandidates")
public String loadSkillsAndGoToFindCandidates(Model model) {
return "selectSkills";
}
@RequestMapping("/goToAddCandidate")
public String addCandidate() {
return "candidateDetailsAdd";
}
@ModelAttribute("myCandidate")
public Candidate getCandidate() {
return new Candidate();
}
@RequestMapping("/submitFormAdd")
public ModelAndView submitFormAdd(Model model
,@ModelAttribute("myCandidate") @Valid Candidate myCandidate
,BindingResult result
,@ModelAttribute("skillsIdList") Set<Skill> skills
,@ModelAttribute("vacanciesForCandidate") Set<Vacancy> vacanciesForCandidate
,RedirectAttributes redirectAttributes){
if(result.hasErrors()) {
return new ModelAndView("candidateDetailsAdd");
}
myCandidate.setDate(new Date());
candidateService.add(myCandidate);
redirectAttributes.addAttribute("message", "added Correctly");
redirectAttributes.addAttribute("id",myCandidate.getId());
ModelAndView modelAndView = new ModelAndView("redirect:loadCandidateById");
//return "candidateMenu";
return modelAndView;
// return "candidateMenu";
}
}
class SkillDTO {
private List<Integer> skills;
public List<Integer> getSkills() {
return skills;
}
public void setSkills(List<Integer> skills) {
this.skills = skills;
}
}
Если залезть в отладку и глянуть что он на самом деле не может инстанциировать, то видно "vacancies". Если сделать "vacancies" Set, то будет ругаться на "vacanciesForCandidate". И всё равно на то, что ему List не инстанциировать, хоть это и Set. В других контроллерах @ModelAttributes , которые являются List имеются и всё хорошо, да и тут всё было хорошо, до какого-то момента. Я так и не могу понять, что я мог сломать - вроде бы ничего серьезного не менял. может ошибка где-то не в контроллере?