BEA Logo BEA WebLogic Enterprise Release 5.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic Enterprise Doc Home   |   J2EE Topics   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Using a Startup Properties File

 

This appendix 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.)

In this section, 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 File

<?xml version = "1.0" ?>

<!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

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

# SYSTEM STARTUP FILES - Examples
# ------------------------------------------------
# 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 -second

 


ServerImpl Class

import java.lang.reflect.*;
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() {}
}