What I have is a simple app that gets parameters from the bookmark. The parameters are read in the post open event, where the bookmark is parsed and the variables are assigned to the bind variables that the datasource needs. The only other component created in Formspider is the datasource definition existing of a query using a table function with a bind variable. No panels, other than what default is created, no single change in the xml for that. My intention is to have nothing on screen. (currently is does show the default main panel).

From the logging I made I can see that my table function is called when I issue

api_datasource.printToExcel(args ...)

yet my excel file still contains 0 bytes. Even when the queries return 0 rows, the table function does return results. I can see that results are returned, at least, for every pipe row command I dump what is returned in the log table and what is in the log table looks valid.

my understanding of api_datasource.printToExcel is that there does not need to be data on screen.

In the server.log I found this NPE: [#|2013-03-06T09:13:07.386+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-3;|java.lang.NullPointerException|#]

asked 05 Mar '13, 03:39

ik_zelf's gravatar image

accept rate: 16%

edited 06 Mar '13, 03:15

Hi Ronald,

As you mentioned, there is no need to display data on screen to use api_datasource.printToExcel API. Since your excel file contains 0 bytes, an error might be occurred during the excel generation process. Are you able to open the generated file? I guess you will get an error in this case.

Can you check your middle-tier logs? A Java PermSize error might be occurred during the class load. Can you restart your app server and retry excel export?


(05 Mar '13, 04:22) Ibrahim Sand... ♦♦

I restarted glassfish and retested. No messages in the server.log and the generated xlsx is 0 bytes.

(05 Mar '13, 06:24) ik_zelf

Can you add a grid in your mainPanel using the excel datasource and try to generate excel output using the api_component.printToExcel API? If it doesn't work, can you please send your datasource definition query, sample data/table scripts and postOpen event code to contact@theformspider.com?

Thanks in advance,

(05 Mar '13, 06:52) Ibrahim Sand... ♦♦

Hi Ibrahim, it looks like a timing problem. I need to get the argument for the datasource query from the bookmark. The query for the datasource runs before the bind variable is defined/visible for the query process. Also tried moving the getbookmark and set bindvar to the pre open event. Still the datasource query runs without valid input. On entry of the table function that is used by the datasource I check the argument, if null get the bind variable. Both are empty. Does my observation make any sense?

(05 Mar '13, 11:12) ik_zelf

I moved the getbookmark and set bindvar to the pre query event. Now the grid is filled with correct data, the excel dumps (both from grid and from datasource) remain empty.

(05 Mar '13, 11:37) ik_zelf

Hi Ronald,

I believe the cause of the problem may be similar with the problem you have experienced in this thread. This problem also generally occurs when your OS user doesn't have necessary permissions to create file/write data to the "temp" folder existing in the middle-tier (a temporary file needs to be created under this folder during the file download process this time). Can you check it please?

(06 Mar '13, 03:04) Ibrahim Sand... ♦♦

Only msg I find is [#|2013-03-06T09:13:07.386+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=24;_ThreadName=Thread-3;|java.lang.NullPointerException|#] This happens when I try to download from datasource. (updating question with this info) BTW: the glassfish process owner is also the glassfish installation owner on OS so ... it should be able to modify/create any file within glassfish/ Also: in the mentioned thead a re-install/upgrade of glassfish was done after which the upload worked.

(06 Mar '13, 03:14) ik_zelf
showing 5 of 7 show 2 more comments

With a little help from Ibrahim we found that the issue could be caused by ojdbc6.jar. A little test showed that the error did no longer popup after switching to ojdbc5.jar For me now: problem solved, thanks Ibrahim.


answered 06 Mar '13, 08:53

ik_zelf's gravatar image

accept rate: 16%

and make sure, that your DISPLAY environment variable is not set to an inaccessible display like :1.0 when your VNC is running on :2.0



befor you start tomcat. First, I corrected the DISPLAY environment variable to point to the correct screen number, PrintToExcel worked nicely. Then I shut down tomcat and did unset DISPLAY before restarting. PrintToExcel still working.


answered 27 Nov '14, 12:12

dipr's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 05 Mar '13, 03:39

Seen: 2,125 times

Last updated: 27 Nov '14, 12:12

© Copyright Gerger 2017