Posts in Category: web ui

HOW TO PERFORM DEBUGGING IN ENTERPRISE 2.0 – WEB UI

Debugging allows you to run a program interactively while watching the source code and the variables during the execution.

By breakpoints in the source code you specify where the execution of the program should stop. To stop the execution only if a field is read or modified, you can specify watchpoints .

Breakpoints and watch points can be summarized as stop points.

Once the program is stopped you can investigate variables, change their content, etc.

[divider]

Now once the environment is set up in Adempiere we need to start the Product in Debug Mode of Desktop UI. In order to do that you must follow the following steps:-

  • Right Click on the Project and select the Debug As and Debug on Server which has Tomcat already selected.

image001

  • When we have entered the Debug Mode, the First Class that comes up is Adempiere Class.
  • In Case of WEB UI it goes to Web UI Servlet.java which is the class for zk Web UI
  • Then the Login Page Opens Up, now in Order to debug we need to apply debug points which signify that the compiler needs to stop here while processing the code and wait for the user confirmation such that the code stops at that point.
  • We can Apply Debug points by double clicking on the code such that the Debug Point is created and once in Debug Mode the compiler will stop there.
  • Eclipse provides buttons in the toolbar for controlling the execution of the program you are debugging. Typically it is easier to use the corresponding keys to control this execution.
  • You can use the F5, F6, F7 and F8 key to step through your coding. The meaning of these keys is explained in the following table.

 

Table 1. Debugging key bindings / shortcuts

Key Description
F5 Executes the currently selected line and goes to the next line in your program. If the selected line is a method call the debugger steps into the associated code.
F6 F6 steps over the call, i.e. it executes a method without stepping into it in the debugger.
F7 F7 steps out to the caller of the currently executed method. This finishes the execution of the current method and returns to the caller of this method.
F8 F8 tells the Eclipse debugger to resume the execution of the program code until is reaches the next breakpoint or watch point.
  • The following picture displays the buttons and their related keyboard shortcuts.

image003

 

  • The call stack shows the parts of the program which are currently executed and how they relate to each other. The current stack is displayed in the Debug view.

image004

  • Changing variable assignments in the debugger

The Variables view allows you to change the values assigned to your variable at runtime. This is depicted in the following screenshot.

image006

  • Now when we enter in Debugging Mode some classes need to be remembered in order to debug the code. For Instance we need to start with the Generic Class
  • Start by applying debug mode in the Web UI Servlet.java Class in the Init() such that the compiler stops in the method and Debug Mode is present.
  • Once in the class u can use F5, F6, F7 and F8 key to step through your coding and go through the flow.

 

For Different Processes and Windows we need to have multiple processes or classes such that when we need to Debug the process we call that Class.

The index for such is as Follows:-

Class in Eclipse Process
MInOut.javaMInOutLine.java Material Receipt, Shipment(Customer), Vendor Return, Customer Return,
MOrder.javaMOrderLine.java Purchase Order  &  Sales Order,
MInvoice.javaMInvoiceLine.java

MInvoiceTax.java

Invoice (Vendor) and Customer (Invoice) 

For Calculating Invoice Tax.

BPartner.java Business Partner in Adempiere
ALogin.java Login Class For Adempiere  such that while in case of change of login page or anything else in Login
AMenu.java To change the Menu Entries we need to change the class when we need to add entry in the Adempiere ERP.
WCreateFromWindow.java To make Menus in WEBUI and add buttons.
WCreateBatchSerialInoutLine.javaWCreateInventorySerialInOutLine.java Create batches in WebUI and edit and add CodeCreate Inventory Batches in Physical Inv and Internal Use Inventory
AbstractADWindowPanel.java Debug this Class for adding buttons and defining where buttons go on click.
Product.java To Add Products such and define parameters in it.
MInventory.javaMInventoryLine.java Inventory Management such that,  Inventory and line Qty are Managed
MRMALine.java Processing Returns such that , both Customer RMA and Vendor RMA are created here.
MPayment.javaMPaymentAllocate.java To Process Payments,  and to Allocate Payments to the InvoicesAllocate Payments , to the Invoices

 

  • If u need to debug these Processes u need to Apply Debug Points in the respective classes such that to change code there.
  • If u need to search any class in Eclipse u need to use the combination of Ctrl+Shift+T and enter the class name.
  • Use * with the name to increase your search criteria.
  • If u need to skip Debug points u can use the Button on the top of eclipse which looks like this    image008
  • Until unless u release this button the Debug won’t work.
  • Some Classes here as different from Desktop UI such that, in batch module in case of Desktop we have VCreateBatchSerialInOutLine.java while in case of Window we have WCreateBatchSerialInOutLine.java due to difference of frameworks.

 

 

-By Adempiere Support {India Portal}

Read More

ADEMPIERE – INSTALLING TOMCAT SERVER FOR DEBUGGING OF WEB UI IN ECLIPSE

Files Needed:

  1. Apache Tomcat 6.0.41 (Or Any Version)
  2. Eclipse – IDE for Java EE Developers
  3. System Browser

[divider]

Process:-

  1. Install Tomcat Runtimes
    1. First, you need to install a Tomcat runtime for the deploying and running of the zk Web Client. Use Tomcat 5.5+
    2. To install a new Tomcat runtime, open the preferences dialog Window->Preferences and select the Server->Installed Runtimes. Use the Search button to locate your tomcat installation home folder.

image001

  1. Define a New Server

At the Servers view, right click to open the context menu and select New->Server.

If server view is not visible then you can use Window→Show View→Others … to open it. 

 image003

  1. Select the correct server type and the server runtime you have setup earlier.

image005

  1. Add your project to the server instance to be created

  image007

  1. The created server instance is now ready for use. Just Start the server once and then stop it. Do not try to debug it at this moment.

  image009

  1. Define location of ADempiere property file (NotePad File …available in your base folder )and ADempiere home (Place where your code is kept)

 

Now you have to define the location of your existing working ‘Adempiere.properties’ file and ADEMPIERE_HOME as system parameter for your Tomcat Instance. To do so, select Run->Open Run Dialog… and select the server instance you have created.

 

 

Note that the entries for your server instance in the Run dialog will only be created after you have start it for at least one time. Select the arguments tab and append your property file path and home parameter at the end of VM arguments.

It is highlighted in the pictures below:

 image011

 

  1. In Run Config Add in it in the same series, do not change the series.

Go to classpath section at user entries add external libs from tomcatlib (or tomcatserverlib) than add project – AdempiereTrunk

Apache jars needs to be at the first place in the classpath. See the image carefully along with the description below.

 

  • Bootstrap Entries
  • JRE Library
  • User Entries
  • tomcat_dir/bin/*.jar
  • tomcat_dir/server/lib/*.jar
  • E2 Project or Trunk
  • Adempiere Libraries i.e. add jasperreport 5.6.0 jar, if not available download, it from Internet

 image013

  1. Now Run in Debug Mode, by Right Clicking on the  Project and selecting Run in Debug Mode
  2. Choose the Browser such that, the browser can be used internal or External Browser.
  3. In case Run of the Project in WebUI, right Click on the project and select run project on Web Server.
  4. Your Version will then open in Debug Mode and in order to learn debugging do follow the next document on Debugging.

[divider]

DO REMEMBER

  1. If u need to change the Database of the WebUI you can do by Changing in the Adempire Properties File , just replace the Username and Password.
  2. Run Configuration is not created till u once start and stop the server.
  3. If your Build is getting failed , observe the errors completely such that you should know which WEB classes are interacting with Desktop Classes and separate them.

 

 

-By Adempiere Support {India Portal}

Read More