2 Replies Latest reply on May 5, 2009 3:39 PM by Oguzhan YALCIN

    No ClassLoaders found for: org.jboss.seam.intercept.Proxy

    Andre Rodrigues Newbie

      Hello,


      I'm using Seam for my project and I'm having some troubles with it.
      I have an EJB module with my domain classes and Stateless Session Beans (Facades) packed inside an EAR with my WAR project.


      Due to some restriction, all my JSF's backing beans are JavaBeans, inside my war project. I'm using seam to inject the Facades, Stateless Session Beans, in those backing beans. The EJB module has no dependency on Seam.



      When I execute the code, the following error is happening when injecting the EJB on my backing bean:




      org.jboss.seam.InstantiationException: Could not instantiate Seam component: cadastroConcursosFacade
           at org.jboss.seam.Component.newInstance(Component.java:2066)
           at org.jboss.seam.Component.getInstance(Component.java:1948)
           at org.jboss.seam.Component.getInstance(Component.java:1910)
           at org.jboss.seam.Component.getInstance(Component.java:1904)
           at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2271)
           at org.jboss.seam.Component.getValueToInject(Component.java:2223)
           at org.jboss.seam.Component.injectAttributes(Component.java:1663)
           at org.jboss.seam.Component.inject(Component.java:1481)
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at br.gov.esaf.sgc.view.CadastroConcursoBean_$$_javassist_1.listarConcursos(CadastroConcursoBean_$$_javassist_1.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2171)
           at org.jboss.seam.Component.getInstanceFromFactory(Component.java:2003)
           at org.jboss.seam.Component.getInstance(Component.java:1938)
           at org.jboss.seam.Component.getInstance(Component.java:1910)
           at org.jboss.seam.Component.getInstance(Component.java:1904)
           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.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
           at javax.faces.component.UIData.getValue(UIData.java:582)
           at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1640)
           at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:48)
           at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:42)
           at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:122)
           at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
           at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:339)
           at org.richfaces.renderkit.AbstractTableRenderer.encodeTableStructure(AbstractTableRenderer.java:121)
           at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:206)
           at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:194)
           at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
           at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
           at javax.faces.component.UIData.encodeBegin(UIData.java:879)
           at org.ajax4jsf.component.UIDataAdaptor.encodeBegin(UIDataAdaptor.java:1220)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
           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:592)
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
           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.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:522)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           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.IdentityFilter.doFilter(IdentityFilter.java:38)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           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:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           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:51)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           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:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/jboss/seam/intercept/Proxy
           at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:190)
           at org.jboss.seam.Component.createProxyFactory(Component.java:2356)
           at org.jboss.seam.Component.getProxyFactory(Component.java:1440)
           at org.jboss.seam.Component.wrap(Component.java:1431)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1328)
           at org.jboss.seam.Component.instantiate(Component.java:1291)
           at org.jboss.seam.Component.newInstance(Component.java:2044)
           ... 107 more
      Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/jboss/seam/intercept/Proxy
           at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:165)
           at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:186)
           ... 113 more
      Caused by: java.lang.NoClassDefFoundError: org/jboss/seam/intercept/Proxy
           at java.lang.ClassLoader.defineClass1(Native Method)
           at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           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)
           ... 114 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.seam.intercept.Proxy
           at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
           at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
           at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
           at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
           ... 122 more




      When using Seam 2.0.2.SP1, this error occurs (different class thought, org.jboss.seam.Instance instead of org.jboss.seam.intercept.Proxy). But if I use the clean option in the server view in eclipse and restart JBoss, the error disappear.


      When using Seam 2.1.0.GA, this error is always occurring.
      All Seam's JARs are in the WEB-INF/lib.



      Here's my backing bean code:


      @Name("cadastroConcursoBean")
      @Scope(ScopeType.CONVERSATION)
      public class CadastroConcursoBean {
      
          private List<Concurso> concursos;
      
          private Concurso concurso;
      
          @In("cadastroConcursosFacade")
          private CadastroConcursosFacade cadastroConcursosFacade;
      
          @DataModel
          public List<Concurso> getConcursos() {
              return concursos;
          }
      
          public Concurso getConcurso() {
              return concurso;
          }
      
          @Factory(value = "concursosManter")
          public void listarConcursos() {
              concursos = cadastroConcursosFacade.consultarConcursos();
          }
      
          @Begin
          public String novoConcurso() {
              concurso = new Concurso();
      
              return Outcome.CADASTRO_CONCURSOS;
          }
      
          @Begin
          public String editarConcurso(Concurso concurso) {
              this.concurso = concurso;
      
              return Outcome.EDITAR_CONCURSOS;
          }
      
          @End(beforeRedirect = true)
          public String cadastrarConcurso() {
              cadastroConcursosFacade.cadastrarConcurso(concurso);
              return Outcome.CONCURSOS;
          }
      
          @End(beforeRedirect = true)
          public String alterarConcurso() {
              cadastroConcursosFacade.alterarConcurso(concurso);
              return Outcome.CONCURSOS;
          }
      }



      Here's my components.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
          xmlns:core="http://jboss.com/products/seam/core"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.com/products/seam/components
              http://jboss.com/products/seam/components-2.0.xsd
              http://jboss.com/products/seam/core
              http://jboss.com/products/seam/core-2.0.xsd">
      
          <core:init jndi-pattern="SGC-Ear/#{ejbName}/local" debug="true"/>
      
          <component name="cadastroConcursosFacade" auto-create="true"
              class="br.gov.esaf.sgc.facade.impl.CadastroConcursosFacadeBean" />
      </components>




      And here's my Facade (inside the EJB module):


      @Stateless
      public class CadastroConcursosFacadeBean implements CadastroConcursosFacade {
      
          /**
           * Business para concurso.
           */
          @EJB
          private ConcursoBusiness concursoBusiness;
      
          /**{@inheritDoc}*/
          @Override
          public List<Concurso> consultarConcursos() {
              return concursoBusiness.consultarConcursos();
          }
      
          /**{@inheritDoc}*/
          @Override
          public void cadastrarConcurso(Concurso concurso) {
              concursoBusiness.cadastrarConcurso(concurso);
          }
      
          /**{@inheritDoc}*/
          @Override
          public void alterarConcurso(Concurso concurso) {
              concursoBusiness.alterarConcurso(concurso);
          }
      }



      Am I missing something? Any help would be appreciated.


      Thanks in advance,


      André Rodrigues

        • 1. Re: No ClassLoaders found for: org.jboss.seam.intercept.Proxy
          Andre Rodrigues Newbie

          OK,


          After some debugging I think I've found the cause of this error.
          I have all my backing beans in the web application (java bean components). My business logic is inside EJBs in a module which has no reference to Seam whatsoever. So, the EAR class loader has no reference to Seam classes, Seam's jar are only in my web application (WEB-INF/lib).


          After some debugging, I saw that seam (2.0.2.SP1) passes an array of interfaces to the ProxyFactory class. ProxyFactory gets the ClassLoader from the first class of the array. When this first class is either Proxy or Instance, everything works fine (because it gets the WebApplication ClassLoader). When the EJB interface is the first element on the array (happens after a few restarts of JBoss), ProxyFactory the EAR ClassLoader, which, as metioned before, doesn't know about Seam, causing the error.


          In Seam 2.1.0, ProxyFactory is always getting the beanClass (as declared in components.xml) ClassLoader (see code below):


          Code from org.jboss.seam.Component method createProxyFactory:


              ProxyFactory factory = new ProxyFactory()
              {
                  @Override
                  protected ClassLoader getClassLoader()
                  {
                      return beanClass.getClassLoader();
                  }
              };
          


          Being like that, I can only inject EJBs, or declare them as seam components, when these EJBs have seam's jars in its classpath.

          • 2. Re: No ClassLoaders found for: org.jboss.seam.intercept.Proxy
            Oguzhan YALCIN Newbie

            Hi,I'm stuck with the same error. I'm using Seam 2.1 GA and have faced with the same problem. I've already defined the EJB classes as SeamComponents.  But no solution. The details can be found here.  Thx