Solved

EJB call from Silverstream to Silverstream - org.omg.CosNaming.NamingContextPackage.NotFound

Posted on 2004-08-25
4
929 Views
Last Modified: 2010-07-27
Am back with another problem!
Now it is accessing EJB from one Silverstream server to another! Ran into some problems. I have a piece of code which is:

Class NSUPProxy.java has method:

private NsupProxy(String providerURL) throws NsupLocatorException {
        this.providerURL = providerURL;
        this.nsupRemote = NsupLocator.getInstance(providerURL).getNsupService();
     }

Class NsupLocator.java has method:

public UserProfilesReaderRemoteHome getHome() throws NsupLocatorException {
        try {
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
            env.put(Context.PROVIDER_URL, providerURL);

            InitialContext initial = new InitialContext(env);

            Object objRef = initial.lookup("ejb/UserProfilesReader");
            UserProfilesReaderRemoteHome userProfilesReaderRemoteHome =
                (UserProfilesReaderRemoteHome)PortableRemoteObject.narrow(objRef,
                    UserProfilesReaderRemoteHome.class);

            return userProfilesReaderRemoteHome;
        }
        catch (ClassCastException e) {
            throw new NsupLocatorException(e.getMessage(), e);
        }
        catch (NamingException e) {
             e.printStackTrace();
            throw new NsupLocatorException(e.getMessage(), e);
        }
    }

Now i get an exception like this below. But again the wonderful thing is the code runs from my desktop (eclipse IDE) but not from silverstream. So my nsup server is up and running and the ejb name is alright. But from silverstream ??? :-((

javax.naming.NameNotFoundException.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
        at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:29)
        at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:241)
        at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:363)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:412)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:390)
        at javax.naming.InitialContext.lookup(InitialContext.java:345)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getHome(NsupLocator.java:74)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getNsupService(NsupLocator.java:113)
        at be.belgacom.mobile.ns.userprofile.client.NsupLocator.getNsupService(NsupLocator.java:57)
        at be.belgacom.mobile.ns.userprofile.client.NsupProxy.<init>(NsupProxy.java:58)
        at be.belgacom.mobile.ns.userprofile.client.NsupProxy.getInstance(NsupProxy.java:45)
        at be.belgacom.mobile.wlan.nsup.ServletNSUPTester.checkMSISDN(ServletNSUPTester.java:115)
        at be.belgacom.mobile.wlan.nsup.ServletNSUPTester.doPost(ServletNSUPTester.java:63)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.sssw.srv.busobj.AgoFilterChain.doServlet(AgoFilterChain.java:396)
        at com.sssw.srv.busobj.AgoFilterChain.doFilter(AgoFilterChain.java:182)
        at com.sssw.srv.resources.AgWarResource.service(AgWarResource.java:629)
        at com.sssw.srv.resources.AgWarURLResource.perform(AgWarURLResource.java:115)
        at com.sssw.srv.http.httpd.perform(httpd.java:5631)
        at com.sssw.srv.http.Client.processRequest(Client.java:902)
        at com.sssw.srv.http.Client.loop(Client.java:1268)
        at com.sssw.srv.http.Client.runConnection(Client.java:1484)
        at com.sssw.srv.http.Client.run(Client.java:1432)
        at java.lang.Thread.run(Thread.java:479)
0
Comment
Question by:msk_satheesh
4 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 11898731
Hi,

Look at here it may help you some extend...
http://forum.java.sun.com/thread.jsp?thread=494092&forum=136&message=2327503

And...

I was facing exactly the same StackTrace even though my problem was a bit different. For my application, everyhing worked just fine under WSAD 5.1.1, but the exception occured when running the application on WAS5 5.0.2 / AIX. Here's the description of problem:

- Constructed an InitialContext and looked up some EJBeans. Everything worked just fine.
- Constructed another InitialContext and looked up for an EJBean. Now the lookup failed, producing the StackTrace:

javax.naming.NameNotFoundException: ejb/APFCityEntity. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:48)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3535)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1566)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1526)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1226)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)

After some investigations I found out that it was the InitialContext instance which failed the lookup. When the lookup was working, asking ctx.getNameInNamespace() gave me a sensible answer: "FinTest/nodes/ayrs043/servers/APFServer". But later on, when the lookup was failing, the ctx.getNameInNamespace() answer was "FinTest/nodes/ayrs043/servers/nodeagent". The beans where deployed under APFServer and consequently was not found under the nodeagent.

I could solve the problem by always using the one InitialContext instance I had constructed in the first place, which had the correct Environment in it. So my recommendation is that if you're facing the strange NotFound exception for the JNDI lookup, check the InitialContext instance Environment first.

Hope this helps,
best of luck...

R.K
0
 

Author Comment

by:msk_satheesh
ID: 11902942
i found a solution.

I used
            env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sssw.rt.jndi.AgInitCtxFactory");
            env.put(Context.PROVIDER_URL, "sssw://qdcb204/RMI:40105");

instead of

            env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
            env.put(Context.PROVIDER_URL, "iiop://qdcb204:40105");

Looks like there is a bug in accessing EJB from one silverstream server to another using IIOP! For now the problem is solved. All points to me!
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12222250
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now