1
第一次在這裏問一個問題,如果它太愚蠢或簡單道歉。 我正在學習CORBA,我正在寫一個簡單的客戶端服務器應用程序,使用對象和上下文綁定,但是當我試圖解析一個對象綁定時出現這個錯誤,任何人都可以給我任何想法,我做錯了什麼?:Corba NamingContextExtStub.resolve不會找到一個對象綁定我做錯了什麼?
IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown Source)
at org.omg.CosNaming._NamingContextExtStub.resolve(Unknown Source)
at MyHelloClient.main(MyHelloClient.java:60)
Server代碼:
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext rootCtx = NamingContextHelper.narrow(objRef);
nc[0] = new NameComponent("Alpha", "Context");
NamingContext alphaCtx = rootCtx.bind_new_context(nc);
nc[0] = new NameComponent("Delta", "Context");
NamingContext deltaCtx = alphaCtx.bind_new_context(nc);
nc[0] = new NameComponent("Iota", "Context");
NamingContext iotaCtx = deltaCtx.bind_new_context(nc);
nc[0] = new NameComponent("IServ", "Object");
deltaCtx.bind(nc, iServ);
客戶端代碼:
org.omg.CORBA.Object objRefClient = orb.resolve_initial_references("NameService");
rootCtx = NamingContextExtHelper.narrow(objRefClient);
NameComponent nc[] = new NameComponent[2];
nc[0] = new NameComponent("Delta", "Context");
nc[1] = new NameComponent("IServ", "Object");
org.omg.CORBA.Object objRefHello = rootCtx.resolve(nc);
看起來你已經綁定在NS爲'Alpha.Delta.IServ'的對象,而在客戶端,你試圖解決的對象之前',NS明顯無法找到NS的例外情況。 – display101