Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Uh-Oh (re: #786618)
Uh-Oh (re: #786618) [message #786751] Mon, 30 January 2012 19:35 Go to next message
Mike Schlossberg is currently offline Mike Schlossberg
Messages: 12
Registered: January 2012
Junior Member
I just tried the solution presented in message #786618 to accomplish a redirect upon an error condition (bad DB username / password). This seems to work fine from the Designer, but when I deploy the report to Tomcat, I get the following (note that the code resides in the onCreate event of a table (id=935).

Any idea what I need to do differently to make this work from the web viewer (deployed to Tomcat)?

TypeError: Cannot call method "getTask" of null (/report/body/table[@id="935"]/method[@name="onCreate"]#5) (Element ID:935)

birt.core.JavascriptCommonError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "var taskid = 
reportContext.getHttpServletRequest().getAttribute("attributeBean").getTaskId();


var mytask = 
reportContext.getHttpServletRequest().getSession().getAttribute("tasks").get(taskid).getTask();


if( !mytask.getErrors().isEmpty() ){
//you could iterate the errors here as well
reportContext.setGlobalVariable("myerrors",true);
}else{
reportContext.setGlobalVariable("myerrors", false);
}":
TypeError: Cannot call method "getTask" of null (/report/body/table[@id="935"]/method[@name="onCreate"]#5) (Element ID:935)

Re: Uh-Oh (re: #786618) [message #787447 is a reply to message #786751] Tue, 31 January 2012 15:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Mike

What version of BIRT are you using and what app server. This worked
fine on my deployment. Also are you using the viewer?

Jason

On 1/30/2012 2:35 PM, Mike Schlossberg wrote:
> I just tried the solution presented in message #786618 to accomplish a
> redirect upon an error condition (bad DB username / password). This
> seems to work fine from the Designer, but when I deploy the report to
> Tomcat, I get the following (note that the code resides in the onCreate
> event of a table (id=935).
> Any idea what I need to do differently to make this work from the web
> viewer (deployed to Tomcat)?
>
>
> TypeError: Cannot call method "getTask" of null
> (/report/body/table[@id="935"]/method[@name="onCreate"]#5) (Element ID:935)
>
> birt.core.JavascriptCommonError ( 1 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: There are
> errors evaluating script "var taskid =
> reportContext.getHttpServletRequest().getAttribute("attributeBean").getTaskId();
>
>
>
> var mytask =
> reportContext.getHttpServletRequest().getSession().getAttribute("tasks").get(taskid).getTask();
>
>
>
> if( !mytask.getErrors().isEmpty() ){
> //you could iterate the errors here as well
> reportContext.setGlobalVariable("myerrors",true);
> }else{
> reportContext.setGlobalVariable("myerrors", false);
> }":
> TypeError: Cannot call method "getTask" of null
> (/report/body/table[@id="935"]/method[@name="onCreate"]#5) (Element ID:935)
>
>
Re: Uh-Oh (re: #786618) [message #789346 is a reply to message #787447] Thu, 02 February 2012 22:13 Go to previous messageGo to next message
Mike Schlossberg is currently offline Mike Schlossberg
Messages: 12
Registered: January 2012
Junior Member
My test env.: win 7, Eclipse 3.7.0, Tomcat 7.

I'm not sure what was up. I was under a bit of a deadline so I ended up un-jar-ing viewservlets.jar, then I added a big blurb in the paramter box prompt message about how 'the red error message means that you've entered your username and password incorrectly -- use your browser's back button if this happens' and the re-jar-ed . . . this was good enough.

I would like to work this out for future projects, though.

Even better would be a way to edit the message text, catch the actual error at this level, etc.
Re: Uh-Oh (re: #786618) [message #789958 is a reply to message #789346] Fri, 03 February 2012 16:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you log an enhancement for this?

Jason

On 2/2/2012 5:13 PM, Mike Schlossberg wrote:
> My test env.: win 7, Eclipse 3.7.0, Tomcat 7.
> I'm not sure what was up. I was under a bit of a deadline so I ended up
> un-jar-ing viewservlets.jar, then I added a big blurb in the paramter
> box prompt message about how 'the red error message means that you've
> entered your username and password incorrectly -- use your browser's
> back button if this happens' and the re-jar-ed . . . this was good enough.
>
> I would like to work this out for future projects, though.
> Even better would be a way to edit the message text, catch the actual
> error at this level, etc.
Re: Uh-Oh (re: #786618) [message #790126 is a reply to message #789958] Fri, 03 February 2012 21:23 Go to previous message
Mike Schlossberg is currently offline Mike Schlossberg
Messages: 12
Registered: January 2012
Junior Member
Will do!
Previous Topic:how to bring values from multidimentional java script array in 'initialize block' to dynamic text
Next Topic:Need help to generate PDF Report
Goto Forum:
  


Current Time: Mon Sep 22 04:21:44 GMT 2014

Powered by FUDForum. Page generated in 0.01715 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software