This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Classpath Problem in Client Program

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have deployed the Hello Bean in WAS successfully and i have written the client program,when compiling the client program it is giving the error that import javax.naming.*; package not found.
so where to set the classpath to import that package if any one knows tell me.
thanks in advance.
satish
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Satish ,
You need a jar file by the name jndi.jar to be in your classpath. This jar file comes along with jdk1.3. If you have an earlier version of JDk then you have to download the jndi.jar file from the sun site, set it in your classpath.
If you do not want to set it in your classpath you can use the extension mechanism and put it in the jdk..\jre\lib\ext folder.
If you had your e-mail in your profile i would have sent this jndi.jar by e-mail to you.
------------------

Mahindrakar
IBM Application Server Forum Moderator
SCJP2

[This message has been edited by Rahul Mahindrakar (edited May 05, 2001).]
 
satish kumar g
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai Rahul,
After setting the classpath to jndi.jar in jdk folder my client program got compiled.
Now i am getting a run time exception at InitialContext ctx=new InitialContext(var)it is giving the run time error while creating the InitialContext
My Client Program is like this
import java.io.*;
b.cb.samples.hello.tier2.Hello;
import java.util.*;
import javax.naming.*;
import sat.*;
public class MyHelloClient{
public static void main(String[] args){
try{
InitialContext ctx = null;
Properties env = System.getProperties();
env.put(Context.PROVIDER_URL, "iiop://localhost:900");
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
System.out.println("upto here");
ctx = new InitialContext(env);
System.out.println("upto here1");
Object homeObject = ctx.lookup("MyHello");
System.out.println("upto here2");
MyHelloHome incHome=(MyHelloHome)homeObject;
MyHello incHello=incHome.create();
String s=incHello.sayHello();
System.out.println(s);
}catch ( Exception e )
{
System.out.println(e);
}
}
}
it is printing "upto here" at the console but "upto here1" is not coming it means that the error is while creating the InitialContext.or Is there anything wrong in my client program.
So what i need to do then.
kindly help me as i strucked at this point.
satish

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Give "iiop:///localhost:9000" instead of what u are using in ur code, the default port for communication of iiop is 9000.
Cheers,
Daman
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Try and go thru this client application here
Suneel
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Suneel,
So did your client work in the end!!! Just Joking.
How is the US by the way. Guess people tend to forget.


------------------

Mahindrakar
IBM Application Server Forum Moderator
SCJP2
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic