Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

jsp and ejb

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to access container managed bean from jsp using a java bean.
It gives me following err arsing of JSP File '/TestJSP.jsp' failed:
--------------------------------------------------------------------------------
/TestJSP.jsp(7): class 'examples.ejb20.basic.containerManaged.AccountJB' could not be loaded
probably occurred due to an error in /TestJSP.jsp line 7:
<jsp:useBean id="account" scope="request" class="examples.ejb20.basic.containerManaged.AccountJB" />
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could it be that your missing the E out of EJB
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Originally posted by jonny jinny:
I am trying to access container managed bean from jsp using a java bean.
It gives me following error parsing of JSP File '/TestJSP.jsp' failed:
--------------------------------------------------------------------------------
/TestJSP.jsp(7): class 'examples.ejb20.basic.containerManaged.AccountJB' could not be loaded
probably occurred due to an error in /TestJSP.jsp line 7:
<jsp:useBean id="account" scope="request" class="examples.ejb20.basic.containerManaged.AccountJB" />

There is a big difference between JavaBeans and Enterprise JavaBeans(EJBs).
The useBean tag is meant to be used with JavaBeans, not EJBs. There is a alot more that goes into using an EJB... acquiring an initial context, looking up the home interface, getting an EJBObject, invoking the business method, etc.
If you really want to use the useBean tag to access your EJB, then you will need to wrap it with a standard JavaBean. Some tools, such as WSAD, provide this functionality for you. Overall, abstracting the details of EJB access from the client is a good thing.
Take a look at the Business Delegate Pattern.
Since we are on the subject, it is also not advisable to directly access Entity Beans from the client.
Take a look at the Session Facade Pattern.
[ March 27, 2003: Message edited by: Chris Mathews ]
 
jonny jinny
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!!
I am doing the same.
accessing AccountJB which is a java bean who in turn accesses EJB.
 
jonny jinny
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Here is the code written in AccountJB.
Its giving the following err to me:
C:\bea\wlserver6.1\config\examples\clientclasses>java examples.ejb20.basic.conta
inerManaged.AccountJB
Unable to lookUp1
Prob in lookup
---------
CODE;

---------
(edited by Cindy to format code using [ code] and [ /code] tags without the spaces)
wht could be the prob, please help.
[ March 28, 2003: Message edited by: Cindy Glass ]
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic