JOnAS Commands Reference Guide

Commands provided with JOnAS are described in this chapter.
newbean
Bean generator
registry
Java Remote Object Registry
CheckEnv
JOnAS configuration checker
EJBServer
JOnAS Server
GenIC
Container classes generator
JmsServer
JMS Server
JonasAdmin
JOnAS Administration Server
RAXml2Prop
Resource Adapter deployment tool

 

newbean

Synopsis

newbean [ beanName [ beanType [ package [ jarname [ primkey ]]]]]

Description

The newbean tool, only available on the Unix platforms, helps the bean writer to start developing a bean by generating skeletons for all the necessary files to make a bean. Note that this tool only creates templates of the files. You need anyway to customize them and to write your business logic. However, the files should be compilable.

You can just type newbean or supply 1, 2, 3, 4, or all parameters. In case of missing parameters, an interactive mode helps to supply them.

After running newbean on each bean of your package, you must make a Makefile by joining all the *.mk generated files.

The beanName is a name that must start with a capital letter. Avoid the reserved names: Home, EJB, Session, Entity. It will be used as prefix for all filenames relative to the bean.

The beanType must be one of the following:

The package is a dot separated string representing the package to which the bean belongs. Usually this looks like the current directory.

The jarname argument is the name that will be used to build the .jar file. Do not provide here the .jar extension. Usually, we take the last part of the package name.

The primkey is the class representing the primary key. Only needed for entity beans. Possible values are:

Example

newbean Person EC tests.beans.tel tel s

 

registry

Synopsis

registry  [ <port> ]

Description

The registry tool creates and starts a remote object registry on the specified port on the current host, depending 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 EJBServer. So in this case, this tools have not to be used.

Options

port
Port number.

Example

The registry command may be typically run in the background:

 

CheckEnv

Synopsis

CheckEnv  [ Options ]

Description

The CheckEnv tool verifies the JOnAS configuration coherence, and displays the content of the configuration files which are used.

Options

-help
Displays the usage of the CheckEnv command.

Example

CheckEnv

Environment

The result of this command may depend on the current directory from where it is launched.
(Existence of a jonas.properties file in the current directory, or existence of the . (dot) path in the class path).

 

EJBServer

Synopsis

EJBServer  [ Options ]

Description

Launch the JOnAS Server

Options

-D<property>=<value>
All the JOnAS properties which can be defined in the jonas.properties file, may also be set by the way of this standard -D option of the java tool.

Example

The EJBServer command may be typically run in the background:

Environment

The result of this command may depend on the current directory from where it is launched.
(Existence of a jonas.properties file in the current directory)

 

GenIC

Synopsis

GenIC  [ Options ]  <InputFileName>

Description

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 a XML deployment descriptor of beans.

The GenIC utility :

- firstly, generates the sources of the container classes for all the beans defined in the deployment descriptor,
- secondly, compiles these classes by way of the java compiler,
- thirdly, generates stubs and skeletons for those remote objects by way of the rmi compiler, and
- lastly, if the InputFile is an ejb-jar file, adds the generated classes in this ejb-jar file.

Options

-d directory
Specifies the root directory of the class hierarchy.
You can use this option 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 in the ejb-jar file, unless the -noaddinjar option is set.
-javac options
Specifies the java compiler name to use (javac by default).
-javacopts options
Specifies the options to pass to the java compiler.
-keepgenerated
Do not delete intermediate generated files.
-noaddinjar
If the InputFile is an ejb-jar file, do not add the generated classes in the ejb-jar file.
-nocompil
Do not compile the generated sources files via the java and rmi compilers.
-rmiopts options
Specifies the options to pass to the rmi compiler.
-secpropag
For generating stubs and skeletons that provide propagation of the Security context as well as the transaction context.
-verbose
Displays additional information about command execution.

Example

GenIC -d ../../classes sb.xml
generates container classes of all the Entreprise JavaBeans defined in the sb.xml file. Classes are generated in the ../../classes directory respecting the classes hirarchy.
GenIC sb.jar
generates container classes of all the Entreprise JavaBeans defined in the sb.jar file and added the generated classes in this ejb-jar file.

Environment

If InputFile is a XML deployment descriptor, the classpath must include the paths of the directories where the Enterprise Bean's classes may be found, and 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

Synopsis

JmsServer

Description

Launch the Joram Server (ie the MOM) with its default options.

Options

none

Example

The JmsServer command may be typically run in the background:

 

JonasAdmin

General Description

JonasAdmin is a tool that performs some administration tasks on a running JOnAS Server (ie EJBServer).

There are two modes to use this tool: a command mode and an interactive one.

The command JonasAdmin without argument (or with only the option -n <jonas-name>) run the tool in interactive mode.

The fonctions performed by the JonasAdmin tool are summarized in the table below:

Functionnalities Command Mode Interactive Mode
Shows the usage of the JonasAdmin command -? or -h help
Lists the types of beans currently loaded by the EJB server -l list
run the garbage collector in EJBServer -gc gc
Lists the registered JNDI names -j jndi
Lists the properties of the EJB server -e env
Dynamically creates a new JOnAS container and adds beans in it -a fileName add
Dynamically remove a JOnAS container and all its beans -r fileName remove
Identify an EJBServer -n jonasName name
Set default transaction timeout (in seconds) in EJBServer -tt timeout ttimeout
Stops the EJB server -s stop
Synchronizes entity bean instances on EJBServer -sync sync
Set trace logger device -tlog name tlog
Set trace headers -theader theader
Unset trace headers -tnoheader tnoheader
Set trace level in EJBServer -t flag1,flag2 trace
Quit JonasAdmin non applicable quit

By default (without -n <jonas-name> option), JonasAdmin access to the EJBServer whose name is jonas
(jonas.name property in jonas.properties file)

The detailed usage of this tool is provided in the following.

Synopsis

  1. JonasAdmin
  2. JonasAdmin -n jonas-name
  3. JonasAdmin  [ -n jonas-name ]  [ options ]

Description

The first, run JonasAdmin in interactive mode, on EJBServer whose name is jonas-name.

The second, run JonasAdmin in interactive mode, on EJBServer whose name is jonas-name.

The third, run JonasAdmin in command mode, the task performed depends on the selected option.

Options

addbeans <beans-file-name>
Dynamically creates a new JOnAS container.
The beans-file-name should be the name of a standard XML deployment descriptor file or an ejb-jar file.
If the file name has a relative path, this path is relative from where the EJB server has been launched or also relative to the $JONAS_ROOT/ejbjars directory in case of ejb-jar file.
env
Lists the properties of the EJB server.
gc
Run the garbage collector in the current EJBServer
help
Gives the summary of the options.
jndinames
Lists the registered JNDI names.
listbeans
Lists the beans currently loaded by the EJB server.
name
Change the default EJBServer on which the following commands will apply.
quit
Quit JonasAdmin
removebeans <beans-file-name>
Dynamically remove the JOnAS container identified by beans-file-name.
stop
Stops the EJB server.
sync
Synchronizes the entity bean instances on current EJBServer. Notice that this concerns only the instances that are not involved in a transaction.
trace <level>
Change trace filters in current EJBServer.
tlog <name>
Change trace log device to name.
name is a file name in current directory, or out for stdout
theader
Set trace header
tnoheader
Unset trace header
ttimeout <seconds>
Changes default timeout for transactions

Examples

JonasAdmin -j
Lists the JNDI names currently registered by the EJB server.
JonasAdmin -n myserver -a myfile
Make available in the EJBServer identified by the jonas.name, myserver, the EJBs indentified by the jonas.service.ejb.descriptors property in myfile file.

 

RAXml2Prop

Synopsis

RAXml2Prop  [ Options ]  <InputFileName>

Description

The RAXml2Prop utility generates a resource adapter configuration properties file from a ra.xml file (Resource adapter deployment descriptor).

The InputFileName is the file name of a XML deployment descriptor of the resource adapter.

Options

-? or -help options
Gives the summary of the options.
-j options
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 use by the resource service for registering in JNDI the connection factory corresponding to this resource adapter.
-o
Specifies the name of the generated file. If this option is not present the output is on System.out.
-verbose
verbose mode. Displays on standard System.out the deployment descriptor of the resource adapter .

Example

RAXml2Prop -o MyRA.properties -j adapt_1 ra.xml

generates the MyRA.properties file from the ra.xml file.
the property jndiname adapt_1 has been inserted in MyRA.properties file.