jonas start [-fg | -bg | -win] [-n name]
- start a JOnAS server
jonas stop [-n name]
- stop a JOnAS server
jonas admin [-n name] [admin_options]
- administrate a JOnAS server
jonas check
- check JOnAS environment
jonas version
- print JOnAS version
This command replaces the deprecated commands EJBServer, JonasAdmin, and CheckEnv. It provides the capability to start, stop, or administrate JOnAS servers.
The outcome of this program may depend on the directory from which the command is run (existence of a jonas.properties file in the current directory). It is possible to set system properties to the program by using the JAVA_OPTS environment variable, if required. Note that setting system properties with a -D option will always take precedence over the properties described in the other jonas.properties files.
The following two scripts can be reviewed and possibly modified for assistance with problems or for obtaining additional information:
There are five different sub-commands, that depend on the first mandatory argument:
jonas
for UNIX systemsjonas.bat
for WINDOWS systems
- jonas start
- Start a new JOnAS server. The process can be run in the foreground, in the background, or in a new window. If the background option is chosen (default option), control is given back to the caller only when the server is ready. The default name is jonas. A different name can be given with the -n option.
- jonas stop
- Stop a running JOnAS server. Use the -n option if the server was given a name other than the default name.
- jonas admin
- Administrate a JOnAS server. Use the -n option if the server was given a name other than the default name. Used without any other option, this command will prompt the user for an administrative command (interactive mode). Each administrative command exists in a non-interactive mode, for use in shell scripts or bat scripts, for example. Refer to the option list for a description of each. Another way to manage JOnAS is to use the graphical tool JonasAdmin. The functionality is essentially the same for JonasAdmin as it is for jonas admin.
- jonas check
- Check the environment before running a JOnAS server.
- jonas version
- Print the current version of JOnAS.
Each option may be pertinent only for a subset of the five different sub-commands. For example, jonas check and jonas version do not accept any options.Each jonas admin option has its equivalent in the interactive mode. To enter interactive mode and access the following list of subcommands, type jonas admin [-n name] without any other argument. To exit from interactive mode, use the exit command.
- -n name
- Give a name to the JOnAS server. The default is jonas. Used for start, stop, or admin.
- -fg
- Used for start only. The server is launched in the foreground: Control is given back to the user only at the end of the process.
- -bg
- Used for start only. The server is launched in the background. Control is given back to the user only when the JOnAS server is ready. This is the default mode.
- -win
- Used for start only. The server is launched in a new window.
- -?
- Used for admin only. Prints a help with all possible options.
- -a filename
- Used for admin only. Deploys a new application described by filename inside the JOnAS Server. The application can be one of the following:
- a standard ejb-jar file. This will lead to the creation of a new EJB Container in the JOnAS Server. If the file name has a relative path, this path is relative to where the EJB server has been launched or relative to the $JONAS_ROOT/ejbjars directory for an ejb-jar file.
- a standard .war file containing a WEB Component. If the file name has a relative path, this path is relative to where the EJB server has been launched or relative to the $JONAS_ROOT/webapps directory for a war file.
- a standard .ear file containing a complete J2EE application. If the file name has a relative path, this path is relative to where the EJB server has been launched or relative to the $JONAS_ROOT/apps directory for an ear file.
- -r filename
- Used for admin only. Dynamically removes a previous -a filename command.
- -gc
- Used for admin only. Runs the garbage collector in the specified JOnAS server.
- -passivate
- Used for admin only. Passivates all entity bean instances. This affects only instances outside transaction.
- -e
- Used for admin only. Lists the properties of the specified JOnAS server.
- -j
- Used for admin only. Lists the registered JNDI names, as seen by the specified JOnAS server.
- -l
- Used for admin only. Lists the beans currently loaded by the specified JOnAS server.
- -sync
- Used for admin only. Synchronizes the entity bean instances on the current JOnAS server. Note that this affects only the instances that are not involved in a transaction.
- -debug topic
- Used for admin only. Sets the topic level to DEBUG.
- -tt timeout
- Used for admin only. Changes the default timeout for transactions. timeout is in seconds.
interactive command on-line matching command addbeans -a fileName env -e gc -gc help -? jndinames -j listbeans -l removebeans -r fileName sync -sync trace -debug topic ttimeout -tt timeout quit exit interactive mode
jonas check
jonas start -n jonas1
jonas admin -n jonas1 -a bean1.jar
jonas stop -n jonas1
jclient [options] java-class [args]
The jclient command allows the user to easily start a "heavy" java client that will be able to reach beans in remote JOnAS servers and start distributed transactions.
It is not the J2EE compliant way to run a java client which is to use to package the java client in a J2EE container client (refer to Client Packaging).
The jclient command may be deprecated in a future release.
- -cp classpath
- Add an additional classpath before running the java program.
jclient package.javaclassname args
newbean
The newbean tool helps the bean writer start developing a bean by generating skeletons for all the necessary files for making a bean. Note that this tool only creates templates of the files. These templates must then be customized and the business logic written. However, the files should be compilable.
To create these templates, type newbean and enter a set of parameters in interactive mode.
The Bean Name must start with a capital letter. Avoid the reserved names: Home, EJB, Session, Entity. This name will be used as a prefix for all filenames relative to the bean.
The Bean Type must be one of the following:
S
Session beanE
Entity beanMD
Message-Driven beanThe Session Type must be one of the following:
L
Stateless Session BeanF
Stateful Session BeanThe Persistence manager must be one of the following:
C2
Container-Managed Persistence (CMP 2.x)C
Container-Managed Persistence (CMP 1.x)B
Bean-Managed Persistence (BMP)The Bean Location must be one of the following:
R
Remote InterfacesL
Local InterfacesThe Package Name is a dot-separated string representing the package to which the bean belongs. Usually this is the same as the current directory.
The Jar Name argument is the name that will be used to build the .jar file. Do not provide the .jar extension with this argument. Typically, the last part of the package name is used.
The Primary Key class is the class representing the primary key. Only needed for entity beans. Possible values are:
S
java.lang.StringI
java.lang.IntegerO
Object (Will be chosen later)
newbean Bean Name > MyEntity Bean type S Session bean E Entity bean MD Message-Driven bean > E Persistance manager C Container B Bean > C Bean location R Remote L Local > R Package name > truc.machin Jar name > machin Primary Key class 0 S String I Integer O Object > S Creating bean MyEntity (type ECR) in package truc.machin Your bean files have been created. You can now customize them.
registry [ <port> ]
The registry tool creates and starts a remote object registry on the specified port of the current host, based on the ORB type defined in the JOnAS configuration (RMI or Jeremie).
If the port is omitted, the registry is started on port 1099 on RMI, or on port 1234 on Jeremie.
Note that, by default, the registry is collocated in the same JVM as the JOnAS Server. In this case, it is not necessary to use this tool; the registry is automatically launched.
port
- Port number.
The registry command can normally be run in the background:
registry &
on Unix, orstart registry.bat
on Windows
GenIC [ Options ] <InputFileName>
The GenIC utility generates the container classes for JOnAS from the given Enterprise Java Beans.
The InputFileName is either the file name of an ejb-jar file or the file name of an XML deployment descriptor of beans.
The GenIC utility does the following in the order listed:
- 1) generates the sources of the container classes for all the beans defined in the deployment descriptor,
- 2) compiles these classes via the java compiler,
- 3) generates stubs and skeletons for those remote objects via the rmi compiler, and
- 4) if the InputFile is an ejb-jar file, adds the generated classes in this ejb-jar file.
-d directory-invokecmd
- Specifies the root directory of the class hierarchy.
- This option can be used to specify a destination directory for the generated files.
- If the -d option is not used, the package hierarchy of the target class is ignored and the generated files are placed in the current directory.
- If the InputFile is an ejb-jar file, the generated classes are added to the ejb-jar file, unless the -noaddinjar option is set.
-javac options
- Invokes directly, in some cases, the method of the java class corresponding to the command. This is useful on Windows in the event of a CreateProcess Exception (this occurs when the command line is too long).
-javacopts options
- Specifies the java compiler name to use (javac by default).
-keepgenerated
- Specifies the options to pass to the java compiler.
-noaddinjar
- Do not immediately delete generated files.
-nocompil
- If the InputFile is an ejb-jar file, do not add the generated classes to the ejb-jar file.
-novalidation
- Do not compile the generated source files via the java and rmi compilers.
-protocols
- Remove xml validation during parsing.
-rmiopts options
- Comma-separated list of protocols (chosen within jeremie, jrmp, iiop, cmi) for which stubs should be generated. Default is
jrmp,jeremie
.-verbose
- Specifies the options to pass to the rmi compiler.
-mappernames
- Displays additional information about command execution.
- Comma-separated list of mapper names for which the container classes will be generated. Used for the JORM-based implementation of CMP 2.0. A mapper is used by JORM for accessing a given database. This list of mappers corresponds to the list of potential databases upon which the entity beans can be deployed.
GenIC -d ../../classes sb.xml
generates container classes of all the Enterprise JavaBeans defined in the sb.xml file. Classes are generated in the ../../classes directory adhering to the classes hierarchy.
GenIC sb.jar
generates container classes for all the Enterprise JavaBeans defined in the sb.jar file and adds the generated classes to this ejb-jar file.
If InputFile is an XML deployment descriptor, the classpath must include the paths of the directories in which the Enterprise Bean's classes can be found, as well as the path of the directory specified by the -d option.
If InputFile is an ejb-jar file, the classpath must include the path of the directory specified by the -d option.
JmsServer
Launches the Joram Server (ie the MOM) with its default options.
none
The JmsServer command is typically run in the background:
JmsServer &
on Unix, orstart JmsServer
on Windows.
RAConfig [ Options ] <InputFileName> [<OutputFileName>]
The RAConfig utility generates a JOnAS-specific resource adapter configuration file
(jonas-ra.xml)
from anra.xml
file (Resource adapter deployment descriptor).The InputFileName is the file name of a the resource adapter.
The OutputFileName is the file name of an output resource adapter used with the -p(required) or -u(optional).
-? or -help options-dm,-ds,-pc,-xa DriverManager, DataSource, PooledConnection, XAConnection
- Gives a summary of the options.
-j jndiname
- Specifies the rarlink value to configure, used with the -p option.
-p database properties file
- It is a mandatory option. It specifies the JNDI name of the connection factory. This name corresponds to the name of the <jndi-name> element of the <jonas-resource> element in the JOnAS-specific deployment descriptor. This name is used by the resource service for registering in JNDI the connection factory corresponding to this resource adapter.
-r rarlink
- Specifies the name of the database.properties file to process. The result of this processing will be a jonas-ra.xml file that will update the
/META-INF/jonas-ra.xml
file in the output rar.-u inputname
- Specifies the jndi name of an rar file with which to link. This option can be used when this rar file will inherit all attributes associated with the specified jndi name. If this option is specified in the
jonas-ra.xml
file, it is the only file needed in the rar, and thera.xml
file will be processed from the rarlink file.-verbose
- Specifies the name of the XML file to process. This file will update the
/META-INF/jonas-ra.xml
file in the rar. If this argument is used, it is the only argument executed.
- Verbose mode. Displays the deployment descriptor of the resource adapter on standard
System.out
.
RAConfig -j adapt_1 MyRA.rar
Generates thejonas-ra.xml
file from the ra.xml file.
After the jonas-ra.xml has been configured for the MyRA rar file
RAConfig -u jonas-ra.xml MyRA.rar
Updates/inserts thejonas-ra.xml
file into the rar file.
RAConfig -dm -p MySQL1 $JONAS_ROOT/rars/autoload/JOnAS_jdbcDM MySQL_dm
Generates thejonas-ra.xml
file from the ra.xml file of the JOnAS_jdbcDM.rar and inserts the corresponding values from the MySQL1.properties file. Thejonas-ra.xml
file is then added/updated to the MySQL_dm.rar file. This rar file can then be deployed and will replace the configured MySQL1 datasource.