WEB开发网
开发学院软件开发Java 将 JNDI 用于 WebSphere Application Server J2EE... 阅读

将 JNDI 用于 WebSphere Application Server J2EE 瘦客户端应用程序

 2009-10-23 00:00:00 来源:WEB开发网   
核心提示: importjava.rmi.RemoteException;importjava.util.Hashtable;importjavax.ejb.CreateException;importjavax.naming.Context;importjavax.naming.InitialContex

     
      
     import 
     
     java.rmi.RemoteException; 
     
     
      
     import 
     
     java.util.Hashtable; 
     
     
      
     import 
     
     javax.ejb.CreateException; 
     
     
      
     import 
     
     javax.naming.Context; 
     
     
      
     import 
     
     javax.naming.InitialContext; 
     
     
      
     import 
     
     com.ibm.simple.*; 
     
     
      
     import 
     
     com.ibm.simple.SimpleEJBHome; 
     
     
      
     public class 
     
     ExternalCaller 
{ 
  
     
     
      
     public static void 
     
     main(String[] args) 
  { 
    
     
     
      
     try 
     
     
   { 
     Context initialContext = 
     
    new InitialContext(); 
     System.out.println( 
     
    "Calling EJB Externally"); 
     String lookupString = 
       
     
    "cell/nodes/localhost/servers/server1/ejb/com/ibm/simple/SimpleEJBHome"; 
     Object obj = 
      initialContext.lookup(lookupString); 
     SimpleEJBHome ejbHome = 
      (SimpleEJBHome) javax.rmi.PortableRemoteObject.narrow(obj,SimpleEJBHome.class); 
     SimpleEJB simpleEJB = ejbHome.create(); 
     System.out.println(simpleEJB.echoMe( 
     
    "I worked!")); 
   } 
    
     
     
      
     catch 
     
    (Exception e) 
   { 
     e.printStackTrace(); 
   } 
  } 
} 
   
    

上一页  2 3 4 5 6 7 8 9  下一页

Tags:JNDI 用于 WebSphere

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接