• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with creating client in J2ee  RSS feed

 
alex mueer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vijitha Kumara
Bartender
Posts: 3973
24
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Context should start with Capital "C". It seems you have "context" instead.

Regards.
 
alex mueer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Vijitha,

Thank you so much for your help. It worked. you are great.

Thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!