Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Birt Batch Job
Birt Batch Job [message #368161] Thu, 07 May 2009 17:54 Go to next message
kishore is currently offline kishoreFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

I am working on a scheduler that will run the birt reports in my web
application. The scheduler will get birt design name, report parameters as
the input parameters. Can any one please suggest me the best approach. I
started with ReportRunner. But the call to the funciton
Platform.startup(config) was throwing an exception. The code in the if
block of the platform.java is getting executed. But my application is not
a standalone application, its an web application. What might be reasons
for this behaviour ?

IPlatformContext context = config.getPlatformContext( );

if( context == null )
{
context = new PlatformFileContext( config );
config.setProperty( PlatformConfig.PLATFORM_CONTEXT, context );

Thanks & Regards,
Kishore.
}
Re: Birt Batch Job [message #368164 is a reply to message #368161] Thu, 07 May 2009 19:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Kishore,

Take a look at the servlet example
http://wiki.eclipse.org/Servlet_Example_%28BIRT%29_2.1
In the comments is a 2.2 example which should work fine with 2.3+

Jason

kishore wrote:
> Hi,
>
> I am working on a scheduler that will run the birt reports in my web
> application. The scheduler will get birt design name, report parameters
> as the input parameters. Can any one please suggest me the best
> approach. I started with ReportRunner. But the call to the funciton
> Platform.startup(config) was throwing an exception. The code in the if
> block of the platform.java is getting executed. But my application is
> not a standalone application, its an web application. What might be
> reasons for this behaviour ?
> IPlatformContext context = config.getPlatformContext( );
>
> if( context == null )
> {
> context = new PlatformFileContext( config );
> config.setProperty( PlatformConfig.PLATFORM_CONTEXT,
> context );
>
> Thanks & Regards,
> Kishore.
> }
>
Re: Birt Batch Job [message #368165 is a reply to message #368164] Thu, 07 May 2009 19:54 Go to previous messageGo to next message
kishore is currently offline kishoreFriend
Messages: 12
Registered: July 2009
Junior Member
Jason,

Thanks for the reply. The servlet will not work here. My code should
should be able to run the reports in the back end i.e. the ViewerServlet
will not at all come into the picture. The code will should be able to run
the report and save it in pdf format without rendering it to the user.

Thanks,
Kishore.
Re: Birt Batch Job [message #368167 is a reply to message #368165] Thu, 07 May 2009 20:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Understood, but If you want to package the birt runtime in a webapp it
is probably better to use the plaformservletcontext. If you do not want
to do that reportrunner should be fine.

kishore wrote:
> Jason,
>
> Thanks for the reply. The servlet will not work here. My code should
> should be able to run the reports in the back end i.e. the ViewerServlet
> will not at all come into the picture. The code will should be able to
> run the report and save it in pdf format without rendering it to the user.
> Thanks,
> Kishore.
>
Re: Birt Batch Job [message #368168 is a reply to message #368167] Thu, 07 May 2009 20:43 Go to previous messageGo to next message
kishore is currently offline kishoreFriend
Messages: 12
Registered: July 2009
Junior Member
Jason,

I am calling the ReportRunner as shown below.

String platform = "//WebContent//WEB-INF//platform//";
System.setProperty("BIRT_HOME",birtHome);
// System.setProperty("BIRT_HOME"," "); ->> i tried this as mine is a
//web application deployed as
//a war.But did not work

int result = new ReportRunner(args).execute();

In execute method of ReportRunner the following call

Platform.startup( config );

to the following lines in the startup method executed.

if( platform == null )
{
if (config == null)
{
config = new PlatformConfig();
}
IPlatformContext context = config.getPlatformContext( );

//I was getting Context as null . So the PlaformFileContext method is
executed.
Do you know why it is happening ?

if( context == null )
{
context = new PlatformFileContext( config );
config.setProperty( PlatformConfig.PLATFORM_CONTEXT, context );
}

Thanks,
Kishore.
Re: Birt Batch Job [message #368169 is a reply to message #368168] Thu, 07 May 2009 21:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

What are you setting BIRT_HOME to?
It has to be a hard directory if you are using the PlatformFileContext.
The directory must contain the birt plugins directory and a
configuration directory containing the config.ini. You can write your
own Platform Context or use the PlatformServletContext to do different
deployments.

Jason

kishore wrote:
> Jason,
> I am calling the ReportRunner as shown below.
> String platform = "//WebContent//WEB-INF//platform//";
> System.setProperty("BIRT_HOME",birtHome);
> // System.setProperty("BIRT_HOME"," "); ->> i tried this as mine is a
> //web application deployed as
> //a war.But did not work
>
> int result = new ReportRunner(args).execute();
>
> In execute method of ReportRunner the following call
> Platform.startup( config );
> to the following lines in the startup method executed.
>
> if( platform == null )
> {
> if (config == null)
> {
> config = new PlatformConfig();
> }
> IPlatformContext context = config.getPlatformContext( );
>
> //I was getting Context as null . So the PlaformFileContext method is
> executed.
> Do you know why it is happening ?
>
> if( context == null )
> {
> context = new PlatformFileContext( config );
> config.setProperty( PlatformConfig.PLATFORM_CONTEXT,
> context );
> }
>
> Thanks,
> Kishore.
>
Re: Birt Batch Job [message #368175 is a reply to message #368169] Fri, 08 May 2009 13:14 Go to previous messageGo to next message
kishore is currently offline kishoreFriend
Messages: 12
Registered: July 2009
Junior Member
Jason,

I am setting BIRT_HOME = \WEB-INF\platforms\. It is working now but for
the first invocation of ReportRunner. For each invoction of the
ReportRunner i have to restart my application server.If i try to run the
ReportRunner for the second time i am getting an exception in the below
code of the OSGILauncher class. During the second invocation of the
ReportRunner the value of context is null, so context is assigned to an
instance of PlatformFileContext.

My code is as given below:

some function(){
System.setProperty("BIRT_HOME","\\WEB-INF\\platform\\");
int result = new ReportRunner(args).execute();

}

I am missing this statement that is found in the main method of the
ReporRunner class System.exit(result).


//Platform.class

IPlatformContext context = config.getPlatformContext( );

if( context == null )
{
context = new PlatformFileContext( config );
config.setProperty( PlatformConfig.PLATFORM_CONTEXT, context );
}


//OSGILauncher.class

platformConfig = config;
IPlatformContext context = config.getPlatformContext( );
if ( context == null )
{
throw new BirtException(PluginId,PlatformContext is not setted - {0}", new
Object[]{"PlatformConfig"} ); //$NON-NLS-1$
}


String root = context.getPlatform( );
platformDirectory = new File( root );
if ( !platformDirectory.exists( ) || !platformDirectory.isDirectory( ) )
{
throw new BirtException( PluginId,"Could not start the Framework - {0}" +
root, root ); //$NON-NLS-1$
}
Re: Birt Batch Job [message #368176 is a reply to message #368175] Fri, 08 May 2009 14:29 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Krishore

I am not sure what is happening here, But ideally what you want to do
is startup the platform only once when your application starts up. Get
the engine and for each new run just create an engine task to run and
render the report. I believe reportrunner is just a sample and starts
up the platform and then shuts it down. In a web app that is a bad idea.

Jason

kishore wrote:
> Jason,
>
> I am setting BIRT_HOME = \WEB-INF\platforms\. It is working now but for
> the first invocation of ReportRunner. For each invoction of the
> ReportRunner i have to restart my application server.If i try to run the
> ReportRunner for the second time i am getting an exception in the below
> code of the OSGILauncher class. During the second invocation of the
> ReportRunner the value of context is null, so context is assigned to an
> instance of PlatformFileContext.
>
> My code is as given below:
>
> some function(){
> System.setProperty("BIRT_HOME","\\WEB-INF\\platform\\");
> int result = new ReportRunner(args).execute();
>
> }
>
> I am missing this statement that is found in the main method of the
> ReporRunner class System.exit(result).
>
>
> //Platform.class
>
> IPlatformContext context = config.getPlatformContext( );
>
> if( context == null )
> {
> context = new PlatformFileContext( config );
> config.setProperty( PlatformConfig.PLATFORM_CONTEXT, context );
> }
>
>
> //OSGILauncher.class
>
> platformConfig = config;
> IPlatformContext context = config.getPlatformContext( );
> if ( context == null )
> {
> throw new BirtException(PluginId,PlatformContext is not setted - {0}",
> new Object[]{"PlatformConfig"} ); //$NON-NLS-1$
> }
>
>
> String root = context.getPlatform( );
> platformDirectory = new File( root );
> if ( !platformDirectory.exists( ) || !platformDirectory.isDirectory( ) )
> {
> throw new BirtException( PluginId,"Could not start the Framework - {0}"
> + root, root ); //$NON-NLS-1$
> }
>
>
>
>
>
Previous Topic:Adding Custom Events
Next Topic:Not all legend entries are shown
Goto Forum:
  


Current Time: Fri Apr 26 18:25:48 GMT 2024

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

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

Back to the top