[oXygen-user] Oxygen 16.1 - Marklogic debugging scenarios

Frank Mortier
Wed Jan 7 10:31:31 CST 2015


Dear Alex,

Thank you for "discovering" another limitation on debugging a ML application. I am looking forward to the views of the ML people. You may put me in cc if you wish.

Meanwhile I will probably (partly) reassemble my code allowing me to debug the code more easily. In any event, I will try this weekend to see if your solution is workable and satisfactory from an efficiency point of view.

Frank



From: Alex Jitianu [mailto:]
Sent: 07 January 2015 14:01
To: Frank Mortier; 
Subject: Re: [oXygen-user] Oxygen 16.1 - Marklogic debugging scenarios

Dear Frank,

Your observation was right on target. The cause of the problem is the fact that the module is being invoked with xdmp:eval() instead of being explicitly imported and referred. We are using Marklogic's dbg:line() function [1] to get the expression ID on which to invoke dbg:break() [2]. It is this call to dbg:line() that throws the exception and complains about not finding the module. Another aspect is that you can't get into these modules with the debugger. If you try to Step In on such an xdmp:eval() call you will see that the debugger will just go over it. All these are limitations of the API provided by MarkLogic so I've wrote an email to their support list reporting the issue and asking for possible solutions. I will keep you informed about the resolution and if you want I can also put you on CC to the emails we exchange.

Until markLogic offers a solution it means that you will have to break the debugging session. For example when you reach an xdmp:eval() call you should decide if the result of this call is correct or it needs debugging. You can do that by:
- put a breakpoint on the xdmp:eval() line and run to breakpoints
- copy and paste the entire xdmp:eval() inside the XWatch View (when the debugger has reach it in the execution)

After deciding that you want to debug the xdmp:eval() call you must get the actual query from xdmp:eval() For a query like this:

xdmp:eval(fn:concat($import-declaration, $function-call),
                (),
                <options xmlns="xdmp:eval">
                    <isolation>different-transaction</isolation>
                    <prevent-deadlocks>true</prevent-deadlocks>
                </options>
            )

you can use the XWatch View and evaluate there fn:concat($import-declaration, $function-call). You will obtain something like this:

import module namespace xqmvc-ctrlr = "http://scholarsportal.info/xqmvc/controller"<http://scholarsportal.info/xqmvc/controller> at "/application/controllers/welcome.xqy";xqmvc-ctrlr:index()

Copy and paste it in a new XQuery editor and start the debugger over it directly from Oxygen. I know that this is a lot more complicated then it should be but until we get word from MarkLogic there isn't much we can do in this matter.

[1] http://docs.marklogic.com/dbg:line
[2] http://docs.marklogic.com/dbg:break



Best regards,

Alex

--

Alex Jitianu

<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger

http://www.oxygenxml.com
On 1/5/2015 7:51 PM, Frank Mortier wrote:
Dear Alex,

Thank you for taking the time to look at this.

I am using 7.0-2.2 server version on a desktop windows 8.1. and the attached version of xqmvc 0.1.3 build. Sample test files are included in the build.

I have indeed tried a remote HTTP debugging session in accordance with your instructions and set breakpoints in the xqmvc.xqy file, the application controller files and application modules files. These module were opened from data source.

Note that the files containing a breakpoint are not invoked by the main module but by intermediary modules (a hierarchical structure). Debugging seems only to work on files directly invoked by the main module, at least it does so on the xqmvc.xqy file, which is invoked by the main module (index.xqy).

Frank

From: <mailto:> [mailto:] On Behalf Of Alex Jitianu
Sent: 05 January 2015 15:46
To: <mailto:>
Subject: Re: [oXygen-user] Oxygen 16.1 - Marklogic debugging scenarios

Hello Frank,

Could you please tell me what MarkLogic Server version are you using? Also what xqmvc build? I want to test it myself and see what happens. It would help if you have any XQuery sample files that I could test with this framework.

You are trying to do a remote HTTP debugging session, right? Attach from Oxygen and debug an HTTP request that was already started probably using the browser?

I see that you've already studied in depth our resources about how to debug in MarkLogic but just in case it might help, the steps required for remote HTTP debugging are:
- create a connection in Oxygen using an XDBC App server that has the same module configuration as the HTTP one
- put the HTTP server in debug mode using the Data Source Explorer, right click on the HTTP App server and "Enable debug mode"
- return to the browser and initiate the request
- return to Oxygen and from the "Requests" container of the HTTP App server right click on the request and choose "Debug"

After these steps the debugger will be up and running and no breakpoints are yet added.  Do you get this far? The warning you are receiving complains about some breakpoints. Have you set any breakpoints? If you have, are they in the main module or in a library module? And if they are in a library module how was this library module opened? From the Data Source Explorer?

I've tested the previous procedure on the Shakespeare Demo [1] application.

Thank you for taking the time to help us shed some light on this situation.

PS: A transformation scenario is used to transform/execute an XQuery file. A validation scenario is used to configure what engine should be used to validate an XQuery file (for example while you work on it - automatic validation). A validation scenario also help when working on library modules because you can specify the main module from which the validation can start.

[1] http://developer.marklogic.com/code/bill

Best regards,

Alex

--

Alex Jitianu

<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger

http://www.oxygenxml.com
On 1/4/2015 9:15 AM, Frank Mortier wrote:
Dear all:

I acquired Friday Oxygen 16.1 in order to debug a Marklogic application. I have encountered the same problem as Jacob in http://www.oxygenxml.com/pipermail/oxygen-user/2013-June/004698.html.

The ML application uses the xqmvc framework whereby the main file is index.xqy, but the routing is provided by another module xqmvc.xqy, importing controller files which import modules.

See e.g.: http://www.marklogic.com/blog/founders-online-lesson-performance/ and https://code.google.com/p/xqmvc/

I have been unsuccessfully testing various debugging scenarios yesterday, amongst others including all xqy files.

I was also not able to debug a module in the basic framework.

Related: what is the difference between using a validation scenario or a transformation scenario. I notice a difference between the documentation and the demo at http://www.oxygenxml.com/demo/XQueryDebuggerforMarkLogic.html

Any suggestions?

Frank







_______________________________________________

oXygen-user mailing list

<mailto:>

http://www.oxygenxml.com/mailman/listinfo/oxygen-user


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20150107/04d22811/attachment.html>


More information about the oXygen-user mailing list