InfoCenter Home > 4.7.3.1: Developing a Java application thin clientInstall the Java application thin client from the WebSphere Application Client CD by selecting option "Java Application Thin Client" or "Java Application/Applet Thin Client." The Java application thin client offers access to most of the client services that are available in the J2EE application client; however, these services are not as easily accessed in the thin client as they are in the J2EE application client. The J2EE client has the advantage of performing a simple JNDI namespace lookup to access the desired service or resource. The thin client must code explicitly for each resource in the client application. For example, looking up an EJB Home requires the following code in a J2EE application client: java.lang.Object ejbHome = initialContext.lookup("java:/comp/env/ejb/MyEJBHome"); MyEJBHome = (MyEJBHome)javax.rmi.PortableRemoteObject.narrow(ejbHome, MyEJBHome.class);However, the code in a Java thin application client must be more explicit: java.lang.Object ejbHome = initialContext.lookup("the/fully/qualified/path/to/actual/home/in/namespace/MyEJBHome"); MyEJBHome = (MyEJBHome)javax.rmi.PortableRemoteObject.narrow(ejbHome, MyEJBHome.class); In this example, the J2EE application client accesses a logical name from the java:/comp namespace. The J2EE client runtime resolves that name to the physical location, and returns the reference to the client application. The thin client, on the other hand, must know the fully qualified physical location of the EJB Home in the namespace. If this location changes, the thin client application also must change the value placed on the lookup() statement. In the J2EE client, the client application is protected from these changes because it makes use of the logical name. A change might require a re-deploy of the EAR file, but the actual client application code remains the same. The Java thin application client is a traditional Java application that contains a "main" function. WebSphere's Java thin application client provides runtime support for accessing remote EJBs, and provides the implementation for various services (security, WLM, and others). This client can also access CORBA objects and CORBA based services. When using both environments in one client application, the user is responsible for understanding the differences between the EJB and CORBA programming models and for managing both environments. For instance, the CORBA programming model requires using the CORBA CosNaming name service for object resolution in a namespace while the EJB programming model requires using the JNDI name service. The client application must initialize and properly manage the use of these two naming services. Another difference applies to the EJB model. The ORB is initialized using JNDI implementation in the EJB model, and the client application is unaware that an ORB is present. The CORBA model, however, requires the client application to explicitly initialize the ORB through the ORB.init() static method. The Java application thin client provides a batch command that you can use to set the CLASSPATH and JAVA_HOME environment variables to enable the Java application thin client runtime. Set the Java application thin client environment by using the setupClient shell, located in: product_installation\AppletClient\bin\setupClient.bat (on Windows)After setting the environment variables, add your specific Java client application JAR files to the CLASSPATH and start your Java client application from this environment. See article Packaging and distributing Java clients for more information.
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|