ifølge sun kan man gøre følgende, men ak får en fejl:
import javax.naming.*;
Hashtable p = new Hashtable();
p.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
p.put("java.naming.provider.url", "
iiop://localhost:1050"); // default RI port is 1050
Context ctxt = new InitialContext(p);
Object result = ctxt.lookup("ejb/tester");
javax.naming.NameNotFoundException. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
naming contect package not found ??, hvor finder jeg den ?
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:368)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:417)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:395)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at client1.lavLookup.test(lavLookup.java:59)
at client_00031._0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0._jspService(_0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0.java:96)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)