O'Reilly logo

Java EE 7 Development with NetBeans 8 by David R. Heffelfinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the bean from a client

Now, it's time to focus our attention on the client. For remote clients, the client project needs to use the Java Class Library project containing the remote interface; this is the reason we created a Java Class Library project earlier in the chapter and added it to the client project.

After adding the client library containing the remote interface for our session bean, we are ready to invoke our EJB method. The client code needs to obtain a reference to an instance of a class implementing the remote interface for our bean. When using NetBeans, this is very easy. We simply need to right-click on the client code (com.ensode.sessionbeanintro.Main in the application client project in our example) and go to Insert Code... ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required