Weird Issue

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Weird Issue

Postby joshua » Sat Dec 27, 2014 4:42 pm

We are using Servoy for an order management app. Within this app there is a button for the user to click to export orders to our ERP system.

This export button, when clicked, launches a headless client. We then use object.queueMethod() to launch a function within this headless client. This function then launches a custom written exe on the servoy server with application.executeProgram which exports orders from our database to our erp system. The output from this exe is captured by the headless client and displayed to the user through a callback function.

This all works fine usually.

However, for other reasons, we've had to switch to using a batch file on the servoy server which uses psexec to launch the exe directly on the server for our erp in order to run the export. The export runs fine and the orders are moved as expected but oddly not all of the output is captured from the exe. Commonly only 1 line of output is captured. Sometimes, rarely, no output is returned.

When the batch file is ran directly from the servoy server all output is returned as expected. Just when running within the headless the output is behaving oddly.

Any idea what would cause the headless client to truncate the output?

I should add this output is written to a log file on the server also. The log file reflects the truncated export when running from the headless client and correctly shows the full output when running directly on the servoy server.
joshua
 
Posts: 10
Joined: Sat Apr 21, 2012 10:56 pm

Re: Weird Issue

Postby ROCLASI » Sun Dec 28, 2014 9:45 am

Hi Joshua,

How is the output captured by the headless client?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Weird Issue

Postby jcompagner » Mon Dec 29, 2014 11:50 am

We don't really control i think the output, thats just what Runtime.exec gives use back.
Are you sure if you run it through a batck file that that is not really running or spawning a separate process?
What log do you see is it the first lines or the last lines?

Maybe just write it to disk the output of the console and read that file back in?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Weird Issue

Postby joshua » Wed Dec 31, 2014 8:12 pm

We've tried capturing the output two different ways

Here's the code that is launched within a headless client that is created with the onAction method of a button in our order management app.

Code: Select all
function runImporter() {
   application.output("BatchProcessor Starting", LOGGINGLEVEL.INFO)
   //var result = application.executeProgram('C:\\MASOrderImport\\MASOrderImport.exe', '#', '#', 'C:\\MASOrderImport\\');
   var result = application.executeProgram('C:\\MASOrderImport\\OrderImport.bat', '#', '#', 'C:\\MASOrderImport\\');

   //var result = plugins.file.readTXTFile('C:\\MASOrderImport\\log.txt')
   application.output(result, LOGGINGLEVEL.INFO)
   return result
}


We've tried with capturing the output directly into the result variable and also with reading the log.txt into the result variable file after running.

Both methods return the same results. The part of the expected log entry that is written to log.txt is the first line.

I removed capturing the output to result and grabbing the log.txt file and still the log file only shows the first expected line when the .bat is launched from servoy.

When running the bat natively on the server the log file is written in full as expected oddly.
joshua
 
Posts: 10
Joined: Sat Apr 21, 2012 10:56 pm

Re: Weird Issue

Postby jcompagner » Mon Jan 05, 2015 11:15 am

the only thing i can think of is that the output after the second line is done as an error output

We don't capture the error output in the executeProgram call.

Not sure if you can see that when execution from the console (if it is error or just log output)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 3 guests