0 Replies Latest reply on Sep 26, 2005 7:04 PM by Guilherme Melo e Maranhão

    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