Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » RCP WebViewer + classloader + connection
RCP WebViewer + classloader + connection [message #264518] Tue, 15 January 2008 15:48 Go to next message
Eclipse UserFriend
Originally posted by: georg.raffer.salomon.at

Hi guys,

I just integrated the BIRT report engine into a RCP app. The reports are
rendered as PDF and displayed with the integrated browser.
The classloader is modified using the EngineConfig:

EngineConstants.APPCONTEXT_CLASSLOADER_KEY

because specific report helper classes are located in a plugin.
Additionally a specific java.sql.Connection is set.

Now I want to use the org.eclipse.birt.report.viewer.utilities.WebViewer
within the RCP application. It seems to be very simple to render the
reports:

System.setProperty( "RUN_UNDER_ECLIPSE", "true" );
WebViewer.startup(browser);
String reportFile = "report_integration.rptdesign";
WebViewer.display(reportFile, WebViewer.HTML, browser, "frameset");

This works fine so far, but the specific report helper classes are not
found. Is it possible to set a specific class loader and ResourceLocator
for the WebViewer as it is possible for the report render engine?

Thanks!

bye, Georg
Re: RCP WebViewer + classloader + connection [message #264598 is a reply to message #264518] Wed, 16 January 2008 05:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Georg,

I believe others have solved this by calling:
WebappAccessor.start (
ViewerPlugin.WEBAPP_CONTEXT,
yourplugin.PLUGIN_ID,
Path.EMPTY
);

before WebViewer.display

Where yourplugin is the plugin calling the WebViewer and it should have
its classloader with access to your extra classes.


Jason

Georg Raffer wrote:
> Hi guys,
>
> I just integrated the BIRT report engine into a RCP app. The reports are
> rendered as PDF and displayed with the integrated browser.
> The classloader is modified using the EngineConfig:
>
> EngineConstants.APPCONTEXT_CLASSLOADER_KEY
>
> because specific report helper classes are located in a plugin.
> Additionally a specific java.sql.Connection is set.
>
> Now I want to use the org.eclipse.birt.report.viewer.utilities.WebViewer
> within the RCP application. It seems to be very simple to render the
> reports:
>
> System.setProperty( "RUN_UNDER_ECLIPSE", "true" );
> WebViewer.startup(browser);
> String reportFile = "report_integration.rptdesign";
> WebViewer.display(reportFile, WebViewer.HTML, browser, "frameset");
>
> This works fine so far, but the specific report helper classes are not
> found. Is it possible to set a specific class loader and ResourceLocator
> for the WebViewer as it is possible for the report render engine?
>
> Thanks!
>
> bye, Georg
>
Re: RCP WebViewer + classloader + connection [message #264610 is a reply to message #264598] Wed, 16 January 2008 13:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: georg.raffer.salomon.at

Hi Jason,

Thank you for your reply. I tried your recommendations, but it didn't work.

What I did:

I tried to use it as explained:

System.setProperty( "RUN_UNDER_ECLIPSE", "true" );

WebappAccessor.start (ViewerPlugin.WEBAPP_CONTEXT,
"myplugin.id.comes.here", Path.EMPTY);

String reportFile = "c:/temp/report_integration.rptdesign";
WebViewer.display(reportFile, WebViewer.HTML, browser, "frameset");


Replacing "myplugin.id.comes.here" with my plugin name. Than a 404 error
is displayed in the browser. It seems that tomcat startup fails.
DOES ANYBODY KNOW where the logs (embedded tomcat) are written to?

Next I tried to modify the viewer plugin:

I changed WebappAccessor in that way that it uses a classloader that
searches in the viewer bundle and my bundle:

public Class loadClass(String className) throws ClassNotFoundException {
System.out.println("Loading class: " + className);
try{
return super.loadClass(className);
}catch (ClassNotFoundException e) {
if(bundle2!=null){ // this is the bundle that contains my report
bundle
return bundle2.loadClass(className);
}else{
throw e;
}
}
}

Neither loadClass, nor getResource tried to load a class or image used by
the report. It seems that this is not the classloader responsible for my
webapp (rendering the report).

I know this is tricky, but do you have any ideas?
Thank you!

bye, Georg
Re: RCP WebViewer + classloader + connection [message #264627 is a reply to message #264610] Wed, 16 January 2008 14:59 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
Try to add org.eclipse.birt.report.viewer as a dependent plugin to your
plugin ("myplugin.id.comes.here")

Snjeza

Georg Raffer wrote:
> Hi Jason,
>
> Thank you for your reply. I tried your recommendations, but it didn't work.
>
> What I did:
>
> I tried to use it as explained:
>
> System.setProperty( "RUN_UNDER_ECLIPSE", "true" );
>
> WebappAccessor.start (ViewerPlugin.WEBAPP_CONTEXT,
> "myplugin.id.comes.here", Path.EMPTY);
>
> String reportFile = "c:/temp/report_integration.rptdesign";
> WebViewer.display(reportFile, WebViewer.HTML, browser, "frameset");
>
>
> Replacing "myplugin.id.comes.here" with my plugin name. Than a 404 error
> is displayed in the browser. It seems that tomcat startup fails.
> DOES ANYBODY KNOW where the logs (embedded tomcat) are written to?
>
> Next I tried to modify the viewer plugin:
>
> I changed WebappAccessor in that way that it uses a classloader that
> searches in the viewer bundle and my bundle:
>
> public Class loadClass(String className) throws ClassNotFoundException {
> System.out.println("Loading class: " + className);
> try{
> return super.loadClass(className);
> }catch (ClassNotFoundException e) {
> if(bundle2!=null){ // this is the bundle that contains my report bundle
> return bundle2.loadClass(className);
> }else{
> throw e; }
> }
> }
>
> Neither loadClass, nor getResource tried to load a class or image used
> by the report. It seems that this is not the classloader responsible for
> my webapp (rendering the report).
>
> I know this is tricky, but do you have any ideas?
> Thank you!
>
> bye, Georg
>
>
Re: RCP WebViewer + classloader + connection [message #264636 is a reply to message #264627] Wed, 16 January 2008 15:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: georg.raffer.salomon.at

Hi Snjeza,

Thanks! I already tried this, but it didn't help.
Any ideas? Are there more dependencies required? Do you know where to find
the embedded tomcat logfile?

bye, Georg
Re: RCP WebViewer + classloader + connection [message #264645 is a reply to message #264610] Wed, 16 January 2008 15:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Georg,

Does your plugin have dependencies on your helper plugin?

Jason

Georg Raffer wrote:
> Hi Jason,
>
> Thank you for your reply. I tried your recommendations, but it didn't work.
>
> What I did:
>
> I tried to use it as explained:
>
> System.setProperty( "RUN_UNDER_ECLIPSE", "true" );
>
> WebappAccessor.start (ViewerPlugin.WEBAPP_CONTEXT,
> "myplugin.id.comes.here", Path.EMPTY);
>
> String reportFile = "c:/temp/report_integration.rptdesign";
> WebViewer.display(reportFile, WebViewer.HTML, browser, "frameset");
>
>
> Replacing "myplugin.id.comes.here" with my plugin name. Than a 404 error
> is displayed in the browser. It seems that tomcat startup fails.
> DOES ANYBODY KNOW where the logs (embedded tomcat) are written to?
>
> Next I tried to modify the viewer plugin:
>
> I changed WebappAccessor in that way that it uses a classloader that
> searches in the viewer bundle and my bundle:
>
> public Class loadClass(String className) throws ClassNotFoundException {
> System.out.println("Loading class: " + className);
> try{
> return super.loadClass(className);
> }catch (ClassNotFoundException e) {
> if(bundle2!=null){ // this is the bundle that contains my report bundle
> return bundle2.loadClass(className);
> }else{
> throw e; }
> }
> }
>
> Neither loadClass, nor getResource tried to load a class or image used
> by the report. It seems that this is not the classloader responsible for
> my webapp (rendering the report).
>
> I know this is tricky, but do you have any ideas?
> Thank you!
>
> bye, Georg
>
>
Re: RCP WebViewer + classloader + connection [message #264662 is a reply to message #264636] Wed, 16 January 2008 17:10 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
<your_workspace>/.metadata/.plugins/com.rpc.core.tomcat
You can also try buddy classloading.

Snjeza

Georg Raffer wrote:
> Hi Snjeza,
>
> Thanks! I already tried this, but it didn't help.
> Any ideas? Are there more dependencies required? Do you know where to
> find the embedded tomcat logfile?
>
> bye, Georg
>
Re: RCP WebViewer + classloader + connection [message #264665 is a reply to message #264662] Wed, 16 January 2008 17:11 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
sorry
<your_workspace>/.metadata/.plugins/org.eclipse.tomcat
Snjezana Peco wrote:
> <your_workspace>/.metadata/.plugins/com.rpc.core.tomcat
> You can also try buddy classloading.
>
> Snjeza
>
> Georg Raffer wrote:
>> Hi Snjeza,
>>
>> Thanks! I already tried this, but it didn't help.
>> Any ideas? Are there more dependencies required? Do you know where to
>> find the embedded tomcat logfile?
>>
>> bye, Georg
>>
Re: RCP WebViewer + classloader + connection [message #264669 is a reply to message #264665] Wed, 16 January 2008 17:30 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

You have to add the birt directory from the viewer plugin to your plugin
("myplugin.id.comes.here"

WebappAccessor.start (ViewerPlugin.WEBAPP_CONTEXT,
"myplugin.id.comes.here", Path.EMPTY);

Then add the following dependencies
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.birt.report.viewer,
org.eclipse.help.base,
org.eclipse.help.appserver,
org.eclipse.birt.chart.reportitem.ui,
testdata,
org.eclipse.birt.core,
org.eclipse.birt.report.engine,
org.eclipse.birt.data,
org.eclipse.birt.report.data.adapter,
org.eclipse.birt.chart.engine,
org.eclipse.birt.report.model;bundle-version="[2.1.0,3.0.0) "

A better work around may be to just load the plugins you need in the
report using script similar to this:
importPackage( Packages.org.eclipse.core.runtime );
mybundle = Platform.getBundle("my.test.pack");
gdc = mybundle.loadClass("my.test.pack.GetData");
gd = gdc.newInstance();
gd.myMethod();

Jason

Snjezana Peco wrote:
> sorry
> <your_workspace>/.metadata/.plugins/org.eclipse.tomcat
> Snjezana Peco wrote:
>> <your_workspace>/.metadata/.plugins/com.rpc.core.tomcat
>> You can also try buddy classloading.
>>
>> Snjeza
>>
>> Georg Raffer wrote:
>>> Hi Snjeza,
>>>
>>> Thanks! I already tried this, but it didn't help.
>>> Any ideas? Are there more dependencies required? Do you know where to
>>> find the embedded tomcat logfile?
>>>
>>> bye, Georg
>>>
Previous Topic:BIRT 2.2.1 on Tomcat; logging problem DiscoveryException
Next Topic:Filtering question
Goto Forum:
  


Current Time: Fri Dec 27 03:21:18 GMT 2024

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

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

Back to the top