Developing a WebLogic Full Client
Understanding the WebLogic Full Client
For WebLogic Server 10.0 and later releases, client applications need to use the wlfullclient.jar file instead of the weblogic.jar. A WebLogic full client is a Java RMI client that uses Oracle's proprietary T3 protocol to communicate with WebLogic Server, thereby leveraging the Java-to-Java model of distributed computing. For information on developing RMI applications, see Understanding WebLogic RMI. You cannot integrate clients written in languages other than Java.
Note: Although the WebLogic full client requires the largest JAR file among the various clients, it has the most features and is the best overall performer. Note that the same JAR that provides the T3 protocol support also provides IIOP support.
A WebLogic full client:
All supported DevTest releases.
N/A
Creating a basic WebLogic full client consists of the following
Listing 3-1 Simple WebLogic Full hello Clientpackage examples.rmi.hello;
import javax.naming.*; import java.util.Hashtable; /** * This client uses the remote HelloServer methods. * * @author Copyright (c) 1999-2004 by BEA Systems, Inc. All Rights Reserved. */ public class HelloClient { private final static boolean debug = true; /** * Defines the JNDI context factory. */ public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory"; int port; String host; private static void usage() { System.err.println("Usage: java examples.rmi.hello.HelloClient " + " "); System.exit(-1); } public HelloClient() {} public static void main(String[] argv) throws Exception { if (argv.length < 2) { usage(); } String host = argv[0]; int port = 0; try { port = Integer.parseInt(argv[1]); } catch (NumberFormatException nfe) { usage(); } try { InitialContext ic = getInitialContext("t3://" + host + ":" + port); Hello obj = (Hello) ic.lookup("HelloServer"); System.out.println("Successfully connected to HelloServer on " + host + " at port " + port + ": " + obj.sayHello() ); } catch (Throwable t) { t.printStackTrace(); System.exit(-1); }import weblogic.utils.Debug;import java.io.PrintStream; } private static InitialContext getInitialContext(String url) throws NamingException { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY); env.put(Context.PROVIDER_URL, url); return new InitialContext(env); } }
Creating a wlfullclient.jar File for a Client Application
Use the following steps to create a wlfullclient.jar file for a client application:
Change directories to the server/lib directory.
cd WL_HOME/server/lib
Use the following command to create wlfullclient.jar in the server/lib directory:
java -jar ../../../modules/com.bea.core.jarbuilder_X.X.X.X.jar
where X.X.X.X is the version number of the jarbuilder module in the WL_HOME/server/lib directory. For example:
java -jar ../../../modules/com.bea.core.jarbuilder_1.0.1.0.jar
You can now copy and bundle the wlfullclient.jar with client applications.
Add the wlfullclient.jar to the client application's classpath.