This dialog box generates a reference to an enterprise bean in a Java class
file. Once you have a reference to the bean's local or remote interface, you
can call the bean's business methods.
You open the dialog box by right-clicking in the file to which you want to
add the lookup code and choosing Enterprise Resources > Call Enterprise Bean.
The file must be located in an EJB module project or web application project.
You cannot run the comand from a .
You use the dialog box in the following way:
The top panel lists all of the enterprise beans in the currently opened
projects. If the file you ran the command on is in a free-form EJB project,
the panel only lists the enterprise beans in the same project. You cannot
call an enterprise bean in another project from a free-form EJB project.
Select the enterprise bean you want to call.
Select whether to use inline lookup code or use an existing service
locator class.
Specify whether to reference the local interface or the remote interface.
In order to reference a bean's local interface, the class that is referencing
the bean must be packaged in the same enterprise application as the enterprise
bean.
Click OK.
When you call an enterprise bean, the following occurs:
A lookup method is created in the caller class.
The enterprise bean project is added to the caller project's classpath.
A reference to the entity or session bean being called is added to the deployment
descriptor of the caller project. If and where the reference is added depends
on which of the following applies:
If the lookup is made from an enterprise bean implementation class,
the reference is added to the corresponding bean.
If the lookup is made from any class of a web application, the reference
is added to the web application.
If the lookup is made from a plain Java class of an EJB module, no reference
is added. In this case, the reference has to be added manually to the
bean calling the plain Java class.
If you are calling an enterprise bean that is in a free-form EJB module
project and you get an error that the selected bean is not specified in the
distribution archive, you have to specify the EJB module project's output.
Right-click the EJB module's project node, choose Properties, and specify
the output JAR file in the Output panel.