I am trying to get a generic tree backing-bean to work. I have one generic class called ACLTree, and then an implementation of it. In my JSF document I try to access a value per #{mybackingbean.property}. But I get an ELException:
javax.el.ELException: /modules/useradmin/acl.xhtml @30,55 value="#{ACOTree.root}": java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class de.xy.jsf.beans.ACLTree with modifiers "public"
I am not very familiar with the concepts of generics and the reflection api, so maybe it's simply not possible.
stack trace:
javax.faces.FacesException: javax.el.ELException: /modules/useradmin/rights.xhtml @30,55 value="#{ACOTree.root}": java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class de.xy.jsf.beans.ACLTree with modifiers "public"
at javax.faces.component.UIData.getValue(UIData.java:580)
at org.ajax4jsf.component.UIDataAdaptorBase.getValue(UIDataAdaptorBase.java:1647)
at org.richfaces.component.UITree.createDataModel(UITree.java:679)
at org.ajax4jsf.component.UIDataAdaptorBase.getExtendedDataModel(UIDataAdaptorBase.java:621)
at org.ajax4jsf.component.UIDataAdaptorBase.setRowKey(UIDataAdaptorBase.java:339)
at org.richfaces.renderkit.TreeRendererBase.writeContent(TreeRendererBase.java:688)
at org.richfaces.renderkit.TreeRendererBase.encodeChildren(TreeRendererBase.java:629)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:200)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:195)
at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:233)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:270)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:279)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.richfaces.renderkit.TabRendererBase.encodeChildren(TabRendererBase.java:149)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:266)
at org.richfaces.renderkit.html.TabPanelRenderer.doEncodeChildren(TabPanelRenderer.java:261)
at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at cz.softeu.rewriter.RewriterFilter.doFilter(RewriterFilter.java:144)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:636)
Caused by: javax.el.ELException: /modules/useradmin/rights.xhtml @30,55 value="#{ACOTree.root}": java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class de.christianvette.boombox.jsf.beans.ACLTree with modifiers "public"
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
at javax.faces.component.UIData.getValue(UIData.java:577)
... 75 more
Caused by: java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class de.xy.jsf.beans.ACLTree with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95)
at java.lang.reflect.Method.invoke(Method.java:607)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:58)
at com.sun.el.parser.AstValue.getValue(Unknown Source)
at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
... 76 more
the generic class:
abstract class ACLTree<T>{
private static final Logger log = Logger.getLogger(ACLTree.class);
public TreeNodeImpl<NodeData> root = null;
public TreeNodeImpl<NodeData> nodes = new TreeNodeImpl<NodeData>();
public ACLTree() {
log.debug("constructor of generic class");
}
public TreeNodeImpl<NodeData> getNodes() {
return nodes;
}
public void setNodes(TreeNodeImpl<NodeData> nodes) {
this.nodes = nodes;
}
public TreeNodeImpl<NodeData> getRoot() {
log.debug("Entering getRoot()");
if(root == null) buildTree();
return root;
}
public void setRoot(TreeNodeImpl root) {
this.root = root;
}
public TreeNodeImpl createTreeNode(ACLObject item) {
}
abstract Collection<T> getData();
}
implementation:
public class ACOTree extends ACLTree<ACO>{
@Override
public Collection<ACO> getData() {
return AclManagerImpl.getInstance().getAllACOs();
}
}
I ran into this problem myself. The problem is the declaration of the abstract class must be public.
For example:
public abstract class ACLTree<T>{...}
This is because while the method of the abstract class may be public it cannot be accessed from outside its package unless the class is marked public as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With