<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    春風博客

    春天里,百花香...

    導航

    <2007年11月>
    28293031123
    45678910
    11121314151617
    18192021222324
    2526272829301
    2345678

    統計

    公告

    MAIL: junglesong@gmail.com
    MSN: junglesong_5@hotmail.com

    Locations of visitors to this page

    常用鏈接

    留言簿(11)

    隨筆分類(224)

    隨筆檔案(126)

    個人軟件下載

    我的其它博客

    我的鄰居們

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    在Weblogic8上注冊并啟動RMI程序.

    1.做兩個類Ruler和RulerImpl.
    import java.rmi.Remote;

    public interface Ruler extends Remote {
        
    public String getLength(String str) throws java.rmi.RemoteException;
    }

    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;

    import javax.naming.Context;
    import javax.naming.InitialContext;

    public class RulerImpl extends UnicastRemoteObject implements Ruler {
        
    public RulerImpl() throws RemoteException{
            
    super();
        }


        
    public String getLength(String str) throws java.rmi.RemoteException {
                     
    // 這里用Sb是因為weblogic的1.4的jdk不認StringBuilder
            StringBuffer sb=new StringBuffer();
            sb.append(
    "String:");
            sb.append(str);
            sb.append(
    "'s length=");
            sb.append(str.length());
            
            
    return sb.toString();
        }

        
        
    public static void main(String[] args){
            
    try{
                RulerImpl rulerImpl
    =new RulerImpl();
                
                Context ctx
    =new InitialContext();
                ctx.bind(
    "StringRuler", rulerImpl);
            }

            
    catch(Exception ex){
                ex.printStackTrace();
            }

        }

    }

    2.用rmic編譯Ruler.class和RulerImpl.class 以生成樁類RulerImpl_Stub.class.
    c:>C:\jdk1.5.0_09\bin\rmic RulerImpl.

    3.將生成的RulerImpl_Stub.class以及原有的Ruler.class和RulerImpl.class拷貝到服務器的目標域中,本人機器上的是C:\bea\user_projects\domains\mydomain

    4.通過http://localhost:7001/console 進入Weblogic控制臺,并按 yourdomain->Deployment->Startup&Shutdown->Configure a New Startup Class 注冊啟動類.完畢后結果如下圖:


    5.重新啟動Server(Start Server)

    6.通過客戶端測試一下:
    import java.util.Hashtable;

    import javax.naming.Context;
    import javax.naming.InitialContext;

    public class RulerClient{
        
    public static void main(String[] args) throws Exception{
            Hashtable env
    =new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, 
    "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL,
    "t3://localhost:7001");
            
            InitialContext ctx
    =new InitialContext(env);
            
            Object o
    =ctx.lookup("StringRuler");
            Ruler ruler
    =(Ruler)o;
            System.out.println(ruler.getLength(
    "123"));
        }

    }

    測試結果為:
    String:123's length=3

    代碼下載(rmic 目錄中包括三個已生成類):
    http://www.tkk7.com/Files/sitinspring/RmiExample20071106220750.rar

    posted on 2007-11-06 22:22 sitinspring 閱讀(301) 評論(0)  編輯  收藏 所屬分類: Java基礎

    sitinspring(http://www.tkk7.com)原創,轉載請注明出處.
    主站蜘蛛池模板: aa级毛片毛片免费观看久| 综合亚洲伊人午夜网| 久草免费手机视频| 国产精品成人亚洲| 亚洲国产成人久久| 久久久无码精品亚洲日韩蜜桃| 全部免费毛片免费播放| 久久不见久久见中文字幕免费 | 五月亭亭免费高清在线| 国产精品免费视频观看拍拍| 国产AV无码专区亚洲AV麻豆丫| 亚洲大尺码专区影院| 久久精品夜色国产亚洲av| 久久久久无码专区亚洲av| 国产又大又粗又硬又长免费| 成人免费毛片视频| 国色精品卡一卡2卡3卡4卡免费| 鲁大师在线影院免费观看| 中文字幕免费在线看线人动作大片 | 亚洲制服中文字幕第一区| 亚洲综合伊人久久大杳蕉| 亚洲精品国产日韩无码AV永久免费网 | 亚洲乱码中文字幕综合234| 国产精品成人四虎免费视频| 九九九精品成人免费视频| 日本免费xxxx| 精品成在人线AV无码免费看 | 国产大片91精品免费观看男同| 岛国av无码免费无禁网站| 91成年人免费视频| 亚洲第一网站免费视频| 99久久99久久精品免费观看| 久久久久久久久久国产精品免费| 国产成人无码区免费内射一片色欲| 国产精品一区二区三区免费 | 国产亚洲精品国产| 亚洲AV无码欧洲AV无码网站| 亚洲第一福利网站| 亚洲高清视频在线播放| 亚洲日韩乱码久久久久久| 亚洲一卡2卡3卡4卡乱码 在线|