well that cannot be the case as - I have . as the first entry in my
classpath and jndi.properties is in there. and that does not explain why
giving a package to a class will make a difference.
Ana
-----Original Message-----
From: Tim Endres [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 13, 2000 4:45 PM
To: [EMAIL PROTECTED]
Subject: Re: InitialContext
Sounds like there is a jnid.properties file on the ClassPath in a
subdirectory
that is listed before the one you expect. In other worsd, your
jndi.properties
file is in 'e:\config', but there might also be one in
'e:\weblogic\classes'.
Try moving your 'e:\config' "up" the ClassPath to see if you can get it
first.
tim.
> jen I am not able to beleive what happened now!!
> I ran ur code 1st- without giving any package name - it didnt work.
> 2nd - I gave a package name and it worked!!!!
> I am not sure what the explanation is but try giving a package name to ur
> client class.
> Ana
>
> -----Original Message-----
> From: Jen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 13, 2000 3:30 PM
> To: [EMAIL PROTECTED]
> Subject: InitialContext
>
>
> Hi, I searched the bea's ejb newsgroup and know that
> you can get your jndi.properties file work.
> But I can't. Could you help?
>
> In my client if I use:
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "weblogic.jndi.WLInitialContextFactory");
> env.put(Context.PROVIDER_URL,
> "t3://myserver.com:7001");
> ctx = new InitialContext(env);
>
> It works perfectly. But I want to use jndi.properties
> so I can run my client on weblogic server without code
> change.
>
> Here is my client:
> public static void main(String[] args) {
> Context ctx = null;
> try{
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "weblogic.jndi.WLInitialContextFactory");
> env.put(Context.PROVIDER_URL,
> "t3://myserver.com:7001");
> //ctx = new InitialContext(env); // NOTE THIS
> LINE WORKS
> ctx = new InitialContext();
>
> NamingEnumeration ne = ctx.list("");
> while (ne.hasMore()) {
> NameClassPair nc =
> (NameClassPair)ne.next();
> System.out.println(nc.getName() + ": "
> + nc.getClassName());
> }
> }catch(NamingException e){
> System.out.println("*************Can't init
> context. ***********");
> e.printStackTrace();
> }
> }
>
> I compile it:
> javac -classpath .;e:\weblogic\lib\weblogicaux.jar
> test.java
>
> Then when I run it as following it gets the
> error:javax.naming.NoInitialContextException: Cannot
> instantiate class:
> weblogic.jndi.WLInitialContextFactory . Root
> exception is java.lang.ClassNotFoundException:
> weblogic/jndi/WLInitialContextFactory
>
> java -classpath
> .;e:\weblogic\lib\weblogicaux.jar;e:\weblogic\classes;e:\config
> test
>
> where I have jndi.properties under e:\config and only
> two lines:
> java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
>
> java.naming.provider.url=t3://myserver.com:7001
>
> Could you please shine light on it? Many thanks.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
STATEMENT OF CONFIDENTIALITY. The information contained in this electronic
message and any attachments to this message are intended for the exclusive
use of the addressee(s) and may contain confidential or privileged
information. If you are not the intended recipient, please notify
USPowerSolutions Corporation immediately at (617) 547-3800, or at
[EMAIL PROTECTED], and destroy all copies of this message and any
attachments.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".