3 Replies Latest reply on Jul 28, 2006 9:29 PM by Gavin King

    @Remote still shown as "local"

    flo thomas Newbie

      Hi,
      I annotated one of my interfaces with @Remote, and when I deploy the application, it binds it to .../classname/local - so I assume that it doesn't recognize it. It also doesn't call the constructor, which to my knowledge should be done with stateless remote beans.

      Does anyone know what could be the problem?
      I run JBoss 4.0.4 GA & Seam 1.0.0 GA

      Thanks
      Joey

        • 1. Re: @Remote still shown as
          flo thomas Newbie

          It seems to be bound anyways to "ClassName/remote" even though this is not explicitly listed. I assume this because if I specify this, I get an error that differs from the error I get when misspell something in this string.

          However, none-the-less I cannot really figure out what's going on, since I get the following error:

          javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.stateless.StatelessRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 2583299153931800023, local class serialVersionUID = -9097306519795868]
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:723)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
           at javax.naming.InitialContext.lookup(InitialContext.java:351)
           at de.myties.sample.chat.ChatTester.main(ChatTester.java:18)
          Caused by: java.io.InvalidClassException: org.jboss.ejb3.stateless.StatelessRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 2583299153931800023, local class serialVersionUID = -9097306519795868
           at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
           at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
           at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
           at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
           at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
           at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
           at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
           at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
           at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
           at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
           at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
           at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:653)
           ... 3 more
          


          My interface:
          import java.rmi.Remote;
          
          @javax.ejb.Remote
          public interface ChatServer extends Remote {
           public void sendMessage(Message msg);
           public void addClient(ChatClient client);
           public void notifyClients();
          }
          

          My class:
          
          import java.rmi.RemoteException;
          import java.rmi.server.UnicastRemoteObject;
          
          import javax.ejb.Stateless;
          import javax.persistence.EntityManager;
          
          import org.jboss.seam.annotations.In;
          import org.jboss.seam.annotations.Name;
          @Stateless
          @Name("chatServer")
          public class ChatServerImpl extends UnicastRemoteObject implements ChatServer {
          
           @In(create=true)
           EntityManager entityManager;
          
           public ChatServerImpl() throws RemoteException {
           System.out.println("Started Chat Server!");
           }
          
           public void addClient(ChatClient client) {
          
          
           }
          
           public void notifyClients() {
           System.out.println("Notifying clients");
          
           }
          
           public void sendMessage(Message msg) {
           // TODO Auto-generated method stub
          
           }
          
          }
          


          The client:
          import javax.naming.Context;
          import com.sun.corba.se.impl.javax.rmi.PortableRemoteObject;
          
          public class ChatTester {
           public static void main(String args[]) {
           try {
           Context jndiContext = getInitialContext( );
           Object ref = jndiContext.lookup("jboss-seam-myties/ChatServerImpl/remote");
           ChatServer srv = (ChatServer)javax.rmi.PortableRemoteObject.narrow(ref, ChatServer.class);
          
           srv.notifyClients();
           } catch (javax.naming.NamingException ne){ne.printStackTrace( );}
           }
          
           public static Context getInitialContext( )
           throws javax.naming.NamingException {
           Properties p = new Properties( );
           p.put(Context.INITIAL_CONTEXT_FACTORY,
           "org.jnp.interfaces.NamingContextFactory");
           p.put(Context.URL_PKG_PREFIXES,
           " org.jboss.naming:org.jnp.interfaces");
           p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
           return new javax.naming.InitialContext(p);
          
           }
          }
          


          I am not sure whether this is related to seam, but I thought so... Maybe you have any clues to this?
          Thank you very much in advance and by this time, for reading the post :)

          Joey

          • 2. Re: @Remote still shown as
            Jim Hazen Expert

            This doesn't appear to be related to Seam. From this error it looks like you have different versions of your classes on your client and server.

            You also appear to be mixing RMI, EJB 2.x and EJB 3. I suggest using pure EJB 3 with Seam. Try looking at an EJB 3 tutorial and/or an EJB 3 book (free one here: http://www.theserverside.com/tt/books/wiley/masteringEJB3/index.tss). While you may eventually get EJB 3 to recognize this code due to the annotations, it's confusing to look at.

            • 3. Re: @Remote still shown as
              Gavin King Master

              If what you mean is that *Seam* is using /local, well, that is because that is what is specified in org.jboss.seam.core.init.jndiPattern