Trace Gen Java applications on multiple remote hosts
search cancel

Trace Gen Java applications on multiple remote hosts


Article ID: 212070


Updated On:


Gen Gen - Run Time Distributed


Gen Java applications installed under an Application Server on the deployment server/host.
Multiple developers want to use the Diagram Trace Utility (DTU) on each of their remote client PCs.
Applications are both Gen Java Web clients and Gen Java EJBs/EJB Web Services servers.


Gen Diagram Trace


The trace host target is controlled at Assemble time by the Tracing tab "Trace Server Name" field whose default value is localhost.
So the options to trace on a remote host are:

EITHER: Run the Assemble step again with the required "Trace Server Name" to create a new .ear file.

OR: Manually change the existing .ear file as follows:
To trace client and servers need to change both the client and server trace settings in the .ear file/files being deployed/installed.
a. For a Gen Java Web client inside the .ear file the client .war file contains web.xml in its WEB-INF directory and this is the entry that needs to be changed from the default localhost:
b. For a Gen EJB/EJB Web Service inside the .ear file the Server_Manager.jar file contains the ejb-jar.xml file in its META-INF directory and this is the entry that needs to be changed from the default localhost:

For either option, the updated .ear file then needs to be redeployed/reinstalled on the Application Server.

Every time a different developer client PC needs to run the trace via the DTU the above steps would be required because currently there is no way to dynamically control the target DTU PC hostname/IP address at runtime.

Additional Information

Additional options found during research to handle easier DTU hostname switching:
1. In the Assemble step, use a generic name for the "Trace Server Name" e.g. dtupc.
Add a line for hostname dtupc with DTU machine IP address to the hosts file on the deloyment machine hosting the installed application e.g. for Windows file "C:\Windows\System32\drivers\etc\hosts", for Unix/Linux file "/etc/hosts" e.g.           dtupc
Testing the client or server will then trace successfully to the DTU running on the designated dtupc IP address
This method enables flipping the trace between DTU machines by simply changing the dtupc IP address in the deployment machine hosts file and avoids having to change the .ear file and reinstall it every time a different developer wants to trace the application using the DTU on their own client machine.

2. WebSphere - tracing EJB/EJB Web Services:
If the "Detailed" installation steps are used for install application step 10 "Map environment entries for EJB Modules" has the "trace.url" setting where the hostname can be changed:

Also, post-install that translates to the installed Application properties "Enterprise Java Bean Properties > Environment entries for EJB modules":

So after the initial install, that is the easiest option to use to change the DTU hostname without having to reinstall the .ear file each time.
The result of the change is that the deployed ibm-ejb-jar-bnd.xml (which also resides inside the .ear file in the server_manager.jar META-INF directory) has a new line added for "trace.url" i.e.
<env-entry name="trace.url" value="hostname:4567"/>
This can be seen in the WebSphere installedApps directory e.g.
"C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\lvntest014852Node01Cell\CSTRACE1.ear".
The existing file ejb-jar.xml in the same directory remains unchanged
A similar option was not found to be available for JBoss EAP.
For client tracing, there is no option available under the WebSphere Application properties to change the web.xml context parameter traceurl.

Additional Notes:
1.  If deploy the .ear file with client trace set to one host and server trace set to another host, the client-side trace setting does not override the server-side trace setting i.e. both client and server traces display on their respective configured trace hosts. Also if the "trace.url" env-entry is completely removed from the EJB Web Service ejb-jar.xml file the client does not pass its trace parameters to the server and the result will be that the server will not trace at all.

2. Depending on the Application Server being used and its caching features in internal tests Support did find that if the Web client application had already been traced with localhost, after updating the application with the new version of the .ear file the Application Server may need to be restarted to get the trace to display at the expected remote host. However, when tracing an EJB server application restart did not seem necessary to pick up the change.