• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI Lookup

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.)
I develope on my local machine and I am trying to lookuo a organizational unit on my machine.
I am working with windows server 2000 and active directory. I have an OU named sales. And when I run the following program:
**************************************************
import javax.naming.*;
public class JNDILookupAny
{
public static void main(String[] args) {
if (args.length !=1) {
System.err.println ("Usage: JNDILookupAny JNDIname");
System.exit(1);
}
try {
Context ic = new InitialContext();
Object o = ic.lookup(args[0]);
System.out.println(args[0]+"="+0);
}
catch (NamingException ex) {
System.err.println("Nameexcp: "+ex);
System.exit(1);
}
catch (ClassCastException ex) {
System.err.println("classcast: "+ex);
System.exit(1);
}
}
}
*************************************************
I run the program with the following parameter.
java JNDILookupAny "ou=sales". I get the following error
javax.naming.NameNotFoundException: "ou=sales"
2.) My DSN is bill.zone.com and I set up a properties file withe the follwing lines:
java.naming.factory.inirial=com.zone.bill.naming.SerialInitContextFactory
java.naming.provider.url=localhost:1099
java.naming.factory.url.pkgs=com.zone.bill.naming
is this correct?
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what i understand,
* You are under the impression that if the application in which you are doing a JNDI lookup exists on the same machine as your client is, then you can do a local lookup.
But that is not true, unless both client and server exist on same JVM you cant do a local lookup.
* And So when you are doing a remote lookup for any JNDI object then there are certain recommended places where the objects will be placed on the system.
Are you sure you are refering to that place ?
Regards,
Meka Toka
[ April 18, 2003: Message edited by: meka toka ]
 
William Rice
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MEKA, my virtual machine is running on the same machine as the client and the server.
My client where I develop is also my server and this is where the active directory exist.
I think this is what you mean when you say the JVM and JNDI service should be running on the same
client/server?
Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic