Thanks the jar is now deploying. I created a client below. However when I run the client I get the following error. I am using JBoss 4.2.
Thanks
Clinton
Error
Exception in
thread "main" java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
Class
package simplebean.client;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import simplebean.interfaces.Simple;
import simplebean.interfaces.SimpleHome;
/**
* @author owner
*
*/
public class SimpleBeanClient {
Properties properties;
public SimpleBeanClient() {
properties = new Properties();
properties.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs",
"org.jboss.naming
rg.jnp.interfaces");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("jnp.disableDiscovery", "true");
}
public static void main(String[] args) {
SimpleBeanClient beanClient = new SimpleBeanClient();
beanClient.createBean();
}
public void createBean() throws EJBException {
try {
InitialContext context = new InitialContext(properties);
Object object = context.lookup("ejb/SimpleBeanHome");
SimpleHome simpleHome = (SimpleHome) PortableRemoteObject.narrow(
object, SimpleHome.class);
Simple simple = simpleHome.create();
simple.setName("Gunter");
System.out.println(simple.getId());
System.out.println(simple.getName());
} catch (NamingException e) {
throw new EJBException(e);
} catch (RemoteException e) {
throw new EJBException(e);
} catch (CreateException e) {
throw new EJBException(e);
}
}
}