Viewer Application Context Object error with PDF's, Excel [message #263551] |
Wed, 19 December 2007 10:05  |
Eclipse User |
|
|
|
Originally posted by: spaddock.rogers.com
In an effort not to expose certain parameters in the raw HTML like BIRT
currently does with report parameters (see snippet below) I thought I
could use the application context variable as described in the wiki:
http://wiki.eclipse.org/Adding_an_Object_to_the_Application_ Context_for_the_Viewer_%28BIRT%29#Introduction
<TD NOWRAP WIDTH="100%">
<INPUT TYPE="HIDDEN" ID="control_type" VALUE="hidden">
<INPUT TYPE="HIDDEN"
NAME="myid"
VALUE="12"/>
<INPUT TYPE="HIDDEN"
ID="myid_displayText"
VALUE="12" />
</TD>
I found that worked great for the first pass, i could assign
MyTest.toString() to dataset parameters without ever having to set overall
report parameters. However, in the viewer I wasn't able to generate a
PDF, Excel etc. I would get a stack trace like this:
ReportDesign (id = 1):
- Retrieving binding data error
t
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.eclipse.birt.data.engine.core.DataException: Invalid
expression to retrieve value in presentation.
at
org.eclipse.birt.data.engine.impl.document.util.ExprResultSe t.getValue(ExprResultSet.java:130)
at
org.eclipse.birt.data.engine.impl.document.ResultIterator.ge tValue(ResultIterator.java:150)
at
org.eclipse.birt.report.engine.data.dte.QueryResultSet.getVa lue(QueryResultSet.java:309)
at
org.eclipse.birt.report.engine.internal.document.v4.DataItem Executor.doExecute(DataItemExecutor.java:84)
... 69 more
How do the AJAX controls work? Obviously the request is gone after the
web report is displayed. Is this the reason for the hidden parameter
variables in the first place? If what I'm trying to accomplish can't be
done what is the purpose of using the application context object? Is it
just to get objects inside the report and script them to report
parameters? Or can you only use the application context object to display
the first report?
Any help would be greatly appreciated as I don't have much hair left to
pull out.
Kindest regards,
Shayne
|
|
|
|
Re: Viewer Application Context Object error with PDF's, Excel [message #263585 is a reply to message #263572] |
Wed, 19 December 2007 13:03   |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Shayne,
I see what the problem is now. This appears to be an issue with how the
ajax framework is building its url to submit exports and other things.
As a work around you could open the framesetfragment.jsp page and add
the following:
var qstring = "<%= request.getRequestURL() %>" +
"?<%=request.getQueryString() %>";
right above this line:
var soapURL = document.location.href;
Then open the BirtExportReportDialog.js and change this line:
var action = soapURL;
var action = qstring; //soapURL;
This code will most likely have to be changed in other locations in the
AJAX framework, so I will open a bugzilla entry for this issue. A
better option in your case is to add your object to session and retrieve
it that way.
Jason
Jason Weathersby wrote:
> Shayne,
>
> If you create a blank report and add the data item in the app context
> and run to pdf does this work?
>
> Can you post your report? Also you can get at session variables in
> script. Not sure if this is what you want, but it may help.
>
> Jason
>
> Shayne Paddock wrote:
>> In an effort not to expose certain parameters in the raw HTML like
>> BIRT currently does with report parameters (see snippet below) I
>> thought I could use the application context variable as described in
>> the wiki:
>> http://wiki.eclipse.org/Adding_an_Object_to_the_Application_ Context_for_the_Viewer_%28BIRT%29#Introduction
>>
>>
>> <TD NOWRAP WIDTH="100%">
>> <INPUT TYPE="HIDDEN" ID="control_type" VALUE="hidden">
>> <INPUT TYPE="HIDDEN"
>> NAME="myid"
>> VALUE="12"/>
>> <INPUT TYPE="HIDDEN"
>> ID="myid_displayText"
>> VALUE="12" />
>> </TD>
>>
>>
>> I found that worked great for the first pass, i could assign
>> MyTest.toString() to dataset parameters without ever having to set
>> overall report parameters. However, in the viewer I wasn't able to
>> generate a PDF, Excel etc. I would get a stack trace like this:
>>
>> ReportDesign (id = 1):
>> - Retrieving binding data error
>>
>> t
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
>>
>> at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
>> at java.lang.Thread.run(Thread.java:595)
>> Caused by: org.eclipse.birt.data.engine.core.DataException: Invalid
>> expression to retrieve value in presentation.
>> at
>> org.eclipse.birt.data.engine.impl.document.util.ExprResultSe t.getValue(ExprResultSet.java:130)
>>
>> at
>> org.eclipse.birt.data.engine.impl.document.ResultIterator.ge tValue(ResultIterator.java:150)
>>
>> at
>> org.eclipse.birt.report.engine.data.dte.QueryResultSet.getVa lue(QueryResultSet.java:309)
>>
>> at
>> org.eclipse.birt.report.engine.internal.document.v4.DataItem Executor.doExecute(DataItemExecutor.java:84)
>>
>> ... 69 more
>>
>> How do the AJAX controls work? Obviously the
>> request is gone after the web report is displayed. Is this the reason
>> for the hidden parameter variables in the first place? If what I'm
>> trying to accomplish can't be done what is the purpose of using the
>> application context object? Is it just to get objects inside the
>> report and script them to report parameters? Or can you only use the
>> application context object to display the first report?
>>
>> Any help would be greatly appreciated as I don't have much hair left
>> to pull out.
>>
>>
>> Kindest regards,
>> Shayne
>>
>>
>>
|
|
|
Re: Viewer Application Context Object error with PDF's, Excel [message #263587 is a reply to message #263585] |
Wed, 19 December 2007 13:18   |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=213503
Jason Weathersby wrote:
> Shayne,
>
> I see what the problem is now. This appears to be an issue with how the
> ajax framework is building its url to submit exports and other things.
>
> As a work around you could open the framesetfragment.jsp page and add
> the following:
>
> var qstring = "<%= request.getRequestURL() %>" +
> "?<%=request.getQueryString() %>";
>
> right above this line:
> var soapURL = document.location.href;
>
> Then open the BirtExportReportDialog.js and change this line:
> var action = soapURL;
> var action = qstring; //soapURL;
>
>
> This code will most likely have to be changed in other locations in the
> AJAX framework, so I will open a bugzilla entry for this issue. A
> better option in your case is to add your object to session and retrieve
> it that way.
>
>
> Jason
>
> Jason Weathersby wrote:
>> Shayne,
>>
>> If you create a blank report and add the data item in the app context
>> and run to pdf does this work?
>>
>> Can you post your report? Also you can get at session variables in
>> script. Not sure if this is what you want, but it may help.
>>
>> Jason
>>
>> Shayne Paddock wrote:
>>> In an effort not to expose certain parameters in the raw HTML like
>>> BIRT currently does with report parameters (see snippet below) I
>>> thought I could use the application context variable as described in
>>> the wiki:
>>> http://wiki.eclipse.org/Adding_an_Object_to_the_Application_ Context_for_the_Viewer_%28BIRT%29#Introduction
>>>
>>>
>>> <TD NOWRAP WIDTH="100%">
>>> <INPUT TYPE="HIDDEN" ID="control_type" VALUE="hidden">
>>> <INPUT TYPE="HIDDEN"
>>> NAME="myid"
>>> VALUE="12"/>
>>> <INPUT TYPE="HIDDEN"
>>> ID="myid_displayText"
>>> VALUE="12" />
>>> </TD>
>>>
>>>
>>> I found that worked great for the first pass, i could assign
>>> MyTest.toString() to dataset parameters without ever having to set
>>> overall report parameters. However, in the viewer I wasn't able to
>>> generate a PDF, Excel etc. I would get a stack trace like this:
>>>
>>> ReportDesign (id = 1):
>>> - Retrieving binding data error
>>>
>>> t
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
>>>
>>> at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
>>> at java.lang.Thread.run(Thread.java:595)
>>> Caused by: org.eclipse.birt.data.engine.core.DataException: Invalid
>>> expression to retrieve value in presentation.
>>> at
>>> org.eclipse.birt.data.engine.impl.document.util.ExprResultSe t.getValue(ExprResultSet.java:130)
>>>
>>> at
>>> org.eclipse.birt.data.engine.impl.document.ResultIterator.ge tValue(ResultIterator.java:150)
>>>
>>> at
>>> org.eclipse.birt.report.engine.data.dte.QueryResultSet.getVa lue(QueryResultSet.java:309)
>>>
>>> at
>>> org.eclipse.birt.report.engine.internal.document.v4.DataItem Executor.doExecute(DataItemExecutor.java:84)
>>>
>>> ... 69 more
>>>
>>> How do the AJAX controls work? Obviously the
>>> request is gone after the web report is displayed. Is this the
>>> reason for the hidden parameter variables in the first place? If
>>> what I'm trying to accomplish can't be done what is the purpose of
>>> using the application context object? Is it just to get objects
>>> inside the report and script them to report parameters? Or can you
>>> only use the application context object to display the first report?
>>>
>>> Any help would be greatly appreciated as I don't have much hair left
>>> to pull out.
>>>
>>>
>>> Kindest regards,
>>> Shayne
>>>
>>>
>>>
|
|
|
|
Re: Viewer Application Context Object error with PDF's, Excel [message #263643 is a reply to message #263612] |
Thu, 20 December 2007 10:36  |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Shayne,
Put this in the onCreate of the label. beforeFactory is called before
the onPrepare event.
Jason
> myvar = reportContext.getPersistentGlobalVariable('myBirtId').toStri ng();
> this.text = myvar;
Shayne Paddock wrote:
> Thanks for logging the bug Jason it's good to no I haven't gone crazy...
> yet.
>
> I added my variables to the session and in the expression builder for a
> dataset parameter calling:
> reportContext.getHttpServletRequest().getSession().getAttrib ute( "birtId");
> seems to work.
>
> When I looked at the "Retrieve Session Information" wiki I figured
> setting a global variable would be a better approach.
>
> So inside beforeFactory I wrote:
> var myid =
> reportContext.getHttpServletRequest().getSession().getAttrib ute( "birtId");
> reportContext.setPersistentGlobalVariable("myBirtId", myid);
>
> and then tried to verify it was being set by creating a label and in
> its' onPrepare method writing:
> myvar = reportContext.getPersistentGlobalVariable('myBirtId').toStri ng();
> this.text = myvar;
>
> I ran the report and the label was blank.
>
> Oddly enough I moved the code out of the beforeFactory event over to the
> initialize event and it populated the label properly but with the
> following stack trace:
>
> ReportDesign (id = 1):
> - There are errors evaluating script "var myid =
> reportContext.getHttpServletRequest().getSession().getAttrib ute( "BIRTListOwnerId");
>
> reportContext.setPersistentGlobalVariable("myBirtId", myid);":{1}.
>
> Error.ScriptEvaluationError ( 1 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: There are
> errors evaluating script "var myid =
> reportContext.getHttpServletRequest().getSession().getAttrib ute( "BIRTListOwnerId");
>
> reportContext.setPersistentGlobalVariable("BIRTID", myid);":{1}.
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:577)
>
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:550)
>
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJSInternal(ScriptExecutor.java:60)
>
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecuto r.handleJS(ScriptExecutor.java:44)
>
> at
> org.eclipse.birt.report.engine.script.internal.ReportScriptE xecutor.handleInitialize(ReportScriptExecutor.java:30)
>
> at
> org.eclipse.birt.report.engine.api.impl.EngineTask.loadDesig n(EngineTask.java:1083)
>
> at
> org.eclipse.birt.report.engine.api.impl.RenderTask.<init>(RenderTask.java:70)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.c reateRenderTask(ReportEngineHelper.java:438)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngine.createR enderTask(ReportEngine.java:403)
>
> at
> org.eclipse.birt.report.service.ReportEngineService.renderRe port(Unknown
> Source)
> at
> org.eclipse.birt.report.service.ReportEngineService.renderRe port(Unknown
> Source)
> at
> org.eclipse.birt.report.service.BirtViewerReportService.getP age(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.AbstractGetPag eActionHandler.doExecution(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.AbstractGetPag eActionHandler.__execute(Unknown
> Source)
> at
> org.eclipse.birt.report.service.actionhandler.AbstractBaseAc tionHandler.execute(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseDoc umentProcessor.__executeAction(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseCom ponentProcessor.executeAction(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.processor.BirtDocumentPro cessor.handleGetPage(Unknown
> Source)
> at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseCom ponentProcessor.process(Unknown
> Source)
> at
> org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingI mpl.getUpdatedObjects(Unknown
> Source)
> at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCP rovider.java:397)
>
> at
> org.apache.axis.providers.java.RPCProvider.processMessage(RP CProvider.java:186)
>
> at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvi der.java:323)
> at
> org.apache.axis.strategies.InvocationStrategy.visit(Invocati onStrategy.java:32)
>
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService .java:453)
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281 )
> at org.apache.axis.transport.http.AxisServlet.doPost(AxisServle t.java:699)
> at
> org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherSer vlet.doPost(Unknown
> Source)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisS ervletBase.java:327)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:290)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(Applic ationDispatcher.java:654)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.processReques t(ApplicationDispatcher.java:445)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.doForward(App licationDispatcher.java:379)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.forward(Appli cationDispatcher.java:292)
>
> at com.zdirect.ReportManager.doPost(ReportManager.java:775)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:290)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
>
> at
> com.zdirect.web.HibernateSessionRequestFilter.doFilter(Hiber nateSessionRequestFilter.java:36)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:235)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:233)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:175)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:128)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:109)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:263)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:844)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
>
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call
> method "getSession" of null (<inline>#1)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
>
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
>
> at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime .java:3246)
> at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntim e.java:3265)
> at
> org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRu ntime.java:3284)
>
> at
> org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis( ScriptRuntime.java:1965)
>
> at
> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRun time.java:114)
> at org.mozilla.javascript.gen.c311._c0(<inline>:1)
> at org.mozilla.javascript.gen.c311.call(<inline>)
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
> at org.mozilla.javascript.gen.c311.call(<inline>)
> at org.mozilla.javascript.gen.c311.exec(<inline>)
> at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContex t.java:223)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:571)
>
> ... 62 more
>
> Have I not followed the event model properly?
>
> As a side note, for some reason when I click the "Print PDF" ajax
> control in my reports (while debugging the ajax bug) I'd have to press
> the button twice, the first time it regenerated the HTML report, the
> second time it created the PDF? Perhaps I should post that as a
> seperate issue.
>
>
> Kindest regards,
> Shayne
>
|
|
|
Powered by
FUDForum. Page generated in 0.03612 seconds