DevPortal

How do I use Command Line to Work With Pramati Server?


Table of Contents

How do I use Command Line to Work With Pramati Server?

Pramati Server provides a command line interface, the Pramati Server Shell, using which you can perform various Server-related tasks, such as deploying and checking status, from local and remote machines. These tasks can be performed in two modes:

How do I Start Server From command Line?

To start the Server from command line, you can use the bundled batch files which are present at <install_dir>\server\bin\. These batch files are specific to the operating system the server is installed on.

How do I Start Server From command Line on Windows?

At the command prompt to start the Server, type runServer.bat.

How do I Start Server From command Line on Linux/Unix?

At the command prompt to start the Server, type runServer.sh. This starts the Server main shell and displays the default prompt.

The following start up options are available for starting the server.

Starting Server in Verbose mode

This option starts the server in verbose mode. In the verbose mode, a comprehensive list of all the configuration properties is displayed.

> ./runserver.sh -verbose

Starting and Stopping Deployed Applications at Server Startup

Applications can be started at server startup using the -startapps option. This option starts all applications that are deployed on the server. Applications can also be configured to be started at server startup by setting the auto-start tag in pramati-j2ee-server.xml of the deployed applications to true:

<auto-start>TRUE</auto-start>
If applications are configured with the auto-start property as false, they will not be started at server startup. To start applications at server startup, the startapps option is used:
> ./runserver.sh -startapps
Similarly, to prevent starting of applications at server startup, the following command can be used. The false option below implies that no application will start, regardless of the application level settings.
> ./runserver.sh -startapps false

Disabling Shell Prompt at Server Startup

By default, when the Server is started, the shell prompt is made available for general administration. The shell can be disabled by using the -noshell option as:

> ./runserver.sh -noshell

Redirecting Output at Server Startup

Server output can be redirected at server startup using the -redirect option.

> ./runserver.sh -redirect
This enables all server output to be redirected to a file. The following two files are created in the logs directory of the started node:

Starting Server With Username and Password

Server can be started by providing a username and password at server startup by using the -user and -password options. This prompts you for the username and password at server startup.

> ./runserver.sh -user root -password

Starting Server in Realms

The server can be started in a realm by using the -realm option. This starts the server for that realm. The default realm is system.

> ./runserver.sh -realm

Performing Cleanup at Server Startup

Certain cleanup operations can be performed at server startup. For example, corrupted directories are cleaned up at the time the server starts. The -cleanupapps option does this:

>./runserver.sh -cleanupapps

Testing JDBC Resources at Server Startup

JDBC resource can be tested at server startup by using the -testJDBCResources option. If a JDBC resource test fails, an error will show up as shown below:

Error while attempting to get a Connection for the ConnectionFactory [Doc_CF]
2:52:58 PM-     Doc_CF                                              [  FAILED  ]
JDBC resources include JDBC Connection factories, Data Sources, and clustered Data Sources.
. /runserver.sh -verbose -testJDBCResources

Specifying Nodes at Server Startup

Pramati server can be configured with various nodes. Each node is an instance of the server. A particular node can be started by using the -nodedir option.

> ./runserver.sh -nodedir myNode

Synchronizing Nodes in Clusters at Server Startup

In a clustered scenario, configuration of other nodes can be synched up at server start up. This option uploads the configuration of the node to the database.

> ./runserver.sh -uploadconfig

What is the Default Server Prompt?

The Default Shell is attached depending on the type of node. For example, for a Message Server, the JMS Shell is attached, and for a J2EE server, the J2EE shell is attached by default.

The j2eeadmin@default:> prompt indicates that you are attached to the J2EE Shell, and connected to the default Server node.

How do I Connect to Remote Server?

Run remoteshell.bat or remoteshell.sh located at <install_dir>\server\bin\. These files can be run to connect to a Server instance running on a different machine. The command must be executed from <install-dir>\server. The shell opens with the prompt:

not connected:>

This indicates that the shell is currently not connected to any server. To connect it interactively to a server, use the command: connect <enter>

This prompts you for entering the following parameters:

ipaddress[localhost]:
naming port[9191]:
realm [system]:
user name[root]:
password[*******]:

The default values are provided in square brackets, to accept the default values, press Enter. You can also use connect -file <filename _moz-userdefined=""> where <filename _moz-userdefined=""> is the name of the file that stores the connection data in the following format: <filename></filename>.

connect -ip <ip> -port <port> -realm <realm> -user <user> -password <password> 

For example, connect -ip 127.0.0.1 -port 9191 -realm realm -user root -password pramati

This connects the shell to the server running on the localhost with the naming service started on port 9191. The default user name is root and password is pramati.

How do I Back Up and Restore Server Configuration?

When running applications on a production system, regular backups of the server configurations is necessary. This ensures that the server instance and the applications running in the server is reliable. Server configuration backups are required in cases where:

How do I Restore Backed up Configurations?

The server can be started with a named backup configured. This can be done by specifying the -restoreconfig parameter as one of the parameters when the server is started. For example: C:\PServer50_1016\server\bin>runserver -restore.

Alternatively, for named backups, the name of the Configuration backup can be specified. For example: C:\PServer50_1016\server\bin>runserver -restore backupJune06.

What are the Types of Shells?

The basic types of tasks possible with Pramati Server Shell are: managing a J2EE environment, managing resources, managing a JMS environment, processing SQL queries and administering of Services. Server provides the following Shells for performing each of these: These Shells are not dependent on the location of the Server. The local and remote shells provide input and output facility.

What are the Generic Shell Commands?

There are a few commands that can be executed from any shell. A description of each of these commands has been provided below:

Table 1: List of Generic Commands

CommandDescription
shelpDisplays help messages for the generic shell commands. If you want help for a particular command, go to the shell and use the 'help' command.
chshChanges to a different shell. This prompts you for the shell that you want to change to.
resetResets all shell props - history for all shells, aliases etc.
refreshprops <file>Sets all shell properties from the file. The props file can be like: alias <name>=<value> (for setting aliases) or <variable>=<value> (variable is a shell property like verbose).
refreshcommandprops <file> Loads new commands from the specified file.
alias <name>=<value> Sets the alias. If there are no arguments, this command prints out the current aliases.
history command no Prints the history for that shell if there are no arguments, else, executes the command at the specified command number.
- command no Executes the shell command corresponding to command no. If there are no arguments, prints out the history for that shell.
exit Exits from the current shell and return to the previous shell.
set Sets the shell’s property. It is by default set to true. It can be set to false by using the command set verbose=false (note that there are no spaces for the name value pair "verbose=false"). This command can be used in cases where you don’t want exceptions/errors to be displayed on the console (for example, errors while deployment can be suppressed using the set verbose system property to false).
!<native command> Executes a native command.
printerr Prints the last exception stack trace (useful in non verbose mode).
<command> > <file_name> Redirects command output to the specified file. For example, using help > help.txt redirects the output of the command help to help.txt.
process <batch_file_name> Executes the commands in the batch file.

Typing any available shell name inside any shell takes you to that Shell.

How do I use Shell Commands in Interactive Mode?

All Shell commands are interactive by default, and are attached to the respective command handlers. In case you forget to enter the required parameters, the command will prompt you for the same.

What are the Default J2EE Shell Commands?

The Server command line interface displays a prompt on which the following commands may be executed within the Server VM.

Table 2: Description of J2EE Shell commands

CommandDescription
help command Displays help messages. If command name is provided, it provides a more detailed usage help for that command.
classloader_debugSets classloader debugging on/off.
config Allows you to create backups of the server configuration files. Create a backup of the current server configuration. To learn more about how to use this command refer to Backing Up and Restoring Server Configuration.
deployDeploys the given ear/jar/rar/war on the server.
deploygroupDeploys multiple applications as part of a group.
deploytoolBrings up the deploy tool connected to the Server for specifying bean references and deploying applications.
detectDeadlockDetects application level deadlocks for CMP and BMP beans. Detects any deadlocks that have occurred on the current server instance. To know more about dead lock detection read Configuring EJB Server.
distribute_appDistributes a deployed application or par file to a Server.
http_acceptStops/starts the Web Server from accepting HTTP requests.
license_detailsDisplays information about the current server license.
listDisplays the list of all deployed applications on the Server.
list_system_propertiesDisplays the list of the system properties set in the server VM.
make_parMakes a prepared archive (*.par) file which is distributable, and saves it in the parchives directory, under the archives directory.
migrate_configMigrates a JBoss/Weblogic archive to Pramati.
preparePrepares the ear/jar/war/rar at the given path.
removeRemoves the application from the Server if it is not running.
set_system_propertySets a system property on the Server VM.
setdebugTurns on/off the debug mode of the Server.
setverboseSets the verbose method on or off.
shutdownShuts down the Server and releases all resources being held by it.
ssl_acceptStops/starts the Web Server from accepting SSL requests.
startStarts the application that is already deployed but not active.
start_request_sniffThis command starts request sniffing and analyzing what is happening to a request when it is being processed by the Server.
status Shows details of J2EE services - naming, resources, transactions, EJB and Web containers, load balancer (for the Web request dispatcher, if enabled), and cluster (if the service is enabled), socket, and session. Use the resource-name for resource service.
stop Similar to the undeploy function, but only stops the currently running application and does not remove the ear from the file system. The application may be restarted without redeploying it.
stop_request_sniffStops request sniffing.
supportGenerates a zipped archive containing config and log files.
traceEnables selective debug tracing in the Server.
undeploy Undeploys the application(s) from the Server. Stops the application, if necessary, and removes the application from the archives directory in the server installation directory.
upgrade_license Upgrades the current license with the new key.
validateappstartValidates an archive that has been deployed but not started.
validatearchiveValidates the ear/jar/war at the given path.
who_load_meDetermines the loading classloader for a class.
whoamiPrints the current user and system information.

What are the Resource Shell Commands?

The Resource Shell provides a command line mode to work with resource-related commands. To connect to the Resource Shell, type ressh at the default Server prompt. You can use the following commands:

Table 3: Commands in the Resource Shell

CommandDescription
help commandDisplays help messages. If command name is provided, it provides a more detailed usage help for that command.
listLists all the resources on the Server.
add_datasourceAdds a datasource on the Server.
add_jca_cfAdds a JCA Connection Factory for a connector.
add_jdbc_cfAdds a a JDBC Connection Factory.
add_jmsadapterAdds a configured JMS adapter.
add_mailresourceAdds a mail resource on the Server.
add_urlresourceAdds a URL resource on the Server.
clear_ps_cacheClears the prepared statement caches of the free connections.
create_cluster_generic_resourceCreates a clustered generic resource.
create_generic_resourceCreates a generic resource.
remove_cluster_generic_resourceRemoves a generic resource on cluster.
remove_datasourceRemoves a datasource from the Server.
remove_generic_resourceRemoves a generic resource.
remove_jca_cfRemoves a configured JCA Connection Factory.
remove_jdbc_cfRemoves a configured JDBC Connection Factory.
remove_jmsadapterDeletes a configured JMS adapter.
remove_mailresourceRemoves a mail resource from the Server.
remove_urlresourceRemoves a URL resource from the Server.
start_cluster_generic_resourceStarts a generic resource on cluster.
start_generic_resourceStarts a generic resource.
start_trackingStarts connection tracking for the specified datasource.
stop_cluster_generic_resourceStops a generic resource on cluster.
stop_generic_resourceStops a generic resource.
stop_trackingStops connection tracking for the specified datasource.

What are the JMS Shell Commands?

The JMS Shell provides a command line mode to work with Message Server related commands. To open the JMS Shell, enter jmssh at the default Server prompt. You can specify the following commands:

Table 4: Commands in the JMS Shell

CommandDescription
help commandDisplays help messages. If command name is provided, it provides a more detailed usage help for that command.
listLists names of bound topics/queues/factories. This command is deprecated.
activateActivates the JMS Service.
addAdds an administered object - topic, queue, topic Connection Factory, Queue Connection Factory, XA Topic Connection Factory, and XA Queue Connection Factory.
cleanupCleanup the messages in the server and also from message store.
deleteDeletes an administered Object Topic, Queue, Topic Connection Factory, Queue Connection Factory, XA topic Connection Factory, and XA queue Connection Factory.
deregisterForcibly deregisters the client.
javaExecutes a JAVA Command given the class name and parameters.
pausePauses the delivery from the specified destination.
purgePurges a queue. All messages held in queue are lost.
resumeResumes the delivery from the specified destination.
setSets server configuration parameters such as maximum cache size of a destination, maximum memory size for the destination, redelivery limit for queue, redelivery limit policy for queue, or redelivery delay for queue.
showShows the server statistics for memory/clients.
shutdownShuts down the Message Server.
statusShows the status of various resources on the Message Server.
timerGives the status of timer.
traceReloads tracing information from the current file or loads it from a new file.
unsubscribeUnsubscribes the durable subscriber given the clientID and subscriber name.

What are the Kernel Shell Commands?

The Kernel Shell provides a command line mode to:

To access this shell, type chsh and choose the number corresponding to the kernel shell or type kernel directly at the command prompt.

The shell prompt changes to kerneladmin@<server_name _moz-userdefined=""></server_name>

A list of commands is displayed on first entry into the shell. Typing help also displays the same information.

Table 5: Commands in the Kernel Shell

CommandDescription
help commandDisplays all the commands in this shell along with a brief description. If command name is provided, it provides a more detailed usage help for that command.
add_serviceAdds a deployable and restartable service at runtime. The service must implement the com.pramati.services.framework.RestartableService interface.
create_clusterThis command creates a J2EE/JMS cluster configuration.
create_nodeThis command creates a J2EE/JMS node.
get_configDisplays configuration information of the service whose name is specified as an argument to the command.
remove_serviceRemoves a deployable/restartable service at runtime. The service must implement the com.pramati.services.framework.RestartableService interface.
service_statusDisplays the status of services on the Server.
start_serviceStarts a deployable/restartable service at runtime. The service must implement the com.pramati.services.framework.RestartableService interface.
stop_serviceStops a deployable/restartable service at runtime. The service must implement the com.pramati.services.framework.RestartableService interface.

What are the SQL Shell Commands?

The SQL Shell provides a command line mode to process SQL queries on a database, or a datasource defined on the Server. To open the SQL shell, enter sqlsh at the Server prompt. The shell prompt changes to sqlsh>.

You can specify the following commands:

Table 6: Commands in the SQL Shell

CommandDescription
help commandDisplays list of available commands and their usage. If command name is provided, it provides a more detailed help for that command.
connect -iUsed to connect to database interactively.
connectUsed to connect to database with properties as specified from connection.properties placed in System classpath.
disconnectUsed to disconnect from the database.
desc tableDisplays table's description.
listtablesDisplays list of tables.
statusDisplays the current user connected to the database at the URL.

Any valid SQL queries can be executed using the SQL Shell.

Note: You should disconnect from a DB or a datasource in the SQL shell before exiting from it, else the Server disconnects you automatically.

What is the OS Shell?

The OS Shell provides a command line mode to process general operating system commands on the host running the server. To open the OS shell, enter ossh at the Server prompt.

What are the Security Shell Commands?

To open the SQL shell, enter secsh at the Server prompt. The shell prompt changes to secsh>. You can specify the following commands on the Security Shell:

Table 7: Commands in the Security Shell

CommandDescription
help commandDisplays list of available commands and their usage. If command name is provided, it provides a more detailed help for that command.
ca_issue_certIssues a user certificate signed by CA in PKCS#12 format. Executes Interactively.
ca_setupSets up the Certifying Authority (CA). This CA will be used to sign a CSR or issue a certificate in PKCS#12 format.
ca_signSigns the CSR request given in 'csrFile' and stores that in 'certFile'.
change_ca_store_passwordChanges the password for CA Key Store.
change_server_store_passwordChanges the password for Server Key Store. Also changes the password for all the keys in the key store.
change_trusted_store_passwordChanges the password for trusted Key Store.
crl_reloadReloads the Certificate Revocation Lists from the CRL repository of the Server.
delete_server_certDeletes the certificate stored with the given alias name from the server key store.
delete_trusted_certDeletes the certificate stored with the given alias name from trusted CA key store.
export_ca_certExports the CA's Certificate to a file.
export_server_certExports the Server Certificate with given alias to a file.
export_trusted_certExports the Trusted Certificate with given alias to a file.
generate_certGenerates a new Server Certificate
generate_csrGenerates a Certificate Signing Request.
import_certImports certificate into the Server keystore or Trusted keystore.
import_csr_replyImports CSR reply to the server keystore.
list_server_certLists all the certificate aliases present in the server keystore.
list_trusted_certLists all the certificates present in the Trusted CA keystore.
view_ca_certShows the CA certificate details.
view_cert_chainShows the details of the Certificate Chain with given alias in the server keystore.
view_server_certShows the details of the Certificate with given alias in the server keystore.
view_trusted_certShows the details of the Certificate with given alias in the trusted CA keystore.

Any valid Security queries can be executed using this shell.

How do I use Shell Commands in Batch Mode?

You can script a list of commands in a batch file and run them in the shell by executing:
java com.pramati.RemoteShell -file [batch_file_location]

For example, you can create a batch file starter.pmt at /home/both/scripts/ that contains the following command set:

connect -ip 127.0.0.1 -port 9191 -realm realm -user root -password pramati
start myApp.ear
start anotherApp.ear
disconnect

Type: java com.pramati.RemoteShell -file /home/both/scripts/starter.pmt

This connects the shell to the Server that is running on localhost at port 9191. It starts myApp.ear and anotherApp.ear, and disconnects from the server - this does not stop the application. You can use the shell in Batch mode to write a script, which will shut down the Server.

Note: You need to have the required privileges to execute this script.

You can create and run a shutdown script to connect to the Server running on localhost and shut it down. Save the following commands in a file, for example, shutdown.pmt, at /home/both/scripts/:

connect -ip 127.0.0.1 -port 9191 -realm realm -user root -password pramati
shutdown

Type: java com.pramati.RemoteShell -file /home/both/scripts/shutdown.pmt

This command shuts down the Server.

How do I add Customized Commands?

Pramati Server provides you a customizable feature that allows you to add your own commands for being executed on the command line interface. All commands have a common interface located at: com.pramati.services.command.<command _moz-userdefined=""> </command>.

Each Shell provides a command mapping between the commands and their class names. For example, the classname for the command list is com.pramati.services.command.j2ee.LISTCommand.

How does it work?

Pramati Server uses the facility of a Command Manager (CM) to manage the I/O flow of the commands that are executed. The CM is the hub that receives a command from the shell and routes it to the corresponding Command Handlers. The CM understands Shells and Handlers. Shell is a collection of commands. Each command is processed by a Command Handler. The Shells and Command Handlers may be registered with the CM. For such registered shells and commands, value added services such as Aliases and Help will be available.

In the event of a command being invoked by the user, that is not presently registered, the CM tries to locate the command handler on the fly by making use of the following mechanism:

Compose the handler class name- <command _moz-userdefined="" uppercase="" to="" name-="">Command. For example, if command was get_app_status, then the class name would be GET_APP_STATUSCommand.

The CM tries to load this class. Normally, the class should be either in the server’s classpath or in the EXT directory <install_dir>\server\lib\ext.

If a new command is being written, then the command class file should be placed in a jar, and the jar be placed in the \ext directory.

How do I Load Customized Commands?

To load customized commands, you need to create a .props file that contains the following command: mycustomcmd=<classname>. On the command prompt, enter: refreshcommandprops <path_to_props_file>.

This adds the command to be used on the command line. The command will be available in only the particular Shell in which it was loaded.

How do I Alias Server Commands?

Starting with Pramati Server 5.0, the commands can be aliased. New aliases can be added to the file UserShellConfig.properties that is located at <install_dir>\server\nodes\<node_name>\config directory.

How do I Validate Archives?

To validate an archive from the command line, type:
java com.pramati.j2ee.deploy.validator.earvalidator.EARValidator <name and location of the archive>

Note: Before validating an archive from the command prompt, ensure that the classpath has been set. To set the classpath, run setup.sh on Unix or setup.bat on Windows located at <install_dir>\server\bin.

The following options can be specified with this command:

Table 8: Commands for Validating an Archive

OptionDescription
-aGenerates and displays a report of all the severity levels after validation is complete.
-wGenerates and displays a report of messages with Warning and Failed severity levels.
-fGenerates and displays a report of messages with Failed severity level. This is the default option.
-vGenerates the results of the validation in the verbose mode.
-oSaves the results of the validation to a text file.

For example, at the command prompt, type java com.pramati.tools.validator.earvalidator. EARValidator -a -oreport.txt orderApp.ear.

How do I Start Processes at Server Launch?

This section describes the Server Launcher which is a set of utility classes that can be used by ISVs and application server administrators to start their processing once the Server, and all applications configured to auto-start, are started. The Launcher itself starts the Server and the applications.

How do I Kickstart Processing at Server Launch?

Launcher includes a modal method for application (auto-start) init, which returns a call once all bootstrap applications have been started. This utility can be used during startup and shutdown processing, and for additional processing once the Server and applications are up. The following options must be passed to the com.pramati.tools.bss.ServerLauncher class for Server launch and associated processing:

Table 9: Options to be passed for the com.pramati.tools.bss.ServerLauncher class

Options Description
waitForServerInitUsed to specify that the Server Launcher should wait till it is identified Server is properly initialized. This is mandatory.
hostThis specifies the host on which to locate the Server. Optional - defaults to localhost.
namingportThis specifies the naming port of the Server to be located. This is mandatory.
waitSecondsThis specifies the time out limit for locating the Server. Optional - defaults to 2 minutes.
verboseThis logs the Activity. The default is set as false.
helpThis prints the help.

Note: The next release of Server Launcher will also allow you to directly launch the Server. The current release supports only the launching of processes after the Server has started.

The default value for waitSeconds $TIME is two minutes for starting just the Server. There may be reasons why the wait may be more than two minutes:

The exact time, thus, depends on the application environment.

How do I Start Server Launcher?

To start the Server Launcher, execute:
java com.pramati.tools.bss.ServerLauncher
-waitForServerInit
-host $HOSTNAME
-namingport $PORT
-waitSeconds $TIME
-verbose  -help

This utility should be invoked after the Pramati Server startup call. Host Name and Wait Time assume default values if not specified (for the default values refer to Table 9 above). namingport and waitForServerInit are mandatory - and are the only options supported with the present version.

How do I Shutdown Server?

Pramati Server provides two ways for shutdown:

What is the Command for Normal Server Shutdown?

The Normal Shutdown command is used to provide a graceful shutdown for Pramati Server. The command is executable both from the Server and Remote Shells.

To initiate Normal Shutdown, enter the following in the default Shell: j2eeadmin@default> shutdown

What is the Command for Immediate Server Shutdown?

This section describes the functionality provided by Pramati Server for its immediate shutdown while performing additional processing.

The Immediate Shutdown command can be used in scenarios where the Server may have to be started from inside an application-specific startup/init/bootstrap scripts/program. Shutdown command is provided in the J2EEServerMBean, and is executable from the Server and Remote Shells.

To initiate Immediate Shutdown, enter: j2eeadmin@default> shutdown <seconds>

After the specified time for shutdown (<seconds _moz-userdefined="">), the Server VM is forcefully exited. If the delay is zero, the Server VM exits immediately.

Invoking Immediate Shutdown

Immediate Shutdown can be invoked in one of two ways:

From the Server ShellTo initiate an Immediate Shutdown using the Shell, enter: j2eeadmin@default> shutdown <force timeout seconds>

Using MBeans The Server Shutdown can be effected programmatically using the J2EEServerMBean. The MBean is located using the MBean Server.

To look up the MBean using JNDI, create an initial context using the correct environment properties.

Context IC=newInitialContext(props);
J2EEServerMBean.mbean=(J2EEServerMBean)ic.lookup("root-server-mbean")
Note: ‘props’ is a properties object containing the lookup parameters like provider URL etc.

The method to be executed is: J2EEServerMBean.stop (forceTimeoutSeconds)

How do I Start Standalone Message Server?

  1. Open a command window at <install_dir>\server\bin
  2. Execute: runserver -node <nodename>
  3. Specify the Message Server node name in <nodename> that you have created.

Note: For a Message Server node, ensure that JMSService is enabled in server-config.xml, located at <install_dir>\server\nodes\<node-name>\config.

The command to start Standalone J2EE Server, a J2EE Server Cluster or Message Server node is same. The command runserver -node <nodename> also helps in creation of a new node.

How do I View JMS Statistics?

The JMS statistics can also be viewed using command line. To do this we first need to change to the JMS shell using the command jmssh. To see the total free memory and total memory allocated to JVM instance on which the Message Server is running, type: jmsadmin@default:>show memory

The output may look like:

Free Memory: 1513 KBytes.
Total Memory: 1984 KBytes.

How do I List Destinations?

To display all the destination objects configured on the Server, type:
jmsadmin@default:>list destinations
Bound Topics: JMSTopic
Bound Queues: JMSQueue

In JMS context, there are two types of destination objects: Topic and Queue. These are used in point-to-point or publish or subscribe messaging domains. The Message Server console provides a command to find all, configured and list destinations.

How do I List Topics?

To list topics configured on the server, type:
jmsadmin@default:>list topics
Bound Topics: JMSTopic, StockMarket

It displays all the configured topics on the server.

How do I List Queues?

To list queues configured on the server, type:
jmsadmin@default:>list queues
Bound Queues: JMSQueue, SellQueue, BuyQueue

To list queues configured on the server using Message Server command line or the shell, use the command list queue. It displays all the configured queues on the server.

How do I List Factories?

To list all the connection factories configured on the server, type:
jmsadmin@default:>list factories
Topic Connection Factories: JMSTopicConnectionFactory
Queue Connection Factories: JMSQueueConnectionFactory
XA Topic Connection Factories: JMSXATopicConnectionFactory
XA Queue Connection Factories: JMSXAQueueConnectionFactory

This command displays all the configured connection factories on the server.

How do I View Message Server Status?

The overall Message Server report can also be obtained by using the status command. The report generated consists of the following sections.

How do I View Destination Details?

This shows a list of all the Queues and Topics that are currently available on the Message Server.

The following information about Queues are available:

The following information about a Topic is available:

What are Timed Messages?

Timed messages is a feature provided by the Pramati Message Server where messages can be configured to be sent at a particular time. The following status for Timed Messages are displayed:

What are Client Details?

The client details specifies the number of clients connected to the current Message Server.

What are the Active/Inactive Durable Subscribers?

This section describes the number of inactive durable subscribers. The following information is available:

What is the Thread Pool Status?

Pramati Message Server creates a thread for every Queue or Topic created. The thread pool status section contains details of the thread pool. The following information for the MessageQueue thread is available:

This section displays status of the topic delivery thread. The topic delivery thread is responsible for delivering messages to a subscriber of a topic:

What is the Activation Status?

The Activation Status displays true if the current JMS node is active.

How do I Detect Deadlocks in EJBs?

Deadlocks can be detected using the server shell prompt using the detectDeadlock command.
j2eeadmin@default> detectDeadlock
No Deadlocks Detected.

In the above case, no deadlocks are detected.

How do I View Destinations and Connection Factories?

To view a list of Destinations and Command Factories using the command prompt, use the following commands:

Table 10: Commands for Viewing list of Destinations and Command Factories

To ListGive commandDescription
Destinationsjmsadmin@default:>list destinationsThis displays all the destination objects configured on the Server
Queuesjmsadmin@default:>list queuesThis displays all the queues configured on the Server
Topicsjmsadmin@default:>list topicsThis displays all the topics configured on the Server
Connection Factoriesjmsadmin@default:>list factoriesThis displays all the connection factories configured on the Server

How do I Monitor Datasources?

Perform the following steps to monitor a Datasource using the command shell:
  1. Type the following command at the resource shell: start_tracking <Datasource_Name>. For example, ressh@default> start_tracking Oracle_DS.
  2. Exit from the resource shell and check the status of the resource at J2EE server shell. To view details such as pool sizes, PreparedStatements, and memory usage, type the following command at the shell: status resource <DataSourceName> all. For example:
    j2eeadmin@default> status resource jdbc/DB1
    
    ====================================================
    Status generated on
    
    Mon Apr 17 17:47:45 GMT+05:30 2006
    ====================================================
    ----------------------------------------------------
                < Starting resource status >
    ----------------------------------------------------
    Datasource Name           :[jdbc/DB1]
    Connection Factory Name   :[demo_cf]
    Transaction participation :[true]
    Configuration details:
    Initial pool size         = 1
    Minimum pool size         = 5
    Maximum pool size         = 20
    Idle timeout              = 300 seconds
    Conn. request timeout     = 10 seconds
    Refresh interval          = 300 seconds
    Validation mode           = default
    
    Current Pool Status:
    Total requests                = 0
    Total connections             = 1
    Free connections              = 1
    Connections in use            = 0
    Object being validated        = false
    Total timed out requests      = 0
    Currently waiting threads     = 0
    Waiting threads peak          = 0
    Total connections destroyed   = 0
       Total invalid connections  = 0
    Total connection validations  = 0
    Total connection leaks        = 0
    Prepared statement cache
       Configured cache size  = 20
       Cache hit ratio        = 0
    Note:
    1. Unclosed connections are closed in finalize -
       Start the server with the system property
       com.pramati.resource.njdbc.debugconnectionleak=true
       to determine the source of these leaks.
    2. Unclosed prepared statements are closed when the connection wrapper is closed.
    ----------------------------------------------------
                 < Ending resource status >
    ----------------------------------------------------
    Use the 'all' flag to view a more detailed status
    
    -------------- Memory Usage--------------
    Total VM memory = 20201k
    Free VM memory = 7211k
    -----------------------------------------
    Server started at Mon Apr 17 17:47:06 GMT+05:30 2006
    Server uptime 0 days 0 hrs 0 minutes 39 seconds
    
    j2eeadmin@default>
    

How do I Perform Advanced Monitoring for Datasources?

The JDBC pool instrumentation shows the time for which a JDBC connection from a datasource has been in use. You can filter results based on in-use time. In the server\bin\runserver.bat or sh file, enable this feature by setting the system property com.pramati.util.pool.debugRetainedConnections to true:
java  -server
-Dcom.pramati.util.pool.debugRetainedConnections=true
-Dinstall.root=%install_root%
-Djava.security.policy=%install_root%\lib\pramati\pramati.java.policy
-Djava.security.auth.policy=%install_root%\lib\pramati\pramati.jaas.policy
-Djacorb.home=%install_root%\lib\tp\jacorb com.pramati.Server %*

Note: This feature is available only for Pramati Server 4.1 SP3 and above.

This enables advanced instrumentation for datasource connection usage, including:

This can help track down points in the application code which might be holding on to connections for too long and potentially starving other requests.

The output can be viewed by typing status resource <datasource name> all on the J2EE shell. For viewing this information, type status resource <datasource name> InUseConnections. This prints all connections that are currently in use for the datasource specified by <datasource name>.

For additional filtering as in points 2 and 3 above, type:status resource <datasource name> InUseConnections ConnectionsInUseFor=250

This prints all connections in use for the datasources that have been in use for more than 250 milliseconds.

In all the above command combinations, omitting the datasource name would print out the information for all datasources defined on the server.

Sample

----------------------------------------------------
            < Starting resource status >
----------------------------------------------------
Datasource Name           :[orads]
Connection Factory Name   :[oraclecf]
Transaction participation :[true]
Transaction isolation     :[unspecified]

Configuration details:
Initial pool size         = 1
Minimum pool size         = 5
Maximum pool size         = 20
Idle timeout              = 300 seconds
Conn. request timeout     = 10 seconds
Refresh interval          = 300 seconds
Validation mode           = default
Current Pool Status:
Total requests                = 1
Total connections             = 1
Free connections              = 0
Connections in use            = 1
Object being validated        = false
Total timed out requests      = 0
Currently waiting threads     = 0
Waiting threads peak          = 0
Total connections destroyed   = 0
   Total invalid connections  = 0
Total connection validations  = 1
Total connection leaks        = 0
Prepared statement cache
   Configured cache size  = 20
   Cache hit ratio        = 0
Note:
1. Unclosed connections are closed in finalize -
   Start the server with the system property
   com.pramati.resource.njdbc.debugconnectionleak=true
   to determine the source of these leaks.
2. Unclosed prepared statements are closed when
   the connection wrapper is closed.
Printing connection info for: 1
connection[0] has been in use for 9875 ms.
java.lang.Exception: InUseConnection
        at
        com.pramati.util.pool.ShrinkingPool$InuseInfo.
            (ShrinkingPool.java:945)
        at
        com.pramati.util.pool.ShrinkingPool.addToInUsePool
            (ShrinkingPool.java:505)
        at
        com.pramati.util.pool.ShrinkingPool._getObject
            (ShrinkingPool.java:267)
        at
        com.pramati.util.pool.ShrinkingPool.getObject
            (ShrinkingPool.java:235)
        at
        com.pramati.util.pool.ShrinkingPool.getObject
            (ShrinkingPool.java:224)
        at
        com.pramati.resource.njdbc.ContainerAuthoredDS.getConnectionFromPool
            (ContainerAuthoredDS.java:223)
        at
        com.pramati.resource.njdbc.PramatiDataSource._getConnection
            (PramatiDataSource.java:319)
        at
        com.pramati.resource.njdbc.ContainerAuthoredDS.getConnection
            (ContainerAuthoredDS.java:105)
        at
        com.pramati.jsp.generated.conn._jspService_delegate
            (conn.java:68)
        at
        com.pramati.jsp.generated.conn._jspService
            (conn.java:87)
        at
        com.pramati.jsp.runtime.HttpJspSuper.service
            (HttpJspSuper.java:91)
        at
        javax.servlet.http.HttpServlet.service
            (HttpServlet.java:802)
        at
        com.pramati.web.servlet.core.ServiceAction.run
            (ServiceAction.java:74)
        at
        com.pramati.security.util.PramatiSecurityHelper._doAs
            (PramatiSecurityHelper.java:54)
        at
        com.pramati.services.security.spi.SecurityHelper.doAs
            (SecurityHelper.java:124)
        at
        com.pramati.web.servlet.core.PramatiFilterChainImpl.invokeTargetWebResource
            (PramatiFilterChainImpl.java:219)
        at
        com.pramati.web.servlet.core.PramatiFilterChainImpl.doFilter
            (PramatiFilterChainImpl.java:140)
        at
        com.pramati.web.util.servlets.filters.TitleFilter.doFilter
            (TitleFilter.java:33)
        at
        com.pramati.web.servlet.core.PramatiFilterChainImpl.invokeTargetFilter
            (PramatiFilterChainImpl.java:163)
        at
        com.pramati.web.servlet.core.PramatiFilterChainImpl.doFilter
            (PramatiFilterChainImpl.java:132)
        at
        com.pramati.web.servlet.core.PramatiFilterChainImpl.startDoFilter
            (PramatiFilterChainImpl.java:88)
        at
        com.pramati.web.interceptors.ServiceInterceptor.preProcess
            (ServiceInterceptor.java:138)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:62)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:63)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:63)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:63)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:63)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultInterceptor.process
            (DefaultInterceptor.java:63)
        at
        com.pramati.web.interceptors.core.InterceptorChainImpl.processNext
            (InterceptorChainImpl.java:48)
        at
        com.pramati.web.interceptors.core.DefaultProcessContainer.process
            (DefaultProcessContainer.java:97)
        at
        com.pramati.web.core.WorkerThread.processConnection
            (WorkerThread.java:332)
        at
        com.pramati.web.core.WorkerThread.processConnection
            (WorkerThread.java:303)
        at
        com.pramati.web.core.WorkerThread.run
            (WorkerThread.java:128)
-----------------------------------------

How do I Configure Request Sniffing?

Use the following command to turn on Sniffing at runtime from Server command prompt:
shell@start_request_sniff [-trace] [-file <output_filename>]

To turn it off, use the following command: shell@stop_request_sniff

What is the Format of Sniffer Log?

Sniffer log is placed in the server logs directory. The output contains records of this structure:

A request has additional information. Consider the iBank application which will contain information such as:

client ID= "127.0.0.1"
context = "bank"
URI = "bank/transfer.jsp"

Response includes just the response details. In case of WEB, it includes be the response headers.

Sample Output for Request Sniffing

The output for Request Sniffing will look like:
## WEB RESPONSE Thread-15 1:24:27 PM ID:1077350067734
Client Id =127.0.0.1
Context =/
URI =/OrderBookWeb/
Details =HTTP/1.1 404 The requested resource was not found. Please check the URI above.
Server: Pramati Server
Date: Sat, 25 Feb 2006 07:54:28 GMT
Content-Length: 1125
Content-Type: text/html
Connection: Keep-Alive

A JMS Request Sniff would look as below:

## JMS REQUEST RMI TCP Connection(75)-192.168.1.29 4:42:49 PM ID:1077534769960
Client Id =192.168.1.29-502058352
Context =sendMessage msgId:ID:1673361:1077534769340:192.168.1.29:destination:QUEUE: JMSQueue
URI =sendMessage
Details =sendMessage
##
## JMS RESPONSE RMI TCP Connection(75)-192.168.1.29 4:42:49 PM ID:1077534769960
Client Id =192.168.1.29-502058352
Context =sendMessage msgId:ID:1673361:1077534769340:192.168.1.29:destination:QUEUE: JMSQueue
URI =sendMessage
Details =sendMessage done
##

In the above sniff log generated:


© Pramati Technologies 2007 Runs on Pramati Server | Feedback | Legal