在路上

          路上有驚慌,路上有理想

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            28 Posts :: 1 Stories :: 10 Comments :: 0 Trackbacks

          首先:websphere server處于啟動狀態(tài),jndi已在服務(wù)器下配置,名稱為  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 阮步兵 閱讀(913) 評論(0)  編輯  收藏 所屬分類: Web Server

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 浦县| 嵩明县| 临湘市| 日土县| 得荣县| 阆中市| 榆林市| 明水县| 昂仁县| 尉犁县| 亳州市| 呼玛县| 明溪县| 九江县| 嘉荫县| 天台县| 锡林郭勒盟| 漳平市| 常州市| 济源市| 普陀区| 乌拉特后旗| 庆元县| 武清区| 纳雍县| 沂源县| 赞皇县| 儋州市| 周宁县| 方山县| 锦屏县| 集安市| 清新县| 桃园县| 阿城市| 博爱县| 沙坪坝区| 铜陵市| 竹山县| 张家界市| 涿州市|