• 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

JSP lookup of EJB fails

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a JSP which uses ctx.lookup("java:comp/env") to lookup an EJB which deploys without error but the lookup fails.
My question is, does the JSP have to be packaged in a WAR file INSIDE an EAR file for this to work? it is currently not packaged at all.
I am using Weblogic 6.1.
Thanks.
 
Author
Posts: 350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


My question is, does the JSP have to be packaged in a WAR file INSIDE an EAR file for this to work? it is currently not packaged at all.


No it does not have to be in an EAR file.
If you are using "java:comp" (the ENC for the web components), you also need a jndi link in you deployment descriptor. You could opt to skip java:comp and hit the jndi link directly.
 
andy sb
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Do you you have an example of this?
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will also need to package up the EJB stubs with your web app though, regardless of whether you use a WAR/EAR/etc, or atleast have them available through the classloading mechanism of your container.
Simon
 
Author
Posts: 93
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andy,
I saw your post. You might want to consider wrappering your call to the EJB inside of business delegate pattern. If you ever want to change how the business service is being invoked (like moving from a EJB to a Web-Service) you are going to have to go through every piece of code that gets that EJB and change it.
Putting the EJB call inside of a business delegate will give you the flexibility to change how the service is invoked without exposing the applications consuming the service to the implementation details.
Thanks,
John
 
andy sb
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that's a good idea to de-couple it.
Re: my problem, does anybody have an actual example I can look at?
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the actual exception that you are getting - NamingException, ClassNotFoundException, etc?
Simon
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this thread in the BEA/WebLogic forum for a link on how to define EJB references in your web.xml file.
Cheers
Simon
 
andy sb
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that. Do you know of any conversion tools that map the Sun J2EE reference implementation deployment descriptors to BEA Weblogic, or from BEA to IBM Websphere?
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not off-hand, but have you seen what tools like XDoclet can do for you? Fantastic.
Simon
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic