mercredi 4 mars 2015

What is the cause of exception when accessing HashMultimap from JSP

I have a Spring MVC controller that adds a Guava HashMultimap to the scope/model. The JSP then reads that data structure to display a list of roles per application :


In controller :



HashMultimap<Long,Role> rolesByApp = HashMultimap.create();
//... fill the multimap
model.addAttribute("rolesByApp", rolesByApp);


In JSP :



<c:forEach items="${applications}" var="app" varStatus="s1">
<c:set var="appRoles" value="${rolesByApp.get(app.id)}"/>
<!-- for each role display a checkbox, etc. -->
</c:forEach>


I get an IllegalAccessException on the c:set line of the JSP, when trying to read from the HashMultiMap :



java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class com.google.common.collect.AbstractSetMultimap with modifiers "public volatile"


It doesn't happen all the time, maybe 3 out of 4 times on my dev machine (Mac). On the server it works fine all the time (Red Hat Linux). It used to work fine on my dev machine too, at the time I was developing it I was under Win7.


If I replace the HashMultimap<Long,Role> with a HashMap<Long, List<Role>> it also works fine.


I don't understand this error. What could be the cause ?


Aucun commentaire:

Enregistrer un commentaire