[jboss-user] [JBoss Seam] - Javassist object returned from Component.getInstance(

PatrickMadden do-not-reply at jboss.com
Mon Apr 9 21:36:32 EDT 2007


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:

anonymous wrote : 
  | 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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035841#4035841

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035841



More information about the jboss-user mailing list