• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic


sitaram irrinki
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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[]){
Hashtable h = new Hashtable();
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);}
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic