Solved

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

Posted on 2004-08-25
4
937 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Load balancing solutions 5 138
Backup / DR solution for Middleware application server 13 99
Query on Windows NLB 4 114
wild fly 8 startup error 2 74
Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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