Another javax.naming.NameNotFoundException: Name java:comp is not bound in this Context Question
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   James_Milillo
Posted On:   Tuesday, August 16, 2005 03:59 PM

I'm trying to write a unit test for a class that uses JNDI to get a connection. The class that does the look up and gives me the exception is: javax.naming.Context initial = new javax.naming.InitialContext(); javax.naming.Context ctx = (javax.naming.Context) initial.lookup("java:comp/env"); My test case attempts to set up the required parameters by doing: System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory"); System.setProperty(Context.PROVIDER_URL, "localhost:1099"); System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming&q   More>>

I'm trying to write a unit test for a class that uses JNDI to get a connection.


The class that does the look up and gives me the exception is:


javax.naming.Context initial = new javax.naming.InitialContext();

javax.naming.Context ctx = (javax.naming.Context) initial.lookup("java:comp/env");


My test case attempts to set up the required parameters by doing:


System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");


System.setProperty(Context.PROVIDER_URL, "localhost:1099");


System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming");


This gives me the error:

javax.naming.NameNotFoundException: Name java:comp is not bound in this Context


What am I missing?



Kind regards,

-Jim

   <<Less

javax.naming.NameNotFoundException: Name java:comp is not bound in this Context

Posted By:   Anonymous  
Posted On:   Wednesday, October 5, 2005 08:50 AM

I am getting the above error when i try to deploy my web application on the Apache tomcat server
Please help
About | Sitemap | Contact