2 Replies Latest reply on Feb 13, 2009 2:15 AM by swd847

    binding in HTMLPanelMenu results in IllegalAccessError

    temmink

      Hello,


      I'm trying to create a dynamically created htmlPanelMenu, the binding attribute points to a method in the backing bean. Once I add the binding attribute to htmlPanelMenu tag, any link on the page(links in htmlPanelMenu but also separate commandLink) results in recursively loading the debug page. The exception that appears in the log is:
      java.lang.IllegalAccessError: tried to access class com.sun.facelets.StateWriter from class com.sun.facelets.StateWriterControl


      I have debugged the source, and checked if there was a problem with versions of jars, but previous/newer versions of the jars (jsf-facelets and seam-debug.jar) do not show any changes in the relevant classes.
      The StateWriteControl class is a seam-debug class, so I'm assuming the issue is related to Seam.


      Can anybody give me a pointer what is going wrong here? I'm using JBoss 4.2.2.GA Seam 2.1.1 GA


      page:


           <ui:define name="body">
               <h:form id="roll" styleClass="photobook">
                  <h:commandLink action="#{testClass.navigate}" >blabla</h:commandLink>
                <f:facet name="header">#{rollHome.managed ? 'Edit' : 'Add'} Roll</f:facet>
                <h:commandLink action="http://www.nu.nl" value="testLink"/>
                <rich:panelMenu  binding="#{albumList.albumsAsPanelMenu}"/>
           </h:form>
           </ui:define>
      
      
      


      code:



           public UIComponent getAlbumsAsPanelMenu(){
                HtmlPanelMenu component = new HtmlPanelMenu();
                component.setId("panelMenu");
                for(Album album: getResultList()){
                     HtmlPanelMenuGroup panelGroup = new HtmlPanelMenuGroup();
                     panelGroup.setId(album.getName());
                     panelGroup.setName(album.getName());
                     panelGroup.setLabel(album.getName());
                     for(Roll roll: album.getRolls()){
                          HtmlPanelMenuItem panelMenuItem = new HtmlPanelMenuItem();
                          panelMenuItem.setLabel(roll.getDisplayname());
                          panelMenuItem.setValue("/" + album.getId() + "/" + roll.getId() + "/");
                          panelMenuItem.setName("Roll"+ roll.getDisplayname());
                          panelGroup.getChildren().add(panelMenuItem);
                     }
                     component.getChildren().add(panelGroup);
                }
                return component;
           }
      





      Exception:



      Caused by: java.lang.IllegalAccessError: tried to access class com.sun.facelets.StateWriter from class com.sun.facelets.StateWriterControl
           at com.sun.facelets.StateWriterControl.initialize(StateWriterControl.java:18)
           at org.jboss.seam.debug.jsf.SeamDebugPhaseListener.beforePhase(SeamDebugPhaseListener.java:52)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      



        • 1. Re: binding in HTMLPanelMenu results in IllegalAccessError
          swd847

          This is a classloading issue. I think it occurs if you have facelets in the ear lib dir and seam-debug in the war lib dir, or something like that. I can't remember the exact cause put if you post your ear layout (just the locations of all the .jar libraries) I can tell you how to fix it.


          • 2. Re: binding in HTMLPanelMenu results in IllegalAccessError
            swd847

            I remember the exact cause now. seam-debug want to use the StateWriter class but it is not public, so in the seam jar they package StateWriterControl to provide a public interface for it, however if the two jars are loaded by different classloaders then the packages are not the same (even though they have the same name) and StateWriterControl is not allowed to access StateWriter. The fix is to make sure they are both loaded by the same classloader.