• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NamingException

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
I am working on developing a ticker applet which calls a servlet which will subsequently call an ejb to get the data and the applet will display it dynamically, i earlier made the stateful session bean from VAJAVA and deployed it succesfully in WAS, i first called the bean directly from the applet instead of the servlet being in the middle tier , it works perfectly well, then i built the servlet middle tier and connected to it by the applet via httptunneling , now when the servlet tries to look up the object from the jndi it gives the namenotfound exception for the bean lookup when i try to find the home, even though the code is exactly the same as it was earlier in the standlaone applet when it was running, can any body advice me as to what is the problem.I will really appreciate it,
Regards,
Daman
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The problem which you are facing is just for lookup. The way the bean has to be looked up through a Standalone client and servlet is different. So Do go through the code below..u"ll understand the diffrence.
Client -ie Your Applet Code.
Properties p=new Properties();
p.put("You know what to put here")
Context ctx=new InitialContext(p);
Object obj=ctx.lookup("JNDI Name");
Home h=(Home)portableRemoteObject.narrow(obj,Home.class);
Servlet Code - Where I think you have made a mistake.
Properties p=new Properties();
p.put("You know what to put here")
Context ctx=new InitialContext(p);
Home h=(Home)ctx.lookup("JNDI Name");
If You don't get it then post your query with your code.
Cheers..Johnson


[This message has been edited by Johnson Irudayaraj (edited February 14, 2001).]
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Johnson,
Here is what I have written in the servlets for the lookup,
Actually i am using a support class here which i am instantiating in the servlet and then calling its variable where i store the values i want.I have tried both the ProtableRemoteObject.narrow() method and also directly typecasting it back to home object as it is in the code here,,,
Hashtable hash=new Hashtable();
hash.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
hash.put(Context.PROVIDER_URL,"iiop:///localhost:9000");
Context ctx=new InitialContext(hash);
System.out.println("coming before home lookup");
TickerHome home=(TickerHome)ctx.lookup("Ticker");
System.out.println("Before lookup");
Ticker tick =home.create("shweta");
tick.connect();
Hope this will help you in understanding the problem i am facing and help me out, thanks in advance
Daman
 
Chee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Your code seems to be Ok..I hope you know when do you get a NameNotFound exception. I want to know how you r using your servlet ie by registering it with the server or just calling it through the applet. I would advise you to just run a simple servlet which lookup your bean and excecute the remote methods. If this works then everything will work.
I have invoked an EJB through servlet as well as JSP..So no problem with that.
All the best..Do let me know about your devmts
Cheers..Johnson
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,
Yes i am registering the servlet with WAS, no problem in that , only this thing is creating a problem, anyways ill try that standalone servlet thing you talked about tommorow and let you know, but i still dont think that will work, but one thing, i dont understand the behaviour, the same code is working at one place and not in another ?? Anyway ill post the reply soon and let you know what developed.
Regards,
Daman
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Johnson,
I was succesfully able to call the ejb through the servlet and the support class, somehow i had forgotten to register the ejb, ie create it in the app server, it is working fine.that is the ticker i am using for auctions i had made is now dynamically working.THanks for the help,
Regards,
Daman
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Johnson,
I was succesfully able to call the ejb through the servlet and the support class, somehow i had forgotten to register the ejb, ie create it in the app server, it is working fine.that is the ticker i am using for auctions i had made is now dynamically working.THanks for the help,
Regards,
Daman
 
Chee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Daman,
That was a really silly error..anyway you got it..Congrats..Will really help many in the future..
Cheers..Johnson
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic