0 Replies Latest reply on Aug 30, 2002 6:00 AM by jason


    jason Newbie

      i am a newbie to ejb and encounter a problem when developing my first ejb example, that i follow up ed roman's master enterprise javabean. the exception is as message A.); my first simple ejb is a stateless session bean, yet i do not know why it doesn't work well. there is notthing worng on compiling and deploying stage. so i guess the problem may occurr when running client code through command line, but i am not sure the correct steps needed when running through command line. for example, what necessary jar file should be included, the ejb-jar.xml and
      jboss.xml correct format, and so on. hope anyone would tell me where i did it wrong, or simple give me suggestions such as checklist enabling me to find out my problem.
      any suggestions i appreciate.
      thank you very much

      import Hello.*;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import java.util.Properties;
      public class HelloClients{
      public static void main(String args[]) throws Exception{
      InitialContext ctx = new InitialContext();
      Object obj = ctx.lookup("Hello");
      HelloHome home = (HelloHome)
      javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
      Hello hello = home.create();
      package Hello;
      public interface HelloHome extends javax.ejb.EJBHome {
      public Hello create()
      throws java.rmi.RemoteException, javax.ejb.CreateException;
      package Hello;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;
      public class HelloBean implements SessionBean {
      private SessionContext ctx;
      public HelloBean() { }
      public void ejbCreate(){
      System.out.println("ejbCreate()! ...");
      public void ejbActivate(){
      System.out.println("ejbActivate()! ...");
      public void ejbPassivate(){
      System.out.println("ejbPassivate()! ...");
      public void ejbRemove(){
      System.out.println("ejbRemove()! ...");
      public void setSessionContext(SessionContext context){
      System.out.println("setSessionContext(...)! ...");
      this.ctx = context;
      public String hello(){
      System.out.println("hello()! ... ");
      return "hello, world";
      package Hello;
      public interface Hello extends javax.ejb.EJBObject {
      public String hello() throws java.rmi.RemoteException;

      Exception in thread "main" javax.naming.CommunicationException: Receive timed ou
      t. Root exception is java.net.SocketTimeoutException: Receive timed out
      at java.net.PlainDatagramSocketImpl.receive(Native Method)
      at java.net.DatagramSocket.receive(DatagramSocket.java:670)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:91
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:997)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:436)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at HelloClients.main(HelloClients.java:10)