Hi,
I am trying to develop a Basic EJB3 application on JBOSS 4.2 in Eclipse
I have created an EJB project in eclipse.
The following are my remote and local interfaces.
package com.test;
import javax.ejb.Local;
@Local
public interface HelloWorldLocal
{
public String getGreeting();
}
package com.test;
import javax.ejb.Remote;
@Remote
public interface HelloWorldRemote
{
public String getGreeting();
}
and my ejb implementation is
package com.test;
import javax.ejb.Stateless;
@Stateless
public class HelloWorld implements HelloWorldRemote, HelloWorldLocal {
public HelloWorld() {
// TODO Auto-generated constructor stub
}
public String getGreeting() {
// TODO Auto-generated method stub
return "First EJB People";
}
}
I have deployed this as an exploded JAR in JBoss and it runs fine.
My first question is:
What else do I have to add to this exploded jar ?
Secondly I created a stand alone client and added the above jar to its classpath
The client code is as follows
package com.testejb;
import java.io.FileInputStream; import java.util.Properties;
import javax.naming.InitialContext;
public class TestBean {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
HelloWorldRemote getMess = null;
try {
Properties props = new Properties();
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
props.setProperty("java.naming.provider.url", "localhost:1099");
InitialContext ic = new InitialContext(props);
//
getMess = (HelloWorldRemote) ic.lookup("HelloWorldRemote/remote");
System.out.println(getMess.getGreeting());
} catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}
}
}
The name of the jar is FirstEJB. I have tried the look up as FirstEJB/HelloWorldRemote/remote.
But when I run the program I get the error
javax.naming.NameNotFoundException: HelloWorldRemote not bound
If I type the lookup as HelloWorld/remote i get the error
Caused by: java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 1126421850898582900, local class serialVersionUID = -2711693270411201590