Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

EJB Local home lookup - URGENT

 
Ranch Hand
Posts: 145
  • 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 an EJB thru Local Home (in a separate jar file) from an Webapp (in a war file)?
But so far, I have no luck, the lookup keep failing!!

Is this possible to achieve at all?

thanks!
 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More details:

in the web.xml
<ejb-local-ref>
<ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>ejb.SessionEJBLocalHome</local-home>
<local>ejb.SessionEJBLocal</local>
<ejb-link>SessionEJB</ejb-link>
</ejb-local-ref>


then in the ejb-jar.xml, I have

<session>
<display-name>SessionEJB</display-name>
<ejb-name>SessionEJB</ejb-name>
<local-home>ejb.SessionEJBLocalHome</local-home>
<local>ejb.SessionEJBLocal</local>
<ejb-class>ejb.SessionEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>


the web app and ejb are in separate jaf files (war and jar, not packaged up in ear)....

When I deploy the Web App, it keeps complaining:

weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'SessionEJB' declared in the ejb-ref or ejb-local-ref 'ejb/SessionEJB' in the application module 'sessio
Test.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason why it doesn't work when you deploy war and jar separately (as opposed to deploying withinn the same ear file) is due to the way WebLogic has its classloader hierarchy. Heres a link which tells you more:

http://e-docs.bea.com/wls/docs81/programming/classloading.html#1073491

I would suggest deploying as an ear (which would contain the war and jar). In addition to resolving your problem, you may actually improve your performance as well.
 
Ernest Lee
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does classloader effect EJB lookup?
 
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 Ernest Lee:
How does classloader effect EJB lookup?


Well, for one the J2EE Specification mandates that components should only be able to access local ejbs that are packaged in the same ear. Therefore, if you want to access your local ejbs from your war then you must package them together in an ear deployment.

Most problems that people have with J2EE packaging and deployment are related directly to classloading. In fact, many problems that people have with Java in general are related to classloading. So yes, classloaders definitely play a big role in J2EE.
 
Yes, my master! Here is the tiny ad you asked for:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic