在路上

          路上有驚慌,路上有理想

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            28 Posts :: 1 Stories :: 10 Comments :: 0 Trackbacks

          首先:websphere server處于啟動狀態,jndi已在服務器下配置,名稱為  mail/wfewcs/wfewcs_mailservice

          1.在需要脫離container(app未部署至websphere)進行JNDI lookup查找時,

          可以使用如下代碼(以mail session的jndi為例):

          Properties properties = new Properties();
           properties.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
                  properties.put(Context.PROVIDER_URL, "iiop://localhost:2809/");
               Context ctx=new InitialContext(properties);
               Session mail_session= (Session)ctx.lookup("mail/wfewcs/wfewcs_mailservice");

          JAR要求:wssec.jar, naming.jar, namingclient.jar, sas.jar and ecutils.jar,如果IDE為IBM RAD,則只需添加websphere運行時庫以及namingclient.jar包即可(此jar不在websphere運行時庫中)。

          2.在container中(app已部署至websphere)進行jndi lookup查找:

          比較簡單:

           Context ctx=new InitialContext();
               Session mail_session= (Session)ctx.lookup("
          mail/wfewcs/wfewcs_mailservice");


          posted on 2010-02-27 15:38 阮步兵 閱讀(903) 評論(0)  編輯  收藏 所屬分類: Web Server

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 桐城市| 科技| 财经| 额敏县| 襄城县| 肥城市| 海淀区| 和林格尔县| 左贡县| 个旧市| 德江县| 龙南县| 福安市| 鄂托克前旗| 延吉市| 昌平区| 衡阳市| 通化县| 广东省| 太原市| 花垣县| 常熟市| 驻马店市| 搜索| 延津县| 金川县| 江津市| 宿松县| 新邵县| 三门峡市| 荔波县| 涪陵区| 台北市| 连南| 辽中县| 通化县| 紫云| 周至县| 凌云县| 泰顺县| 广河县|