Deployment is necessary for application clients that communicate with EJB components or that use Java Web Start launch support. Java Web Start is supported for application clients and for applications that contain application clients. By default, Java Web Start is enabled in application clients and in GlassFish Server.
The Application Client Container is supported only in the GlassFish Server Full Platform Profile, not in the Web Profile.
This section addresses the following topics:
Assemble the necessary client components.
The client JAR file is created.
Assemble the EJB components that are to be accessed by the client.
The EJB JAR file is created.
Assemble the client and EJB JAR files together in an EAR.
An EAR file contains all the components of the application.
Deploy the application.
Instructions are contained in To Deploy an Application or Module.
If you are using the appclient script to run the application client, retrieve the client files.
The client JAR file contains the ties and necessary classes for the application client. In this release of GlassFish Server, the client JAR file is made up of multiple files. Use either deploy --retrieve or get-client-stubs, but not both.
If Java Web Start is enabled for the application client, use the Launch link on the Application Client Modules.
Run an application client by using the appclient script.
The appclient script is located in the as-install/bin directory.
If you are using the default server instance, the only required option is -client, which points to the client JAR file. For example:
appclient -client converterClient.jar
The -xml parameter, which specifies the location of the sun-acc.xml file, is also required if you are not using the default instance.
For more detailed information about Java Web Start, see Chapter 11, Developing Java Clients, in Oracle GlassFish Server 3.0.1 Application Development Guide.
For more detailed information about the appclient script, see appclient(1M).
The default URL format for a standalone application client module is http://host:port/module-id. For example:
To set a different URL for an application client, set the context-root subelement of the java-web-start-access element in the sun-application-client.xml file.
If the context-root or module-id is not specified during deployment, the name of the EAR or JAR file without the .ear or .jar extension is used. For an application, the relative path to the application client JAR file is also included. If the application or module is not in EAR or JAR file format, a context-root or module-id is generated. Regardless of how the context-root or module-id is determined, it is written to the server log. For details about naming, see Naming Standards.
This task applies if you want to run the application client on a system other than where the server runs.
Use the package-appclient script in the as-install/bin directory. This JAR file is created in the as-install/lib/appclient directory.
Copy the application client package JAR file to the client machine.
Extract the contents of the JAR file.
For example, in UNIX: jar xf filename.jar
If you used the package-appclient script, this file is located in the appclient/appserv/lib/appclient directory by default.
Copy the client JAR file to the client machine.
You are now ready to run the client.
For more detailed information about Java Web Start and the package-appclient script, see appclient(1M).
After application clients are downloaded, they remain on the client until they are manually removed. Use the Java Web Start control panel to discard downloaded application clients that used Java Web Start.
If you undeploy an application client, you can no longer use Java Web Start, or any other mechanism, to download that application client because it might be in an inconsistent state. If you try to launch an application client that was previously downloaded (even though the server side of the application client is no longer present), the results are unpredictable unless the application client has been written to tolerate such situations.
You can write your application client so that it detects failures in contacting server-side components, but continues running. In this case, Java Web Start can run an undeployed application client while the client is cached locally. For example, your application client can be written to detect and then recover from javax.naming.NamingException when locating a resource, or from java.rmi.RemoteException when referring to a previously-located resource that becomes inaccessible.