• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Rendering a JSF page using EJBs between separate applications

 
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like users in an application to be able to access and edit their user profiles (Application A). The problem is that the user objects (entities, dao, beans) are handled in a separate application (Application B) which is specifically for managing user accounts. Importing the java sources for App B into App A could be messy and might need configuration of the persistence unit and connection. I'm thinking it would be better to inject an EJB from App B to App A to query the user DB and return the results so a user profile form is rendered in App A.

I know how to inject EJBs within the same application, but I'm not so sure about how it's done across different applications or even if that's the most advisable way to achieve what I want. Would really appreciate some advice on whether it's better practice to inject an external EJB into App A or simply import the classes from App B and use those. Thanks in advance!

App B (User App) Dao object is:



App B Service



App B bean:




The page I would like to render in App A is something like this:

 
Saloon Keeper
Posts: 22265
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the original EJB spec was designed specifically for uses like that. It uses the Java remote method call interface.

In practice, setting all that up was cumbersome and resource-expensive, so over time, EJBs became lighter and lighter, since in many cases, they didn't need remote access like you do.

So the answer is that you implement your EJBs with remote interfaces instead of (or in addition to) local ones.

Details on remote EJBs are something better asked about in our EJB forum. There's nothing JSF-specific about them.

However, I do recommend that if you go that route that you don't host the code in a "half-stack" server like Tomcat or JeTTy. Full-stack servers such as JBoss/Wildfly, WebSphere, WebLogic, and so forth have EJB support built into them, along with the necessary remoting services. The "half-stack" servers don't, so you'd have to add stuff to the applications themselves, and on top of that, it would be duplicated in each app that needed those functions.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic