ciao
you hato do code somethibg like this:
import addressbook.ejb.*;
import javax.ejb.*;
import java.rmi.*;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import java.util.*;
import java.net.*;
public class AddressBookClient extends java.lang.Object {
public AddressBookClient() {
Context context = null;
final String location = "java:comp/env/ejb/AddressBook";
addressbook.ejb.AddressBook addressBook = null;
Hashtable env = new Hashtable();
env.put("java.naming.provider.url", "ormi://localhost/addressbook");
env.put("java.naming.factory.initial",
"com.evermind.server.ApplicationClientInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "paolo");
try {
context = new InitialContext (env);
// paolo for remote ejb lookup context = new InitialContext();
} catch (Exception e) {
e.printStackTrace();
}
try {
System.out.println("before lookup");
Object boundObject = context.lookup(location);
System.out.println("after lookup");
// Try to convert it to an instance of AddressBook, the home
// interface for our bean.
System.out.println("before cast");
addressBook = (addressbook.ejb.AddressBook)
PortableRemoteObject.narrow(boundObject,
addressbook.ejb.AddressBook.class);
System.out.println("after cast");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args){
new AddressBookClient();
}
}
and you need a application-client.xml like this:
<?xml version="1.0"?>
<!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE
Application Client 1.2//EN"
"http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
<application-client>
<display-name>Addressbook</display-name>
<ejb-ref>
<ejb-ref-name>ejb/AddressBook</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>addressbook.ejb.AddressBook</home>
<remote>addressbook.ejb.AddressEntry</remote>
</ejb-ref>
</application-client>
put it in a meta-inf dir under the root where you run your client
ciao
Paolo
Venkata_Nallam wrote:
> Dear paola,
> I am thankful to you for your help. I need to call the EJB from
> remote machine in a STANDALONE APPLICATION, not servlets or jsp.
>
> Which class/interface files I have to copy to remove and which
> configuration xml file we have to write at remote machine.
>
> Thanking you
>
> With regards
> Venkata
begin:vcard
n:ramasso;paolo
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
fn:paolo ramasso
end:vcard