geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saibal.kumar.gh...@in.pwc.com
Subject Problem while calling EJB3
Date Wed, 06 Jun 2007 04:37:53 GMT
Hi ,
    I have written a Stateless session bean using EJB3 specification and 
deployed the same in the Geronimo Application Server (Version  2.0 M-3).
The code for remote business interface is as follows
import javax.ejb.Remote;

@Remote

public interface IHelloWorld {
    public void printHello();
}

The Bean class is as follows

import javax.ejb.Stateless;
@Stateless(name = "IHelloWorld")
public class HelloWorldBean implements IHelloWorld {

    public void printHello()
    {
        System.out.println("Hello World");
    }
}

Now wen I am writing a standalone application (not in same JVM). I am 
getting name not found exception. The client code is as follows.


public class TestTheEjb3 {

    @EJB
    static   IHelloWorld helloworldfascade;
    public static void main(String args[])
    {

          InitialContext ic;
           try
           {
               //Setting the JNDI properties
               Properties props = new Properties();
 
               //For geronimo
 
props.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
               props.put("java.naming.security.principal","system");
               props.put("java.naming.security. credentials", "manager");
               props.put("java.naming.provider.url", "127.0.0.1:4201");
               ic=new InitialContext(props);
               System.out.println("------------->Search Fascade Lookup");
 
//helloworldfascade=(IHelloWorld)ic.lookup("com.pwcinternal.ejb3.poc.IHelloWorld");
               helloworldfascade=(IHelloWorld)ic.lookup("IHelloWorld");

                helloworldfascade.printHello();
           }
           catch(Exception ex)
           {
               ex.printStackTrace();
           }

    }
}



Please let me know how to call the same from a standalone application like 
this running on different JVM.



Thanks & Regards,
                                   Saibal 
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Saibal Kumar Ghosh | Consultant | Mail : saibal.kumar.ghosh@in.pwc.com | 
Office : 91.33.2341.3234 | Fax : +91.33.2357.3395 | Cell : 91.9433536366 | 
www.pwc.com | 
 

_________________________________________________________________
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged 
material.  Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or 
entities other than the intended recipient is prohibited.   If you 
received this in error, please contact the sender and delete the material 
from any computer.
Mime
View raw message