JavaEE Training Note - Day 16
Today’s topic is about some debugging methods and toolkit used
to solve problems. One is the tcpdump
and other terminal
tools for remote package sniffer and traffic analysis. Another is
some wired errors occurred in the development progress of project.
Remote Package Sniffer
For the remote deployed server, the most convenient method to connect , monitor and control it is the remote shell. By using the ssh secured remote shell connection, the remote server can be accessed just as a local machine. However, when some error occurred, the terminal tools is the only choice to solve that.
When debugging the interface of a web service, logging it in-ward and out-word packages can is a useful approach to separate the application issues(the server), network issues(the connection), and the request source issues(the client). The following tools are used to handle these problems.
The tools are tested on a ubuntu 16.04 server based host.
port usage and service status
First thing is to ensure the remote application is executing correctly. The initial step is to print process list and check the target service/application is running.
|
|
Then make sure the specified remote tcp port is allocated to target program.
use tcpdump
to sniffer package
tcpdump
is a network tool to dump the traffic on a network.
For a http protocol based service running on port 80, all of its traffic
can be dumped by the following setting:
use tshare
to dump package for further analysis
wireshark
is an advanced toolkit for network package analysis.
The tshark
is the terminal tool in this program packages.
With the tshark
program, the package can be used to dump package
to standard output or save the package to standard pcap
(package capture)
format then download the package for further analysis. Besides,
the package filter can also use lua
based scripts to process
the output or filter.
SQL keyword conflict
In JPA/Hibernate based application, database table can be created by the annotated based table declaration. However, when some SQL keyword are used in name of the table, the generate SQL statement will contain an un-resolvable structure thus a error will occur.
This will generally print a stacktrace at the start up procedure of web application. However, this problem will not prevent the application to load in further progress, until a database operation related to that table is performed.