在路上

          路上有驚慌,路上有理想

            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

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


          網站導航:
           
          主站蜘蛛池模板: 建阳市| 全南县| 徐闻县| 赤壁市| 潼关县| 桐梓县| 海丰县| 武功县| 峨眉山市| 乌审旗| 麻栗坡县| 革吉县| 万年县| 北辰区| 广安市| 瓦房店市| 运城市| 兴文县| 江阴市| 南岸区| 昔阳县| 伊川县| 蒲城县| 陵水| 德化县| 佛山市| 宝鸡市| 平罗县| 甘南县| 乳山市| 六枝特区| 大安市| 南阳市| 伊川县| 泰宁县| 全椒县| 丰镇市| 酒泉市| 察雅县| 高唐县| 广灵县|