Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using EJBs between two separate JSF applications in Glassfish 4  RSS feed

Jay Tai
Ranch Hand
Posts: 222
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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:

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!