Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 961
  • Last Modified:

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

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
msk_satheesh
Asked:
msk_satheesh
1 Solution
 
rama_krishna580Commented:
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
 
msk_satheeshAuthor Commented:
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
 
Computer101Commented:
PAQed, with points refunded (250)

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now