Solved

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

Posted on 2004-08-25
4
927 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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

10 Experts available now in Live!

Get 1:1 Help Now