JRun includes several command-line tools that make some tasks easier to perform. This section describes the command-line tools included with JRun. Some tools are described in more depth in other books within the documentation set. These tools and references to the other documentation are noted.
To invoke the Java-based command-line tools described in this section, you must include jrun_root/lib/jrun.jar in your Java classpath. If the tool has a shell script or executable, you must include the jrun_root/bin directory in your system path or execute the command from that directory.
The GetControlPort tool scans a range of ports and returns the first available one. GetControlPort is in the allaire.jrun.install package.
You can invoke the GetControlPort tool from the command line or from within a Java application. GetControlPort uses the following command-line syntax:
%> java [-classpath classpath] allaire.jrun.install.GetControlPort min_port max_port [output_file]
For example, to find the first open port between 51000 and 51999, use the following command:
%> java -classpath c:/jrun4/lib/jrun.jar allaire.jrun.install.GetControlPort 51000 51999
The GetControlPort class has one public method, scan. This method takes two arguments, the lower and upper limits of the range. The arguments are of type String. You can also pass in an array of strings (shown in the following example). GetControlPort returns the first open port within the range. If it encounters an error, GetControlPort returns -1.
The following code gets an open port between 51000 and 51999 in a Java class:
...
String[] portrange = new String[2];
String openport = new String;
portrange[0] = "51000";
portrange[1] = "51999";
GetControlPort gcp = new GetControlPort();
openport = gcp.scan(portrange);
out.println("The first open port between " + portrange[0] + " and " + portrange[1] + " is " + openport);
...
There are a number of ports used by JRun servers, and you must be aware of their settings and uses when administering JRun. This is especially important when adding new JRun servers. For more information about ports used by JRun, see JRun Administrator's Guide.
JRun provides a migration tool for moving JRun 3.x servers and configuration settings to JRun 4. Although you can deploy JRun 3.x J2EE modules in JRun 4 without using the migration tool, the tool exports many of the settings on which modules depend.
You can invoke the migration tool from the command line in the jrun_root/bin directory. The migrate tool uses the following command-line syntax:
%> migration jrun3.x_root
where jrun3.x_root is the root directory of a JRun 3.1 installation.
After successfully running the migration tool, open the jrun_root/migration.html file in a web browser. The migration.html page is a migration activity report that indicates what the tool successfully migrated and what it could not migrate.
For more information on using the migration tool, see Installing JRun.
The Base64 utility takes a string returns its base 64 encoded value. This encoding is used by web browsers when authenticating users with BASIC authentication. It is not a secure encoding mechanism, but is widely used for obfuscating nonsensitive data.
The Base64 utility is in the jrunx.util package. It uses the following syntax:
%> java [-classpath classpath] jrunx.util.Base64 string
%>java -classpath .;c:/jrun4/lib/jrun.jar jrunx.util.Base64 danger
This example returns the following to the standard output:
Input = 'danger'
Encoded = 'ZGFuZ2Vy' Decoded = 'danger'
The Base64 class also provides public encode and decode methods that you can invoke with an instance of the class. For more information, see the JRun Javadocs.
You use the Web Server Configuration tool to connect JRun to your external web server. The Web Server Configuration tool is implemented in the executable JAR file wsconfig.jar. It is in the jrunx.connectorinstaller package.
The Web Server Configuration tool uses the following syntax:
%> java -jar jrun_root/lib/wsconfig.jar [options]
To use a property file for options, use the following syntax:
%> java -jar jrun_root/lib/wsconfig.jar -f property-file
The property file contains tags that are equivalents of command-line options. This is commonly used by OEMs and ISVs who do not want to expose JRun to their customers.
For more information on using the Web Server Configuration tool command-line options, see Installing JRun.
The jrun command lets your start, stop, and restart JRun servers and get information about the version of JRun that you are currently running. You can use the JRun command-line tool with the jrun.exe (Windows) and jrun shell script (UNIX).
The jrun command uses the following syntax from the jrun_root/bin directory:
%> jrun [options] [server_name]
The following table describes the options:
If you specify an option, such as start or stop, but do not specify a server_name, then JRun executes that command on all JRun servers.
If you do not specify any arguments, JRun opens the JRun Launcher.
For more information on using the JRun command-line tool, see JRun Administrator's Guide.
Use the jrunsvc tool to execute command on a JRun server that is a Windows service. With this tool, you can install, remove, start, and stop the JRun server's Windows service.
To install a JRun server as a Windows service, use the following syntax from the jrun_root/bin directory:
%> jrunsvc -install jrun_server [service_name [service_display_name [service_description]]]
To remove, start or stop a JRun server that is currently a Windows service, use the following syntax from the jrun_root/bin directory:
%> jrunsvc -[remove|start|stop service_name]
The JSPC tool compiles Java files. You can use it to precompile JSP pages, servlets, and other Java files. JSPC uses the following syntax from the jrun_root/bin directory:
%> jspc [-w web_app_root] [-d output_directory] [-k] [-v] [JSP_pages]
The -k option instructs JSPC to continue compilation even if it encounters errors.
The -v option instructs JSPC to run in verbose mode.
JSPC uses the IBM jikes compiler when it is in the jrun_root/bin directory; otherwise it uses the Sun javac compiler.
For more information on using the JSPC command-line tool, see JRun Assembly and Deployment Guide.
JRun includes XMLScript, an XPath-based XML scripting utility that lets you execute a subset of XPath statements on XML files.
With XMLScript, you can search an XML file for an expression, and then append or substitute values in nodes, or delete a node. You can also view the resulting nodes of an XPath expression. You can save the results to a new XML file or replace the original XML file.
XMLScript is in the jrunx.xml package. It uses the following syntax:
%> java [-classpath classpath] jrunx.xml.XMLScript [-i input-file] [-o output-file] [-f script-file] -[a|d|s|v statement ...]
To use XMLScript, you must include jrun_root/lib/jrun.jar in your classpath.
%>java -classpath c:/jrun4b2/lib/jrun.jar jrunx.xml.XMLScript -i c:/jrun4b2/servers/default/server-inf/jrun.xml -s //service[@name='WebService']/attribute[@name='port']/text() 8842
You can also use the following syntax from the jrun_root/bin directory:
%> xmlscript [options]
For more information on using XMLScript, including examples see JRun Programmer's Guide.
The Java2WSDL tool generates a WSDL document for a Java interface or class that you want to use as the basis for a web service. After generating a WSDL document with Java2WSDL, you can use the WSDL2Java tool to generate the appropriate proxy and skeleton code and deployment descriptor information for the web service.
Java2WSDL is part of the org.apache.axis.wsdlgen package. The Java2WSDL tool uses the following syntax:
%> java [-classpathclasspath]org.apache.axis.wsdlgen.Java2WSDL [options]
You must include the following files in your classpath:
/lib/jrun.jar
/lib/webservices.jarYou can also use the following syntax from the jrun_root/bin directory:
%> java2wsdl [options]
For information about the Java2WSDL command-line options, see JRun Programmer's Guide.
The WSDL2Java tool generates web service proxy and skeleton code based on information in a web service WSDL document. WSDL2Java generates proxies from WSDL documents that specify RPC encoded, document literal, and document encoded SOAP encoding styles.
WSDL2Java is part of the org.apache.axis.wsdl package. The Java2WSDL tool uses the following syntax:
The WSDL2Java tool uses the following syntax:
%> java [-classpath classpath]org.apache.axis.wsdl.WSDL2Java[options]
You must include the following files in your classpath:
/lib/jrun.jar
/lib/webservices.jarYou can also use the following syntax from the jrun_root/bin directory:
%> wsdl2java [options]
The WSDL2Java tool includes username and password options. You can use these when the WSDL file is protected by Basic authentication using the web server and you try to access the URL in a web browser. For example:
wsdl2java -U nickd -P password http://host/protected/file/here.wsdl
For more information about the WSDL2Java command-line options, see JRun Programmer's Guide.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/jrun/4/JRun_SDK_Guide/apis4.htm
Comments
gmarziou said on Aug 12, 2002 at 1:35 PM : deckerd26354 said on Jun 7, 2004 at 7:22 PM :