5 Replies Latest reply on Apr 11, 2006 8:43 AM by Rune Larsen

    simple stateful session bean classcast exception

    k e Newbie

      based on the trailblazer online examples, i setup a super simple stateless session bean (TestSLSB) and a stateful session bean(TestSFSB). note: using jboss 4.0.3sp1.

      they both show up in the jndi output, and the stateless works like a champ, but the stateful keeps throwing classcast exceptions on lookup?

      java.lang.ClassCastException: $Proxy70

      what is wrong, is the trailblazer example incorrect?

      import java.io.Serializable;
      
      import javax.ejb.Init;
      import javax.ejb.Local;
      import javax.ejb.Stateful;
      import org.jboss.annotation.ejb.LocalBinding;
      
      @Stateful
      @Local ({TestSFSBIF.class})
      @LocalBinding (jndiBinding="gwig/TestSFSBLocal")
      public class TestSFSB implements TestSFSBIF,Serializable
      {
       private int count = 0;
      
       public String getInfo()
       {
       count++;
       return "counter is ..."+count;
       }
      
       public int getCount(){return count;}
      
       @Init
       public void init()
       {
       count=70;
       }
      }
      


      i use this in my servlet client:
       TestSFSBIF testF = null;
       try {
       InitialContext ctx = new InitialContext();
       testF = (TestSFSBIF) ctx.lookup("gwig/TestSFSBLocal");
       }catch (Exception e) {
       ...
      


      here is my jndi snippet:
       +- gwig (class: org.jnp.interfaces.NamingContext)
       | +- TestSLSBLocal (proxy: $Proxy75 implements No ClassLoaders found for: com.gwig.ejb.TestSLSBIF (no security manager: RMI class loader disabled))
       | +- TestSFSBLocalStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
       | +- TestSFSBLocal (class: java.lang.Object)
      


      thanks.