i am trying to create subcontext in weblogic server using the below code
and if i try to run the same program again then it has to throw an Exception
same name not to use but it is not giving any exception.everytime it is
crating new subcontext with the same name eveythough we are not destroying
the context.why?
import javax.naming.*;
import java.rmi.*;
import java.util.*;
public class UseJndi0{
public static void main(
String args[]){
try{
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
h.put(Context.SECURITY_PRINCIPAL, "admin");//user
h.put(Context.SECURITY_CREDENTIALS, "inetadmin");
Context ic = new InitialContext(h);
System.out.println(" initial context = "+ ic);
// initialcontext is like rooot of the tree
//now let us try to create sub context ( assume subcontext as a branch)
Context subcon1 = ic.createSubcontext("inetsolv");
System.out.println("subcontext created");
}catch (Exception e){System.out.println(e);}
}
}