Home » Archived » BIRT » Birt classloader changes
Birt classloader changes [message #245490] |
Fri, 29 June 2007 01:07  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #245717 is a reply to message #245665] |
Sat, 30 June 2007 21:37   |
Eclipse User |
|
|
|
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 #246071 is a reply to message #246041] |
Tue, 03 July 2007 01:47   |
Eclipse User |
|
|
|
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 #246188 is a reply to message #246126] |
Tue, 03 July 2007 16:47   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #247381 is a reply to message #247259] |
Wed, 11 July 2007 10:21  |
Eclipse User |
|
|
|
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
>
>
|
|
|
Goto Forum:
Current Time: Thu May 22 15:25:48 EDT 2025
Powered by FUDForum. Page generated in 0.06624 seconds
|