Brief about debugging a project in Netbeans.
1. Review all error messages
- 1.1 Review error messages in Brower.
- 1.2 Review error at Glassfish Log.
2. Debug JSF Page and classes.
- 2.1 Use Try/Catch to debug classes.
- 2.2 Use Debug.Println(,) in classes.
- 2.3 Debug classes using Netbeans debugger.
3. Debug with browser like Chrome for CSS and JavaScript.
4. Other Possible options for debugging.
- 4. 1 Integrate Js debugger with Netbeans.
Details
1. Review all error messages
Let us run the page itemsLists.xhtml and try to locate the error.
1.1 Review error messages in Brower.
The browser show the following UI Error.
1. Review all error messages
Let us run the page itemsLists.xhtml and try to locate the error.
1.1 Review error messages in Brower.
The browser show the following UI Error.
1.2 Review error at Glassfish Log.
Glassfish server Log shows that method finditemqq not found’ and need to locate the missing method.
II Case .
Showing error as "persistence.exceptions.databaseException" in Glassfish Log, which means connectivity error with database. Possible reason could be MySql Server is down.
1. Debug JSF Page and beans.
a. Use Try/Catch to debug classes.
Try can be used to trap the errors and catch the exception and display the error or result.
E.g Try {...} catch (EJBException e) {debug.println(“error”, e.getMessage());}
b. Use Debug.Println(,) .
Debug.Println(,) has two parameters. As per below slide itemcatg and itemcode are the two parameters and is displayed in glassfish log.
Debug.Println(,) has two parameters. As per below slide itemcatg and itemcode are the two parameters and is displayed in glassfish log.
1. Qry value is ”select c from Items c where :itemcatg = :itemcatg and :itemcode = :itemcode”
2. Itemcatg value is ‘All’
3. itemcode value is ‘nil’.
Above values are displayed in glassfish log at different steps with Debug.Println(,).
2.3 Debug classes using Netbeans debugger.
a. Open Project in Netbeans
b.Right Click on File.
1. Use Run File option.
c. In Chrome browse.
1. Select Inspect Element.
d. It will show three boxes.
i. Element tab will show the tags of existing HTML Page.
ii. Source tab will be used to bookmark.
iii. to execute and brake at breakpoint.
iv. Based on cursor position CSS and JavaScript line is displayed in the respective box.
b.
1. Use Run File option.
c. In Chrome browse.
1. Select Inspect Element.
d. It will show three boxes.
i. Element tab will show the tags of existing HTML Page.
ii. Source tab will be used to bookmark.
iii.
iv. Based on cursor position CSS and JavaScript line is displayed in the respective box.
By moving the cursor on the variable, its value is displayed. A watch can be set to monitor the output value, like for variable ni.
4. Other Possible options for debugging.
4. 1 Integrate Js debugger with Netbeans.
Following steps are involved
a. Select chrome from toolbar in Netbeans.
b. Right Click
i. Use Run File option.
d. Once the connector is installed. Netbeans icon is visible on bar.
e. Press “Re-Run Project” in Netbeans.
f. “Netbeans Connector is debugging this tab” will display on browser for debugging. Don’t cancel this yellow bar otherwise it will not work.
g. Put the bookmark in the left grey border of Source window using mouse click
h. Execute each step. Other windows are also displayed for Browser DOM and CSS Style.
i. One can monitor the values on each steps of execution for CSS and JavaScript in Browser Log.
No comments:
Post a Comment