I'm trying out JBoss 3.2.1 with a simple Hello SessionBean, but I get the following error when lookup the bean from my client:
javax.naming.CommunicationException. Root exception is java.io.InvalidClassException: org.jboss.proxy.Interceptor; local class incompatible: stream classdesc serialVersionUID = 4358098404672505200, local class serialVersionUID = 8774269974037850782
What does this mean?
My client code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
try {
// Get the Hello bean
Context initial = new InitialContext(env);
Object objref = initial.lookup("Hello");
HelloHome home = (HelloHome) PortableRemoteObject.narrow(objref, HelloHome.class);
Hello hello = home.create();
// Lets try the magic
System.out.println(hello.sayHello());
hello.remove();
Solved the problem:
I had both the 3.2.1 and 4.0 versions of JBoss on my machine, and had mixed their jar files in the classpath. The result is obviously different versions of the classes running on the server and the client, giving the above error...