• 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

Accessing the managed bean

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have two war files in my jsf application.I would like to access the managed bean of second war file from the first war file.
Is it possible ?

Thanks in advance,

jithesh kumar
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jithesh Kumar wrote:Hello all,

I have two war files in my jsf application.I would like to access the managed bean of second war file from the first war file.
Is it possible ?

Thanks in advance,

jithesh kumar



No. For most practical purposes, each WAR is running in a separate VM and what's in one VM cannot be directly accessed by any other VM.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

thank you for responding..

is it possible if the war is in same webserver ? , if not is there any solution in jsf for the above problem..

thanks,

Jithesh
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, as far as resource management goes each webapp is totally isolated from every other webapp. In the Tomcat server, there is exactly one and only one WAR per webapp (and vice versa). In full-stack J(2)EE servers, a webapp may contain multiple WARs, but normally each WAR has its own unique classpath, so they can't share objects directly.

Webapps are supposed to be self-contained and not be looking outside themselves for code resources.

However, if you provide a web service interface (SOAP, REST or whatever) to the services of a class in a WAR, other WARs (webapps) can invoke those functionalities by making HTTP service requests.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is the following possible?

in tomcat there is an attribute called "crosscontext", which i think is used for cross context communication.
And after getting the other context, can we can pass the values of the first war to the second wars(jsp or servlet) through url

like this.../contextA/oneServlet?values=1


Thanks in advance

Jithesh


 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might find this useful: http://www.softwaresecretweapons.com/jspwiki/apachetomcat

However, do remember that anything that you put in the tomcat shared library part of the classpath MUST be thread-safe!

Incidentally, the idea of providing a common set of functionalities sharable by multiple apps was what Enterprise JavaBeans was created for. However, Tomcat doesn't have built-in EJB support. There are ways to add it, however.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic