Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem with creating client in J2ee

 
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
 
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • 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
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic