Hi,
have you tried directly ie.
ctx.lookup("autoratesdsn");
instead of ctx.lookup("java:comp/env/autoratesdsn");
Error clearly says that your client is not in j2ee environment, so it
cannot use the name space java:comp
"Kesavanarayanan,
Ramesh To: [EMAIL PROTECTED]
(Cognizant)" cc: (bcc: ashwani.kalra/Polaris)
<[EMAIL PROTECTED] Subject: running client program
IZANT.COM>
Sent by: A
mailing list for
Enterprise
JavaBeans
development
<[EMAIL PROTECTED]
A.SUN.COM>
03/21/2003 01:38
PM
Please respond to
"Kesavanarayanan,
Ramesh
(Cognizant)"
Hi all,
I have WSAS 4.0.5 in my machine.
I have a java class that has a main method.
i have set the classpath to the follwoing jar files
j2ee.jar
ibmorb.jar
websphere.jar
But when I run this program from my machine, i am getting the error
saying that
javax.naming.configurationexception: name space accessor for the java: name
space has not been set.possible cause is that the user is specifying a java
: URL name in jndi context method call is not running in J2EE cleint or
server environment.
FYI i have donea dumpnamespace from my command prompt and i could see my
dns names appearing in the list.
Also when i invoke the java command , i use the following
c:\websphere\appserver\java\bin\java.exe Testdsn
This is the code I ma trying to run:
public Connection getConnection(){
try{
java.util.Hashtable parms = new
java.util.Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
parms.put(Context.PROVIDER_URL,"iiop://localhost:900");
ctx = new InitialContext(parms);
ds = (DataSource) ctx.lookup("java:comp/env/autoratesdsn
");
conn = ds.getConnection("autorates","autorates");
} catch (Exception e) {
e.printStackTrace();
}
Can anybody let me know how to run this and achive the result
Regards
Ramesh Kesavanarayanan
This e-Mail may contain proprietary and confidential information and is sent for the
intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to you, you
are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination,
copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment
other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in