users@glassfish.java.net

Re: ACC and WebStart

From: Tim Quinn <tim.quinn_at_oracle.com>
Date: Tue, 27 Dec 2011 09:33:59 -0600

On Dec 26, 2011, at 5:49 PM, forums_at_java.net wrote:

> Hi,
>
> I've created an application client which utilizes java web start.
> Everything
> works fine as long as i'm not injecting dependencies to my Session
> Bean. When
> i'm trying to use the SessionBean with @EJB i get an error with web
> start
> which says "class xxx not found". It's quite clear, because the Remote
> interface is in the ejb module not in the application clients
> archive and the
> application client seems not to expose the ejb jar to the webstart
> client.
> Can anybody help me, please? How can i make the SessionBeans Remote
> interface
> available for the webstart client?

GlassFish, including the app client container, implements the Java EE
spec which says that modules (such as an app client) will have access
to any JARs in the EAR's library directory (/lib by default) as well
as any JARs listed in the module JAR's manifest Class-Path entry (and
any JARs listed in those JARs' manifests, etc.).

One reason the client might not see the EJB interface is because you
have not made the JAR containing the interface - the EJB JAR in your
case - available to the app client. If your EJB JAR is not in the /
lib directory then you could add the EJB JAR to the client manifest's
Class-Path, using the relative path within the EAR from the app client
JAR to the EJB JAR.

If you have already done this then something else is going on and we
will need to see which files are where in the EAR and what is in the
app client JAR's manifest Class-Path entry.

Also, consider placing the EJB interfaces into a separate library JAR,
not the EJB JAR. Then both the EJB JAR and the client JAR will depend
on that library JAR. This allows you to hide the EJB implementation
classes from other modules, such as the client, while still allowing
other modules to invoke methods on the beans. Most developers view
this as a cleaner design.

- Tim