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 and any files transmitted with it are for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.
Visit us at http://www.cognizant.com