Skip to main content



      Home
Home » Archived » BIRT » Problem with classpaht and event handlers
Problem with classpaht and event handlers [message #197250] Mon, 23 October 2006 15:49 Go to next message
Eclipse UserFriend
Originally posted by: ken_re.yahoo.com

I am trying to modify a chart on the fly by using a
ChartEventHandlerAdapter. I want to set the Title based on a value set in
the ReportContext. The handler fires ok and What I want to get is the
reportContext.



Here is the code snippet.



public void beforeRendering(GeneratedChartState arg0, IChartScriptContext
chartScriptContext) {
IExternalContext externalContext =
chartScriptContext.getExternalContext();
Object obj = externalContext.getObject();
IReportContext reportContext = (IReportContext) obj;




The problem is that 'obj' is of type
org.eclipse.birt.report.engine.script.internal.ReportContext Impl and this
implements the interface IReportContext. (I checked the code) However I
cannot cast this to the interface IReportContext because the classloader
for 'obj' is
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@24de33
and the class loader for the class running the method is
java.net.URLClassLoader@11c0f3b. So I get a ClassCastException. Does
anyone have a solution as to how to get around this. It seems that the
plugins do not play nicely with the jars and if this cannot be resolved
then this will be a marginal use package.

I have encountered this problem when running a report using WebLogic as
the app server also when just trying to debug using Eclipse and no app
server.

Any help will be appreciated.


Thank in advance.
Re: Problem with classpaht and event handlers [message #197258 is a reply to message #197250] Mon, 23 October 2006 15:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trevor.l.torrez.accenture.com

Ken wrote:
> I am trying to modify a chart on the fly by using a
> ChartEventHandlerAdapter. I want to set the Title based on a value set
> in the ReportContext. The handler fires ok and What I want to get is
> the reportContext.
>
>
> Here is the code snippet.
>
>
> public void beforeRendering(GeneratedChartState arg0,
> IChartScriptContext chartScriptContext) {
> IExternalContext externalContext =
> chartScriptContext.getExternalContext();
> Object obj = externalContext.getObject();
> IReportContext reportContext = (IReportContext) obj;
>
>
>
>
> The problem is that 'obj' is of type
> org.eclipse.birt.report.engine.script.internal.ReportContext Impl and
> this implements the interface IReportContext. (I checked the code)
> However I cannot cast this to the interface IReportContext because the
> classloader for 'obj' is
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@24de33 and the
> class loader for the class running the method is
> java.net.URLClassLoader@11c0f3b. So I get a ClassCastException. Does
> anyone have a solution as to how to get around this. It seems that the
> plugins do not play nicely with the jars and if this cannot be resolved
> then this will be a marginal use package.
> I have encountered this problem when running a report using WebLogic as
> the app server also when just trying to debug using Eclipse and no app
> server.
>
> Any help will be appreciated.
>
>
> Thank in advance.
>
>


Try taking all the libs out of WEB-INF/platform/lib and putting them in
WEB-INF/lib -- the birt runtime should grab the interfaces from the
parent classloader (ie, the webapp's) when it cannot find them on its own.

--
-t.
Re: Problem with classpaht and event handlers [message #198016 is a reply to message #197258] Fri, 27 October 2006 09:50 Go to previous message
Eclipse UserFriend
Originally posted by: ken_re.yahoo.com

This does not work because the it does not solve the problem of the osgi
loader running the plugins accessing objects that are only known to the
app.

I guess a better question would be can birt be added to a Web App as a
library and not as a plugin?
Previous Topic:Dynamic Column Sorting
Next Topic:Classloading problems – org.eclipse.tomcat
Goto Forum:
  


Current Time: Thu Jul 24 09:57:05 EDT 2025

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

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

Back to the top