Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting Servlets, JSP, Java Beans and EJB in J2EE 1.4 Application Server  RSS feed

 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a doubt in connecting Servlets, JSP, Java Beans, EJB. I have a project which is having all these stuffs.
Now I have two choice.

1) Using Tomcat as Web Container for Servlets and JSP
and J2EE Application Server as for EJB.
I have tried this method but it is not working. The problem is in Servlets i cannot use lookup to connect to EJB. The error which is coming is there is no specified JNDI with in this context. So my doubt is "is there any way to invoke the lookup for EJB in tomcat?"

2) The next choice i am having is using Servlets and JSP as a Web module and EJB as EJB module in J2EE Application Server. But the problem in this approach is I dont how to give those settings such as

i) whether i have to give any resource reference in EJB
ii) whether i have to give any EJB reference in Web module


So please provide a better way to solve this problem and if any links regarding this question also welcome.


Thanks
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey dude!

http://www.technicalfacilitation.com/get.php?link=naming

Can't answer your Tomcat question, but I do know that if you write a Servlet/EJB application in a J2EE application server, you won't have any lack of opinions on how to get things done.

Looking up an EJB on the same JVM as your Servlet and JSPs is easy - too easy in fact. You can simply use the EJB name on the JNDI server, and your lookups will work.

Better options are to use resource references in the web module, that then bind to a JNDI name. That way, if the EJB name changes, you only adjust a deployment descriptor, not your code.

Naming is a huge topic. Here's a great tutorial on it from my website:

http://www.technicalfacilitation.com/get.php?link=naming

Enjoy!
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that can't answer the question either because it's got nothing to do with naming per se but with getting the initial context.
That's the part that's not working properly here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!