0 Replies Latest reply on Apr 9, 2007 9:36 PM by patrickmadden

    Javassist object returned from Component.getInstance(

    patrickmadden

      Hi,

      I have a strange problem. I'm trying to access another Seam SFSB (SFSB1) from inside another Seam SFSB (SFSB2). I have an accessor in SFSB1 as follows:

       /**
       * @return the webTreeModel
       */
       public WebDocumentTreeModelBean getWebDocumentTreeModel()
       {
       if (this.webDocumentTreeModel == null)
       {
       Object o = Component.getInstance("webDocumentTreeModel", ScopeType.SESSION, true);
      
       if (o != null)
       {
       log.info("Component instance for webDocumentTreeModel is " + o.getClass().getName());
       this.webDocumentTreeModel = (WebDocumentTreeModelBean) o;
       }
       else
       {
       log.info("Failed to create the component webDocumentTreeModel");
       }
       }
      
       return this.webDocumentTreeModel;
       }
      


      The Component.getInstance("webDocumentTreeModel") call doesn't return null. However, when I cast it to what I think it should be I get the following error:


      java.lang.ClassCastException: org.javassist.tmp.java.lang.Object_$$_javassist_21


      My WebDocumentTreeModel local interface is defined as follows:

      import javax.ejb.Local;
      
      @Local
      public interface WebDocumentTreeModel
      {
       public void destroy();
      
      


      My SFSB is defined as follows:

      @Stateful
      @Name("webDocumentTreeModel")
      @Scope(ScopeType.SESSION)
      public class WebDocumentTreeModelBean implements WebDocumentTreeModel
      {
      ....
      }


      The other SFSB is defined in a similar fashion and was created using seam gen. The one in question was not however.

      I'm just curious if anyone knows about this or has seen this before and can give me a pointer as to what I'm doing wrong.

      I'm using Seam 1.2.1 GA and Rich Faces lastest snapshot jar with JBoss 4.0.5.GA

      Any help is greatly appreciated.

      Thanks,

      PVM