1 Reply Latest reply on Jul 7, 2007 6:59 AM by thatrichard

    Seam 2: EL and anonymous classes

    thatrichard Newbie

      1. I'm using the Seam2 beta with JBoss 4.2 and I am having a problem with the following expression.

      Expression

      <h:commandButton id="select" value="Select" action="#{organizationEditor.select}"
       class="primary"
       rendered="#{not empty partyFinderClient and partyFinderClient.supportsSelect}"/>
      


      When the expression is evaluated it throws an IllegalAccessException (see bottom). The class is anonymous, the method is public and also overrides an abstract method. Is there a reason that i cannot access methods on an anonymous class using EL?

      2. Where can I get the source for jboss-el.jar? This lib is distributed with the source for JBoss 4.2 and Seam 2. I can't seem to find it among the JBoss projects.

      Thanks

      Richard

      PartyFinderClient
      public abstract class PartyFinderClient {
      
      
       private static final String PARTY_FINDER_CLIENT = "partyFinderClient";
      
       public static void clear() {
       Contexts.getConversationContext().set(PARTY_FINDER_CLIENT, null);
       }
      
       public void install() {
       Contexts.getConversationContext().set(PARTY_FINDER_CLIENT, this);
       }
      
       public static PartyFinderClient getInstalled() {
      
       return (PartyFinderClient) Contexts.getConversationContext(). get(PARTY_FINDER_CLIENT);
       }
      
       public abstract boolean supportsCancel();
       public abstract boolean supportsSelect();
       public abstract String cancel();
       public abstract String select(Party party);
       public abstract SearchStrategy getStrategy();
      }
      


      Typical subclass
      @Begin(flushMode=FlushModeType.MANUAL, join=true)
       public void findPersons() {
       PartyFinderClient client = PartyFinderClient.getInstalled();
       if (client == null) {
       client = new PartyFinderClient() {
      
       public String cancel() {
       return null;
       }
      
       public String select(Party person) {
       //Hack. Because this is being called from PartyFinder, the "registration" component is not being injected?
       Contexts.getConversationContext().set("person", person);
       return "/forms/party/person/identity";
       }
      
       public SearchStrategy getStrategy() {
       return new FindPersonStrategy();
       }
      
       @Override
       public boolean supportsCancel() {
       return false;
       }
      
       @Override
       public boolean supportsSelect() {
       return false;
       }
      
       };
       client.install();
       }
       find();
       }
      


      javax.faces.FacesException: javax.el.ELException: /forms/party/person/editor.xhtml @42,112 rendered="#{not empty partyFinderClient and partyFinderClient.supportsCancel()}": java.lang.IllegalAccessException: Class org.jboss.el.util.ReflectionUtil can not access a member of class com.sadalbari.mvanamibia.registration.RegistrationEditorBean$1 with modifiers "public"
       at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:373)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:880)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       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)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.el.ELException: /forms/party/person/editor.xhtml @42,112 rendered="#{not empty partyFinderClient and partyFinderClient.supportsCancel()}": java.lang.IllegalAccessException: Class org.jboss.el.util.ReflectionUtil can not access a member of class com.sadalbari.mvanamibia.registration.RegistrationEditorBean$1 with modifiers "public"
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
       at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370)
       ... 47 more
      Caused by: java.lang.IllegalAccessException: Class org.jboss.el.util.ReflectionUtil can not access a member of class com.sadalbari.mvanamibia.registration.RegistrationEditorBean$1 with modifiers "public"
       at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
       at java.lang.reflect.Method.invoke(Method.java:588)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:270)
       at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
       at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
       at org.jboss.el.parser.AstAnd.getValue(AstAnd.java:26)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       ... 48 more