简体   繁体   中英

J2EE Java server side error debug interview

In a recent job interview I was asked a J2EE debugging question. The question was As Follows:

"You are not getting same data as expected from your server how do you debug it?"

What or how should I answered this question that would make the interviewer happy??

Please suggest....

On the top of my head, usually you would

  • check the request and compare it with API - is the request being done correctly
  • check the logs for any problems on the server
  • confirm that the version of server application matches the one expected
  • check the database data status
  • if else fails, try to reproduce the problem locally or in a lower environment or step through the server app execution path with a debugger. Increasing the log level or hooking up to debug interface might be relevant as well.

When you have to debug code to server there is a common way on how to debug the code. You see server logs. Now, if you cannot find any errors, you have to see what the API returns at every single step. If you have not logs for every step, put log.debug("Some text that means something"); and rerun. If something is unusual, then you have to check the specific step.

The question is too general and opens a way for you to literally bombard the interviewer with questions and that's probably what he expects you to do.

Usually when sh. hits the fan I want to know: does the user receive any data at all? If not, app log, server log and db log is where I look. Some apps we use got app log located on the disk where the app is running, some are using db based logs and some are using the default log which can be accessed through admin console on the server (Glassfish for example).

On the other hand if the user received incorrect data I start tracking through the app how the data is "made" which usually means going through several db queries and such where I'm trying to determine what's going on. After that I compare the result I expect with the result user received and according to the difference I decide what went wrong.

But hey this question is too general in this environment so you either let the interviewer specify the problem or create your own scenario for him.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM