1 year ago
#349728
dbuergi
Need help fixing 'ArrayIndexOutOfBoundsException'
As described in the title i get ArrayIndexOutOfBoundsException
when i start my Tomcat 7 with NetBeans 8.2.
I've tried troubleshooting with those two threads without any success:
ArrayOutOfBoundsException: asm.ClassReader.readClass(Unknown Source)
Failed to load ApplicationContext caused by ArrayIndexOutOfBoundsException in ClassReader
The exception seems to be caused by org.springframework.asm.ClassReader.readClass
or DienststellenController.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
When i run my project with those four lines commented out, it works like a charm without any exceptions:
@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;
}
Controller
@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;
}
Method from dao class
@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 page
<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>
java
arrays
spring
jsp
indexoutofboundsexception
0 Answers
Your Answer