1 Reply Latest reply on Oct 12, 2007 4:41 PM by Pete Muir

    IllegalAccessError: Could not instantiate Seam component

    enrokuta Newbie

      I have a stateless session bean called UploadService that handles file uploads. I was able to use it with no problems for days till I added few setters/getters and a method to scale the uploaded image.

      After login and once a reference of uploadService is encountered, an instantiation exception is thrown that is caused by " IllegalAccessError: class XYZ cannot access its superinterface com.truerunes.core.Upload"

      23:09:17,761 ERROR [STDERR] Oct 12, 2007 11:09:17 PM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/artwork.xhtml]
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: uploadService
       at org.jboss.seam.Component.newInstance(Component.java:1971)
       at org.jboss.seam.Component.getInstance(Component.java:1874)
       at org.jboss.seam.Component.getInstance(Component.java:1841)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
       at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
       at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
       at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:190)
       at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
       at org.jboss.seam.ui.renderkit.ValidateAllRendererBase.doEncodeChildren(ValidateAllRendererBase.java:33)
       at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       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.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
       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:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       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:157)
       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: java.lang.RuntimeException: by java.lang.IllegalAccessError: class org.javassist.tmp.java.lang.Object_$$_javassist_7 cannot access its superinterface com.truerunes.core.Upload
       at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:190)
       at org.jboss.seam.Component.createProxyFactory(Component.java:2261)
       at org.jboss.seam.Component.getProxyFactory(Component.java:1376)
       at org.jboss.seam.Component.wrap(Component.java:1367)
       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1289)
       at org.jboss.seam.Component.instantiate(Component.java:1274)
       at org.jboss.seam.Component.newInstance(Component.java:1967)
       ... 72 more
      Caused by: javassist.CannotCompileException: by java.lang.IllegalAccessError: class org.javassist.tmp.java.lang.Object_$$_javassist_7 cannot access its superinterface com.truerunes.core.Upload
       at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:165)
       at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:186)
       ... 78 more
      Caused by: java.lang.IllegalAccessError: class org.javassist.tmp.java.lang.Object_$$_javassist_7 cannot access its superinterface com.truerunes.core.Upload
       at java.lang.ClassLoader.defineClass1(Native Method)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
       at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:177)
       at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
      


      @Local
      interface Upload {
       byte[] getData();
       void setData(byte[] data);
       String getContentType();
       void setContentType(String contentType);
       String getFileName();
       void setFileName(String fileName);
       String getTitle();
       void setTitle(String title);
       int getSize();
       void setSize(int size);
       void upload();
      }
      


      I did not include the scale code since it is a bit verbose and might be irrelevant to the problem. However, you can find the imports used:
      import java.awt.Graphics2D;
      import java.awt.RenderingHints;
      import java.awt.Transparency;
      import java.awt.image.BufferedImage;
      import java.io.ByteArrayInputStream;
      import java.io.ByteArrayOutputStream;
      import java.io.IOException;
      import java.io.InputStream;
      import java.io.OutputStream;
      import java.util.Date;
      
      import javax.ejb.Stateless;
      import javax.imageio.ImageIO;
      import javax.persistence.EntityManager;
      
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.security.Restrict;
      import org.jboss.seam.log.Log;
      
      @Stateless
      @Name("uploadService")
      public class UploadService implements Upload {
      
       @Logger Log log;
      
       @In(create = true, value = "entityManager")
       private EntityManager em;
      
       private byte[] data;
       private String contentType;
       private String fileName;
       private String title;
       private int size;
      
       // setters/getters omitted.
      
       @Restrict("#{s:hasRole('gsadmin')}")
       public void upload() {
       }
      
       private byte[] scale(){
       }
      }
      


      here is the page that references the uploadService component:
       <h:form id="registration-form" enctype="multipart/form-data">
       <span class="error"><h:messages globalOnly="true"/></span>
       <s:validateAll>
       <fieldset>
       <legend>Enter file to upload</legend>
       <div>
       <h:outputLabel for="title" value="Title"/>
       <h:inputText styleClass="input-field" id="title" required="true"
       value="#{uploadService.title}" size="40" maxlength="40"/>
       <h:message styleClass="error" for="title"/>
       </div>
       <div>
       <h:outputLabel for="artwork" value="Artwork"/>
       <s:fileUpload id="artwork" styleClass="input-field"
       data="#{uploadService.data}" accept="image/*"
       contentType="#{uploadService.contentType}"
       fileName="#{uploadService.fileName}" fileSize="#{uploadService.size}"
       size="40" maxlength="40" required="true"/>
       <h:message styleClass="error" for="artwork"/>
       </div>
       </fieldset>
      
       <div class="submit-buttons">
       <h:commandButton value="Upload"
       action="#{uploadService.upload}" id="registerButton"/>
       </div>
       </s:validateAll>
       </h:form>
      


      I tried updating from JDK 5 to JDK 6, rebuilding and removing the old deployed archive but the problem is still there.