6 Replies Latest reply on Sep 28, 2005 4:56 AM by Kabir Khan

    How do I access a Session Bean in EJB3?

    Guilherme Melo e Maranhão Newbie

      Hi everyone,

      I've read a lot of tutorials and anything goes right!
      I am trying to access a Stateful Session Bean from my Action class (Struts).
      I am doing this with JNDI:

      InitialContext context = new InitialContext();
      Log log = (Log) context.lookup(LogFacadeRemote.class.getName());

      When I execute it, I got the message:

      javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]

      If I change my Session Bean to @Stateless, I got a diferent message:

      javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 1126421850898582900, local class serialVersionUID = -1019635950408433617]

      Is anything wrong with my code? Which annotations should I use in my client? and in my Remote interface? and in my Session Bean?
      Do I have to configure a resource, like java:comp/env/ejb? If yes, where do I have to do?

      If someone could help me, I'd be very pleased!!

      Thanks, Guilherme