9 min read

 

(For more resources on IBM, see here.)

Dumping namespaces

To diagnose a problem, you might need to collect WAS JNDI information. WebSphere Application Server provides a utility that dumps the JNDI namespace.

The dumpNamespace.sh script dumps information about the WAS namespace and is very useful when debugging applications when JNDI errors are seen in WAS logs. You can use this utility to dump the namespace to see the JNDI tree that the WAS name server (WAS JNDI lookup service provider) is providing for applications.

This tool is very useful in JNDI problem determination, for example, when debugging incorrect JNDI resource mappings in the case where an application resource is not mapped correctly to a WAS-configured resource or the application is using direct JNDI lookups when really it should be using indirect lookups.

For this tool to work, WAS must be running when this utility is run.

To run the utility, use the following syntax:

./dumpNameSpace.sh -<command_option>


There are many options for this tool and the following table lists the command-line options available by typing the command <was_root>/dumpsnameSpace.sh -help:

Command option Description
-host <host> Bootstrap host, that is, the WebSphere host whose namespace you want to dump. Defaults to localhost.
-port <port> Bootstrap port. Defaults to 2809.
-user <name> Username for authentication if security is enabled on the server. Acts the same way as the -username keyword.
-username <name> Username for authentication if security is enabled on the server. Acts the same way as the -user keyword.
-password <password> Password for authentication, if security is enabled in the server.
-factory <factory> The initial context factory to be used to get the JNDI initial context. Defaults to com.ibm.websphere.naming. WsnInitialContextFactory and normally does not need to be changed.
-root [ cell | server | node | host | legacy | tree | default ] Scope of the namespace to dump.
For WS 5.0 or later:
cell: DumpNameSpace default. Dump the tree starting at the cell root context.
server: Dump the tree starting at the server root context.
node: Dump the tree starting at the node root context. (Synonymous with host)
For WS 4.0 or later:
legacy: DumpNameSpace default. Dump the tree starting at the legacy root context.
host: Dump the tree starting at the bootstrap host root context. (Synonymous with node)
tree: Dump the tree starting at the tree root context.
For all WebSphere and other name servers:
default: Dump the tree starting at the initial context, which JNDI returns by default for that server type. This is the only -root choice that is compatible with WebSphere servers prior to 4.0 and with non-WebSphere name servers. The WebSphere initial JNDI context factory (default) obtains the desired root by specifying a key specific to the server type when requesting an initial CosNaming NamingContext reference. The default roots and the corresponding keys used for the various server types are listed as follows:

WebSphere 5.0: Server root context. This is the initial reference registered under the key of NameServiceServerRoot on the server.

  • WebSphere 4.0: Legacy root context. This context is bound under the name domain/legacyRoot, in the initial context registered on the server, under the key NameService.
  • WebSphere 3.5: Initial reference registered under the key of NameService, on the server.
  • Non-WebSphere: Initial reference registered under the key of NameService, on the server.
-url <url> The value for the java.naming.provider.url property used to get the initial JNDI context. This option can be used in place of the -host, -port, and -root options. If the -url option is specified, the -host,-port, and -root options are ignored.
-startAt <some/subcontext/ in/the/tree> The path from the requested root context to the top-level context, where the dump should begin. Recursively dumps (displays a tree-like structure) the sub-contexts of each namespace context. Defaults to empty string, that is, root context requested with the -root option.
-format [ jndi | ins ] jndi: Display name components as atomic strings.
ins: Display name components parsed per INS rules (id.kind)
The default format is jndi.
-report [ short | long ] short: Dumps the binding name and bound object type, which is essentially what JNDI Context. list() provides.
long: Dumps the binding name, bound object type, local object type, and string representation of the local object, that is, Interoperable Object References (IORs) string values, and so on, are printed).
The default report option is short.
-traceString <some.package. to.trace.*=all> Trace string of the same format used with servers, with output going to the DumpNameSpaceTrace.out file.

Example name space dump

To see the result of using the namespace tool, navigate to the <was_root>/bin directory on your Linux server and type the following command:

  • For Linux:

    ./dumpNameSpace.sh -root cell -report short -username wasadmin
    -password wasadmin >> /tmp/jnditree.txt

    
    
  • For Windows:

    ./dumpNameSpace.bat -root cell -report short -username wasadmin
    -password wasadmin > c:tempjnditree.txt

    
    

The following screenshot shows a few segments of the contents of an example jnditree.txt file which would contain the output of the previous command.

IBM WebSphere Application Server 8.0 Administration Guide

EAR expander

Sometimes during application debugging or automated application deployment, you may need to enquire about the contents of an Enterprise Archive (EAR) file. An EAR file is made up of one or more WAR files (web applications), one or more Enterprise JavaBeans (EJBs), and there can be shared JAR files as well. Also, within each WAR file, there may be JAR files as well. The EARExpander.sh utility allows all artifacts to be fully decompressed much as expanding a TAR file.

Usage syntax:

EARExpander -ear (name of the input EAR file for the expand
operation or name of the output EAR file for the collapse operation)
-operationDir (directory to which the EAR file is expanded or
directory from which the EAR file is collapsed) -operation (expand |
collapse) [-expansionFlags (all | war)] [-verbose]


To demonstrate the utility, we will expand the HRListerEAR.ear file. Ensure that you have uploaded the HRListerEAR.ear file to a new folder called /tmp/EARExpander on your Linux server or an appropriate alternative location and run the following command:

  • For Linux:

    <was_root>/bin/EARExpander.sh -ear /tmp/HRListerEAR.ear
    -operationDir /tmp/expanded -operation expand -expansionFlags all
    -verbose

    
    
  • For Windows:

    <was_root>binEARExpander.bat -ear c:tempHRListerEAR.ear
    -operationDir c:tempexpanded -operation expand -expansionFlags
    all -verbose

    
    

The result will be an expanded on-disk structure of the contents of the entire EAR file, as shown in the following screenshot:

IBM WebSphere Application Server 8.0 Administration Guide

An example of everyday use could be that EARExpander.sh is used as part of a deployment script where an EAR file is expanded and hardcoded properties files are searched and replaced. The EAR is then re-packaged using the EARExpander -operation collapse option to recreate the EAR file once the find-and-replace routine has completed. An example of how to collapse an expanded EAR file is as follows:

  • For Linux:

    <was_root>/bin/EARExpander.sh -ear /tmp/collapsed/HRListerEAR.ear
    -operationDir /tmp/expanded -operation collapse -expansionFlags
    all -verbose

    
    
  • For Windows:

    <was_root>binEARExpander.bat -ear c:tempcollapsedHRListerEAR.
    ear -operationDir c:tempexpanded -operation collapse
    -expansionFlags all -verbose

    
    

In the previous command line examples, the folder called EARExpander contains an expanded HRListerEAR.ear file, which was created when we used the -expand command example previously.

To collapse the files back into an EAR file, use the -collapse option, as shown previously in the command line example. Collapsing the EAR folders results in a file called HRListerEAR.ear, which is created by collapsing the expanded folder contents back into a single EAR file.

IBM Support Assistant

IBM Support Assistant can help you locate technical documents and fixes, and discover the latest and most useful support resources available. IBM Support Assistant can be customized for over 350 products and over 20 tools, not just WebSphere Application Server.

The following is a list of the current features in IBM Support Assistant:

  • Search Information
    • Search and filter results from a number of different websites and IBM Information Centers with just one click.
  • Product Information
    • Provides you with a page full of related resources specific to the IBM software you are looking to support. It also lists the latest support news and information, such as the latest fixes, APARs, Technotes, and other support data for your IBM product.
  • Find product education and training materials
    • Using this feature, you can search for online educational materials on how to use your IBM product.
  • Media Viewer
    • The media viewer allows you search and find free education and training materials available on the IBM Education Assistant sites.
    • You can also watch Flash-based videos, read documentation, view slide presentations, or download for offline access.
  • Automate data collection and analysis
    • Support Assistant can help you gather the relevant diagnostic information automatically so you do not have to manually locate the resources that can explain the cause of the issue.
    • With its automated data collection capabilities, ISA allows you to specify the troublesome symptom and have the relevant information automatically gathered in an archive. You can then look through this data, analyze it with the IBM Support Assistant tool, and even forward data to IBM support.
    • Generate IBM Support Assistant Lite packages for any product addon that has data collection scripts. You can then export a lightweight Java application that can easily be transferred to remote systems for remote data connection.
  • Analysis and troubleshooting tools for IBM products
    • ISA contains tools that enable you to troubleshoot system problems. These include: analyzing JVM core dumps and garbage collector data, analyzing system ports, and also getting remote assistance from IBM support.
  • Guided Troubleshooter
    • This feature provides a step-by-step troubleshooting wizard that can be used to help you look for logs, suggest tools, or recommend steps on fixing the problems you are experiencing.
  • Remote Agent technology
    • Remote agent capabilities through the feature pack provide the ability to perform data collection and file transfer through the workbench from remote systems. Note that the Remote agents must be installed and configured with appropriate ‘root-level’ access.

ISA is a very detailed tool and we cannot cover every feature in this article. However, for a demonstration, we will install ISA and then update ISA with an add-on called the Log Analyzer. We will use the Log Analyzer to analyze a WAS SystemOut.log file.

Downloading the ISA workbench

To download ISA you will require your IBM user ID. The download can be found at the following URL:

http://www-01.ibm.com/software/support/isa/download.html

It is possible to download both Windows and Linux versions.

LEAVE A REPLY

Please enter your comment!
Please enter your name here