需要帮助修复“ArrayIndexOutOfBoundsException”
如标题中所述,当我以Netbeans 8.2启动tomcat 7时,我将获得 arayindexoutofBoundSexception
。
我尝试使用这两个线程进行故障排除而没有任何成功:
例外似乎是由 org.springframework.asm.classreader.readclass
引起的
或 dienststercontroller.class
Caused by: java.lang.ArrayIndexOutOfBoundsException: 52264
at org.springframework.asm.ClassReader.readClass(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
[Path\DienststellenController.class]; nested exception is
java.lang.ArrayIndexOutOfBoundsException: 52264
当我使用这四行评论的项目运行时,它像符合魅力一样,没有任何例外:
@RequestMapping(value = "/query", method = RequestMethod.GET)
public ModelAndView queryGet(HttpServletRequest request) {
logger.debug("Received request to show a input form page");
List<Person> personListe = personDao.getPersonalStamm();
//List<String> ls = new ArrayList<>();
Dienststelle d = (Dienststelle) request.getSession().getAttribute("dienststelle");
if (d == null) {
d = new Dienststelle();
}
ModelAndView mv = new ModelAndView("phonebook/dienststelle/query", "dienststelle", d);
//personListe.forEach((p) -> {
// ls.add(p.getAnzeige());
//});
mv.addObject("person", personListe);
return mv;
}
进行控制器方法
@RequestMapping(value = "/query", method = RequestMethod.GET)
public ModelAndView queryGet(HttpServletRequest request) {
logger.debug("Received request to show a input form page");
List<Person> personListe = personDao.getPersonalStamm();
List<String> ls = new ArrayList<>();
Dienststelle d = (Dienststelle) request.getSession().getAttribute("dienststelle");
if (d == null) {
d = new Dienststelle();
}
ModelAndView mv = new ModelAndView("phonebook/dienststelle/query", "dienststelle", d);
personListe.forEach((p) -> {
ls.add(p.getAnzeige());
});
mv.addObject("person", ls);
return mv;
}
从DAO类
@Override
public List<Person> getPersonalStamm() {
String sql = "SELECT * FROM personalDB.personalstamm";
RowMapper<Person> rm = ParameterizedBeanPropertyRowMapper.newInstance(Person.class);
List<Person> personen = (List<Person>) getJdbcTemplate().query(sql, rm);
return personen;
}
JSP页面
<tr>
<td><label>Vorgesetzter</label></td>
<td>
<form:select path="verantwortlich" maxlength="11" >
<form:option value="0" label="-"/>
<form:options items='${person}' itemValue='name' itemLabel='name' />
</form:select>
</td>
</tr>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论