Skip to main content



      Home
Home » Archived » BIRT » Birt classloader changes
Birt classloader changes [message #245490] Fri, 29 June 2007 01:07 Go to next message
Eclipse UserFriend
Hi,

I'm using birt as an integrated component of my application, using a
similar technique to that described here:
http://wiki.eclipse.org/index.php/Servlet_Example

The report references classes in my application, contained in jar files
that are in the root of the .ear file.

This was working perfectly when it was implemented using the latest
version of BIRT in January this year (I can't remember the version,
sorry), however I've just upgraded to 2.2RC3 and everything is dying.

The line in question in server.log is:
SEVERE: ReferenceError: "AgencySFUtil" is not defined. (<inline>#20)

and the relevant code in my .rptdesign file is:

<method
name="initialize">< ![CDATA[importPackage(Packages.com.unisys.gladis.business.fa cade);

...

// Retrieve Agency
agencySF = AgencySFUtil.createBean();

...


I'm assuming this is a classloader issue - has the BIRT classloader
behaviour changed in the intervening months? Is it running its own
classloader now instead of inheriting the classloader from the
application/servlet in which it's running?

I've been struggling with this all day and am running out of options. Any
help would be greatly appreciated.
Re: Birt classloader changes [message #245660 is a reply to message #245490] Sat, 30 June 2007 03:02 Go to previous messageGo to next message
Eclipse UserFriend
To follow up on this - I tried the all-in-one build for 2.2 stable,
released on the 29th, and exactly the same thing occurs.

Looking in WEB-INF\platform\configuration\ in my .ear file, there's a log
file with the contents:

!ENTRY org.eclipse.update.configurator 2007-06-30 16:29:08.978
!MESSAGE Could not install bundle
update@plugins/org.eclipse.emf.common_2.2.1.v200702131851.jar The
activator org.eclipse.emf.common.CommonPlugin$Implementation for bundle
org.eclipse.emf.common is invalid

!ENTRY org.eclipse.osgi 4 0 2007-06-30 16:29:09.243
!MESSAGE An error occurred while automatically activating bundle
org.eclipse.emf.common (63).
!STACK 0
org.osgi.framework.BundleException: The activator
org.eclipse.emf.common.CommonPlugin$Implementation for bundle
org.eclipse.emf.common is invalid
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load BundleActivator(AbstractBundle.java:141)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:260)



Is there some discrepency with jar files, perhaps?

To clarify, the WEB-INF\platform directory in my .ear contains the
contents of birt-runtime-2_2_0\ReportEngine\plugins and
birt-runtime-2_2_0\ReportEngine\configuration

The contents of birt-runtime-2_2_0\ReportEngine\lib have been copied into
WEB-INF\lib - all as specified in the link in my parent post.

One thing that does seem a little odd is that ReportEngine\lib contains
chartengineapi.jar, where ReportEngine\plugins contains
org.eclipse.birt.chart.engine_2.2.0.v20070621.jar . Additionally, Birt 2.2
in Eclipse uses EMF 2.3.0, however the jar files in birt-runtime-2_2_0 are
2.2.0.

I'm not sure if this is of any relevance or not - I tried replacing
various jar files, but had no joy.
Re: Birt classloader changes [message #245665 is a reply to message #245660] Sat, 30 June 2007 04:13 Go to previous messageGo to next message
Eclipse UserFriend
More hopefully useful information:

I forgot to include the root cause in the log file; it's:

Root exception:
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IStatus
at
org.eclipse.emf.common.EMFPlugin$EclipsePlugin.<init>(EMFPlugin.java:524)
at
org.eclipse.emf.common.CommonPlugin$Implementation.<init>(CommonPlugin.java:111)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)

...


one thing I did note was difference between the production (working)
application with BIRT and the test (broken) application, is that the
production version has the following line in
platform/configuration/config.ini:

org.osgi.framework.bootdelegation=*

This sounded vaguely classpathy so optimistically added it, however it
didn't change anything. Please help! I've spent the best part of two days
on this now and rapidly running out of straws to grasp :)

Thanks,
Matt
Re: Birt classloader changes [message #245717 is a reply to message #245665] Sat, 30 June 2007 21:37 Go to previous messageGo to next message
Eclipse UserFriend
Ah, isn't this a fun little monologue ;-)

Further investigation shows that org.eclipse.equinox.common.jar
(containing IStatus.class) is sitting in WEB-INF\platform\plugins, and
I've confirmed that the plugins directory is known about by OSGi (it's
being created and populated with JARs if it doesn't exist).

However, this is for some reason not in the classpath when EMFPlugin is
initialising. As an experiment, I dumped the entire contents of
platform\plugins into WEB-INF\lib with my other jars for the application,
and the classloader issue with IStatus.class went away.

However, the following errors are still occurring in the log file in
WEB-INF\platform\configuration (file copied in full):

!SESSION 2007-07-01 13:34:26.187
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_NZ

!ENTRY org.eclipse.update.configurator 2007-07-01 13:34:26.187
!MESSAGE Could not install bundle
update@plugins /org.eclipse.birt.chart.engine.extension_2.2.0.v20070622.jar
The activator org.eclipse.birt.chart.plugin.ChartEngineExtensionPlugin
for bundle org.eclipse.birt.chart.engine.extension is invalid

!ENTRY org.eclipse.update.configurator 2007-07-01 13:34:27.328
!MESSAGE Could not install bundle
update@plugins/org.eclipse.emf.common_2.2.1.v200702131851.jar The
activator org.eclipse.emf.common.CommonPlugin$Implementation for bundle
org.eclipse.emf.common is invalid

!ENTRY org.eclipse.update.configurator 2007-07-01 13:34:27.688
!MESSAGE Could not install bundle
update@plugins/org.eclipse.emf.ecore.xmi_2.2.2.v200702131851.jar The
activator org.eclipse.emf.ecore.xmi.XMIPlugin$Implementation for bundle
org.eclipse.emf.ecore.xmi is invalid

!ENTRY org.eclipse.update.configurator 2007-07-01 13:34:27.703
!MESSAGE Could not install bundle
update@plugins/org.eclipse.emf.ecore_2.2.2.v200702131851.jar The
activator org.eclipse.emf.ecore.plugin.EcorePlugin$Implementation for
bundle org.eclipse.emf.ecore is invalid
Re: Birt classloader changes [message #245726 is a reply to message #245717] Sat, 30 June 2007 22:19 Go to previous messageGo to next message
Eclipse UserFriend
I've just deployed WebViewerExample to JBoss directly as the sole running
application, and the same error occurs. Is there something horribly
horribly wrong with birt-runtime-2_2_0 that's currently available on
eclipse.org? I've removed all other factors, so can't see what else it
could be.
Re: Birt classloader changes [message #245904 is a reply to message #245726] Mon, 02 July 2007 10:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

Is your class found when previewing in the designer?

Jason

Matt Painter wrote:
> I've just deployed WebViewerExample to JBoss directly as the sole
> running application, and the same error occurs. Is there something
> horribly horribly wrong with birt-runtime-2_2_0 that's currently
> available on eclipse.org? I've removed all other factors, so can't see
> what else it could be.
>
Re: Birt classloader changes [message #246000 is a reply to message #245904] Mon, 02 July 2007 17:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

Thanks for replying. I created a new report with just the import and
assignment line (sans getBean() as that would break horribly) and I get
the following in the preview pane of the Report Designer:

------------------------------------------------------------ --------------------

The following items have errors:


ReportDesign (id = 1):
+ There are errors evaluating script
"importPackage(Packages.com.unisys.gladis.business.facade);

// Retrieve Agency
agencySF = AgencySFUtil();":{1}.
Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are
errors evaluating script
" importPackage(Packages.com.unisys.gladis.business.facade);// Retrieve
AgencyagencySF = AgencySFUtil();":{1}. at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:577)

... snip ...

Caused by: java.lang.NoClassDefFoundError: javax/ejb/EJBLocalHome at
java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClass(Unknown Source) at
java.security.SecureClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.defineClass(Unknown Source) at
java.net.URLClassLoader.access$000(Unknown Source) at

...


EJBLocalHome is in c:\jboss\server\default\lib\jboss-j2ee.jar, and is in
the classpath of my project from adding 'Server Runtime' to the classpath
in Eclipse.

I experimented with removing Server Runtime and adding jboss-j2ee.jar to
my classpath explicitely, with the same error.

I can't confirm whether or not this has ever worked in the report
designer, as I'm working with a scripted data source that retrieves data
from EJBs (hence removing getBean() from the code in this test).
Re: Birt classloader changes [message #246005 is a reply to message #246000] Mon, 02 July 2007 18:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi again,

I've just tried with a non EJB that has no external dependencies, and get
the following error in the Report Designer preview, which was the same as
what I was getting with the EJB in the report proper (the original issue):


The following items have errors:


ReportDesign (id = 1):
+ There are errors evaluating script
" importPackage(Packages.nz.govt.archives.archwaystaff.web.dis posalauthority);

blah = new DisposalAuthorityFormController();":{1}.
Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are
errors evaluating script
" importPackage(Packages.nz.govt.archives.archwaystaff.web.dis posalauthority);blah
= new DisposalAuthorityFormController();":{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

... snip ...

Caused by: org.mozilla.javascript.EcmaError: ReferenceError:
"DisposalAuthorityFormController" is not defined. (<inline>#3) 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.notFoundError(ScriptRun time.java:3303)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1566) at
Re: Birt classloader changes [message #246035 is a reply to message #246005] Mon, 02 July 2007 23:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

Where is this class located?
DisposalAuthorityFormController

Jason

Matt Painter wrote:
> Hi again,
>
> I've just tried with a non EJB that has no external dependencies, and
> get the following error in the Report Designer preview, which was the
> same as what I was getting with the EJB in the report proper (the
> original issue):
>
>
> The following items have errors:
>
> ReportDesign (id = 1): + There are errors evaluating script
> " importPackage(Packages.nz.govt.archives.archwaystaff.web.dis posalauthority);
>
>
> blah = new DisposalAuthorityFormController();":{1}.
> Error.ScriptEvaluationError ( 1 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: There are
> errors evaluating script
> " importPackage(Packages.nz.govt.archives.archwaystaff.web.dis posalauthority);blah
> = new DisposalAuthorityFormController();":{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
> .. snip ...
>
> Caused by: org.mozilla.javascript.EcmaError: ReferenceError:
> "DisposalAuthorityFormController" is not defined. (<inline>#3) 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.notFoundError(ScriptRun time.java:3303)
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1566) at
>
Re: Birt classloader changes [message #246041 is a reply to message #246035] Mon, 02 July 2007 23:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

My application is deployed in an ear, with DisposalAuthorityFormController
being a web-tier Spring form controller. The class file exists in
WEB-INF\classes\nz\govt\...

For reference, the other class, AgencySF, lives in a jar file in the root
of the ear.

Regards,
Matt
Re: Birt classloader changes [message #246071 is a reply to message #246041] Tue, 03 July 2007 01:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

The code is setup to search the following order

* The class loader first try to the load the class as following sequence:
* <li>1. standard java class loader,
* <li>2. classloader setted through the appContext.
* <li>3. CLASSPATH setted by WEBAPP_CLASSPATH_KEY
* <li>4. PROJECT_CLASSPATH_KEY
* <li>5. WORKSAPCE_CLASSPATH_KEY
* <li>6. JARs define in the report design


The example viewer sets item 2 using code similar to this:
context.put(
EngineConstants.APPCONTEXT_CLASSLOADER_KEY,ReportEngineServi ce.class.getClassLoader());


The ReportEngineService class handles all the RE API code, so to make
the example work, you may try setting something similar to this in the
BirtEngine Class. The RE is started using OSGi, so it is getting its own
classpath.

If you were trying to find DisposalAuthorityFromController using the
example WebViewer this should have worked, which searches the
web-inf/lib and the sriptlibdir defined in the web.xml

Jason

Matt Painter wrote:
> Hi Jason,
>
> My application is deployed in an ear, with
> DisposalAuthorityFormController being a web-tier Spring form controller.
> The class file exists in WEB-INF\classes\nz\govt\...
>
> For reference, the other class, AgencySF, lives in a jar file in the
> root of the ear.
>
> Regards,
> Matt
>
Re: Birt classloader changes [message #246074 is a reply to message #246071] Tue, 03 July 2007 02:19 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for this Jason; I'll have a fiddle with it later and let you know.
Can you confirm that this behaviour has changed since earlier milestone
releases of 2.2? This report was something that used to work beautifully :)

Presumably the issue about IStatus was unrelated?
Re: Birt classloader changes [message #246083 is a reply to message #246071] Tue, 03 July 2007 02:24 Go to previous messageGo to next message
Eclipse UserFriend
One thing though - I'm generating these reports directly from my
application through a servlet.

If the standard Java class loader is used, how does this explain that my
AgencySF class and DisposalAuthorityFormController classes are not found?
These are core classes in the application and are very very definitely on
the standard java classpath.

Is there any way to spit out the current classpath in the report, so I can
figure out where it's actually looking for classes?
Re: Birt classloader changes [message #246126 is a reply to message #246083] Tue, 03 July 2007 10:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

I will check into the change, but I do not remember anything specific
changing here.

The standard classloader is the classpath of the RE plugin, not the app,
I believe. That is why the WebViewer sets it explicitly.

Jason



Matt Painter wrote:
> One thing though - I'm generating these reports directly from my
> application through a servlet.
>
> If the standard Java class loader is used, how does this explain that my
> AgencySF class and DisposalAuthorityFormController classes are not
> found? These are core classes in the application and are very very
> definitely on the standard java classpath.
>
> Is there any way to spit out the current classpath in the report, so I
> can figure out where it's actually looking for classes?
>
Re: Birt classloader changes [message #246188 is a reply to message #246126] Tue, 03 July 2007 16:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matt.deity.co.nz

Thanks Jason. Certainly what used to be available to the report
(evidenced by a working report in the production envrionment) was the
entire application's classpath, including the web-tier classes in
WEB-INF/classes, and the the EJBs in the root of the .ear.

If this is an intentional change rather than a bug, I think it would be
worth mentioning someone in the documentation for I'm sure I won't be
the only person to be embedding reports into my J2EE application as an
integrated servlet and using scripted data sources.

I'll look into how to get the application's classloader to set it in
the appContext.

Regards,
Matt



> Matt,
>
> I will check into the change, but I do not remember anything specific
> changing here.
>
> The standard classloader is the classpath of the RE plugin, not the
> app, I believe. That is why the WebViewer sets it explicitly.
>
> Jason
>
>
>
> Matt Painter wrote:
>> One thing though - I'm generating these reports directly from my
>> application through a servlet.
>>
>> If the standard Java class loader is used, how does this explain that
>> my AgencySF class and DisposalAuthorityFormController classes are not
>> found? These are core classes in the application and are very very
>> definitely on the standard java classpath.
>>
>> Is there any way to spit out the current classpath in the report, so I
>> can figure out where it's actually looking for classes?
Re: Birt classloader changes [message #246189 is a reply to message #246188] Tue, 03 July 2007 18:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

Log this as a bugzilla entry. You can just set the class loader like
the web viewer does. I posted the snippet in the earlier post.

Jason

Matt Painter wrote:
> Thanks Jason. Certainly what used to be available to the report
> (evidenced by a working report in the production envrionment) was the
> entire application's classpath, including the web-tier classes in
> WEB-INF/classes, and the the EJBs in the root of the .ear.
>
> If this is an intentional change rather than a bug, I think it would be
> worth mentioning someone in the documentation for I'm sure I won't be
> the only person to be embedding reports into my J2EE application as an
> integrated servlet and using scripted data sources.
>
> I'll look into how to get the application's classloader to set it in the
> appContext.
>
> Regards,
> Matt
>
>
>
>> Matt,
>>
>> I will check into the change, but I do not remember anything specific
>> changing here.
>>
>> The standard classloader is the classpath of the RE plugin, not the
>> app, I believe. That is why the WebViewer sets it explicitly.
>>
>> Jason
>>
>>
>>
>> Matt Painter wrote:
>>> One thing though - I'm generating these reports directly from my
>>> application through a servlet.
>>>
>>> If the standard Java class loader is used, how does this explain that
>>> my AgencySF class and DisposalAuthorityFormController classes are not
>>> found? These are core classes in the application and are very very
>>> definitely on the standard java classpath.
>>>
>>> Is there any way to spit out the current classpath in the report, so
>>> I can figure out where it's actually looking for classes?
>
>
Re: Birt classloader changes [message #246191 is a reply to message #246188] Tue, 03 July 2007 19:50 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

I'm very happy to report that after adding the following line in my Spring
view class, everything now works as it used to. Definitely think this
should be documented as a word to the wise somewhere; maybe on the Servlet
integration wiki page:

runAndRenderTask.getAppContext().put(EngineConstants.APPCONT EXT_CLASSLOADER_KEY,
ReportEngineService.class.getClassLoader());


I'm still getting that error about IStatus, but I'm tentatively ignoring
it for now ;)

Thanks for all your help - it's very much appreciated.

Regards,
Matt
Re: Birt classloader changes [message #246483 is a reply to message #246191] Thu, 05 July 2007 09:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Matt,

If you do not mind, can you add this to the bottom of that page?
Also, BIRT 2.2 runtime uses EMF 2.2 and the BIRT 2.2 designer uses EMF
2.3. This was done so that Java 1.4 support would be continued for the
runtime.

Jason

Matt Painter wrote:
> Hi Jason,
>
> I'm very happy to report that after adding the following line in my
> Spring view class, everything now works as it used to. Definitely think
> this should be documented as a word to the wise somewhere; maybe on the
> Servlet integration wiki page:
>
> runAndRenderTask.getAppContext().put(EngineConstants.APPCONT EXT_CLASSLOADER_KEY,
> ReportEngineService.class.getClassLoader());
>
>
> I'm still getting that error about IStatus, but I'm tentatively ignoring
> it for now ;)
>
> Thanks for all your help - it's very much appreciated.
>
> Regards,
> Matt
>
Re: Birt classloader changes [message #247259 is a reply to message #246483] Tue, 10 July 2007 16:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matt.deity.co.nz

Done. Also logged the bugs.

M


> Matt,
>
> If you do not mind, can you add this to the bottom of that page?
> Also, BIRT 2.2 runtime uses EMF 2.2 and the BIRT 2.2 designer uses EMF
> 2.3. This was done so that Java 1.4 support would be continued for the
> runtime.
>
> Jason
>
> Matt Painter wrote:
>> Hi Jason,
>>
>> I'm very happy to report that after adding the following line in my
>> Spring view class, everything now works as it used to. Definitely think
>> this should be documented as a word to the wise somewhere; maybe on the
>> Servlet integration wiki page:
>>
>> runAndRenderTask.getAppContext().put(EngineConstants.APPCONT EXT_CLASSLOADER_KEY,
>> ReportEngineService.class.getClassLoader());
>>
>>
>> I'm still getting that error about IStatus, but I'm tentatively
>> ignoring it for now ;)
>>
>> Thanks for all your help - it's very much appreciated.
>>
>> Regards,
>> Matt
Re: Birt classloader changes [message #247381 is a reply to message #247259] Wed, 11 July 2007 10:21 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Thanks Matt

Matt Painter wrote:
> Done. Also logged the bugs.
>
> M
>
>
>> Matt,
>>
>> If you do not mind, can you add this to the bottom of that page?
>> Also, BIRT 2.2 runtime uses EMF 2.2 and the BIRT 2.2 designer uses EMF
>> 2.3. This was done so that Java 1.4 support would be continued for
>> the runtime.
>>
>> Jason
>>
>> Matt Painter wrote:
>>> Hi Jason,
>>>
>>> I'm very happy to report that after adding the following line in my
>>> Spring view class, everything now works as it used to. Definitely
>>> think this should be documented as a word to the wise somewhere;
>>> maybe on the Servlet integration wiki page:
>>>
>>> runAndRenderTask.getAppContext().put(EngineConstants.APPCONT EXT_CLASSLOADER_KEY,
>>> ReportEngineService.class.getClassLoader());
>>>
>>>
>>> I'm still getting that error about IStatus, but I'm tentatively
>>> ignoring it for now ;)
>>>
>>> Thanks for all your help - it's very much appreciated.
>>>
>>> Regards,
>>> Matt
>
>
Previous Topic:BIRT on Win XP pro
Next Topic:Multiple parameters
Goto Forum:
  


Current Time: Thu May 22 15:25:57 EDT 2025

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

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

Back to the top