• 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

Using EJBs between two separate JSF applications in Glassfish 4

 
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My development environment is Netbeans 8 and GF 4.0 app server, JSF Framework (Mojara). I have two applications. Application A is a user account management app which manages user profiles and security. Application B is a user interface which provides the user application data and is what users actually log into. I want to use an EJB Remote interface in Application A to allow users to view and edit their profiles.

I can't find much in the way of detailed tuitorials on how to correctly configure EJBs between 2 applications. I've tried JNDI lookups and EJB annotations, but I keep getting the exception:



Some specific questions I have:

1) Are remote EJB interfaces deployed as part of an application sufficient to use from other applications or does a separate EJB module have to be created?
2) Is the fully qualified name of a deployed EJB the same name and package as the class name (assuming I did not change the name on deployment) in the GF server?
3) Does the glassfish-web.xml (or sun-web.xml) have to be configured with <ejb-ref> even if I'm using JNDI lookup?
4) What would be the correct JNDI name for an application deployed with the syntax <package-name><app-name>?
5) Are there any very detailed references or tutorials which explicitly cover how to use EJBs between different applications?


Any advice is really appreciated and please let me know if I need to give further details. My application code follows. Thanks in advance!

The remote service interface in application B is:



I also created an entity class and identical service interface in Application A, replacing the @Remote annotation with @Local

So the first page the displays when running Application A is a jsf page:




The bean for the clicked action is:



This is meant to capture the userName of the logged in user and return the user profile in the following form:


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic