-
1. Re: @Remote still shown as
bluetrade Jul 28, 2006 7:47 PM (in response to bluetrade)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
cptnkirk Jul 28, 2006 8:41 PM (in response to bluetrade)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 Jul 28, 2006 9:29 PM (in response to bluetrade)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