Hi,
I have successfully created a bean and deployed it in
J2EE server. My next step according to the head first ejb is to create a client. But when compiling the code for AdviceClient(the client) I get the following error message:
C:\projects\advice>javac AdviceClient.java
AdviceClient.java:15: cannot resolve symbol
symbol : class context
location: class AdviceClient
context ic=new InitialContext();
^
1 error
Please tell me what I am doing wrong. The following code is the code for AdviceClient.
import javax.naming.*;
import java.rmi.*;
import headfirst.*;
import javax.rmi.*;
import javax.ejb.*;
public class AdviceClient{
public static void main (
String[] args){
new AdviceClient().go();
}
public void go(){
try{
context ic=new InitialContext();
Object o=ic.lookup("Advisor");
AdviceHome home=(AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor=home.create();
System.out.println(advisor.getAdvice());
}catch (Exception ex){
ex.printStackTrace();
}
}
}
Many thanks,
Al