|
|
This topic provides an example of how to use a startup properties file to register RMI implementations at startup. (The RMI Hello World example registers the RMI implementations by means of ServerImpl.java
in a different way.)
Here, we show how to specify the startup file in the server.xml
file by means of the FILE element so that buildjavaserver
can package the properties file in the JAR. Note that the ARCHIVE element in the XML file is optional, as the JAR file can also be generated by the JAR tool as a separate step outside of buildjavaserver
. We also provide some sample code to demonstrate how the startup classes mechanism is implemented in the initialize
method of the Server implementation class for RMI.
This topic includes the following sections:
<?xml version = "1.0" ?> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # SYSTEM STARTUP FILES - Examples import java.lang.reflect.*;
XML File
<!DOCTYPE M3-SERVER SYSTEM "m3.dtd">
<M3-SERVER server-descriptor-name = "rmi.ser"
server-implementation = "ServerImpl" >
<ARCHIVE name = "rmi.jar">
<CLASS name="Simp"/>
<CLASS name="Simp_WLStub"/>
<CLASS name="SimpImpl"/>
<CLASS name="SimpFactory"/>
<CLASS name="SimpFactory_WLStub"/>
<FILE name="startup.properties" prefix=""/>
</ARCHIVE>
</M3-SERVER>Properties File - startup.properties
# ------------------------------------------------
# Register a startup class by giving it a virtual name and
# supplying its full pathname.
# weblogic.system.startupClass.[virtual_name]=[full_pathname]
#
# Add arguments for the startup class
# weblogic.system.startupArgs.[virtual_name]=[space separated
# arguments]
weblogic.system.startupClass.simp=SimpFactoryImpl
#weblogic.system.startupArgs.simp=-inproc -secondServerImpl Class
import java.util.*;
import weblogic.utils.StringUtils;
import com.beasys.rmi.Startup;
public class ServerImpl extends com.beasys.Tobj.Server {
public boolean initialize(String[] argv) {
try {
Startup.main(getClass().getResourceAsStream("startup.properties"));
} catch (Exception e) {
return false;
}
return true;
}
public void release() {}
}
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|