Home
Analytics
Deploying Custom Plugin in Report Engine
bradreed
Hey,
I have been working on a plugin extension that deals with barcodes. It is very similar to the rotated text plugin that is out there. I have gotten it working properly as an eclipse plug-in. (Basically exporting the project as a deployable plug-in jar and putting in eclipse plug-in folder) However, when I go to deploy it on the Report Engine it doesn't work, I don't get any errors either. The reports will generate fine, just without the barcode in the report being displayed. I have a feeling it may involve the dependencies the project has based on some forums reads already. Here is the manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BIRT extension Plug-in
Bundle-SymbolicName: plugin.birt.barcode;singleton:=true
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.birt.report.designer.core;bundle-version="2.6.1",
org.eclipse.birt.report.engine;bundle-version="2.6.1",
org.eclipse.birt.data;bundle-version="2.6.1",
org.eclipse.jface;bundle-version="3.6.1",
org.eclipse.ui.forms;bundle-version="3.5.2",
org.eclipse.birt.report.designer.ui.views;bundle-version="2.6.1"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/barcode4j.jar,
I have already removed the org.eclipse.birt.report.designer.ui dependency, and tried to remove the designer.ui.views dependancy, but then I get errors exporting the plugin jar. Any instructions on properly deploying this plugin in the Report engine would be greatly appreciated as well as I'm not sure if I need to do something special with the external barcode4j.jar either. Thanks in advance.
Bradley
Find more posts tagged with
Comments
JasonW
Bradley
If you remove all the ui dependecies in the manifest after its exported does it work in the runtime?
Jason
bradreed
Jason,
Thanks for the reply. After some further reading I have altered the Manifest.xml and removed what seemed to be all non-essential dependencies. It now looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BIRT extension Plug-in
Bundle-SymbolicName: plugin.birt.barcode;singleton:
=true
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",org.ec
lipse.birt.report.engine;bundle-version="2.6.1",org.eclipse.birt.data
;bundle-version="2.6.1"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/barcode4j.jar
Export-Package: plugin.birt.barcode
Unfortunately, I'm still not having any luck. I've also tried many variations on the Manifest file and putting the jar in it's own file in the plugin folder all to no avail. Think I'm still missing something, just to verify the steps here is what I did:
1. Exported as Deployable Plugin which created jar (without source files)
2. Put jar into plugins folder of ReportEngine
3. Restarted Birt Server
Note: Report always runs with no error, just doesn't show barcode. And the plugin works in eclipse.
Is there any way to debug this, to see if the jar is being recognized or not? Which I'm assuming it is not since I don't see any errors or any barcodes. Also, does this jar filename need to be added in any config files or classpaths anywhere?
JasonW
I just tried this with the rotated text example described in these two articles:
http://www.eclipse.org/articles/article.php?file=Article-BIRT-ExtensionTutorial1/index.html
and
http://www.eclipse.org/articles/article.php?file=Article-BIRT-ExtensionTutorial2/index.html
I changed the dependecies list in the manifest editor to use the automated management of Dependencies tab and set it up like:
Required Plug-ins
org.eclipse.core.runtime
org.eclipse.birt.report.engine
org.eclipse.birt.data
Augmented the plugin-in development cp without adding to the manifest
org.eclipse.birt.report.designer.ui
org.eclipse.birt.report.designer.ui.views
org.eclipse.birt.report.designer.core
org.eclipse.jface
org.eclipse.ui.forms
See the screenshot.
Exported the plugin and put it in the runtime deployment and it worked fine.
Jason
JasonW
example manifest editor screenshot
bradreed
Jason,
I just tried that with my plugin as well as with the rotated text plugin. When I export it fails and in the log I get all the compilation errors associated with the moved dependencies. Is there a configuration or export option I am missing? Thanks again I have been beating my head against a wall on this one! If you have the time maybe I can post both the designer jar and the runtime jar and see if you can deploy them.
bradreed
I've sent the jar that deploys properly in eclipse for reference(just change the file extension).
JasonW
any chance you can post the project?
Jason
bradreed
I've sent the plugin
JasonW
Brad,
First off that is one coool report item! I wish you would consider submitting it to the source.
I went through the dependcies and just marked all the ui plugins as optional (you can do this by selecting the properties for the dependency). Exported the plugin and I used the checkbox "use class files compiled in the workspace" option. ran a report in the webviewer after copying the plugin and everything worked fine.
I am attaching the deployed plugin and the manifest.mf.
Marking plugins as optional is ok for now but a better solution is to probably separate this in to two plugins. One with code to handle the ui stuff which can be deployed to the designer and one to handle runtime stuff which can be deployed to the designer and the runtime.
rename plugin to .jar and manifest to .MF
Jason
bradreed
Jason,
I just tested what you sent and it works. Thank you, the help was much appreciated. I'd been beating my head against a wall for the last couple days on this. I will definitely consider uploading this to source, a colleague started this plugin out of necessity and I took over and finished it. I think this would help many people who are using or will eventually use Birt, of course I will need to get final word from those on a higher pay grade than myself. I would probably want to tweak it somewhat to make it more reusable, add all the barcode types, provide a display angle option, sizing option, etc.. It is as specialized as it needs to be for my current project, but limited. Once again Jason, thank you for your help.
Bradley
jf1
Hello,
I have got a similar problem. I deployed a Barcode Plugin too and like in bradreed i get no error-messages when the report is started, but the barcodes are not visible.
I am using the Report Engine to create my Reports, i put the compiled jar file into the plugin directory of the Report-Engine direcory in my Birt-Home directory. Do i have to do further things to make sure the plugin is loaded?
I changed my manifest and marked all ui plugins as optional, but it dosen't work.
Can you please help me?
I attach the manifest file with a txt ending.
thanks
bradreed
Hey jf1,
I am using Birt 2.6.1, and I do not use an activator class, other than that I don't see much difference. Have you got it working in the designer? One thing I did just notice is you are using the org.eclipse.core.runtime.compatibility;bundle-version="3.2.0" and that jar may be limiting. I think you make need the full org.eclipse.core.runtime jar instead. Just a thought, let me know if that helps.
Bradley
jf1
Hi,
thank you for your reply. Yes it works on the designer, therefore I think the activator class does not influence the start-up, because the activator is just used for designing barcodes, whereas at this moment I just want to open a file with barcodes and not edit the file.
I added the runtime jar file to the dependencies, but it dosen't work either.
I think, I should add something in the my java-program which executes the rpt-design as a pdf-file. But I do not know how. I will attach my java-program, so you can see whether I miss ther something
Jana
bradreed
Jana,
Another quick question for you, have you gotten the report design to render at all? Just wondering if the report is showing as pdf just without the barcodes or if the report is not being generated.
jf1
Yes a pdf-file is created. It looks like that (there should be barcodes right from the names of the used barcode-type):
bradreed
Jana,
I don't think it is an issue with the deployment code, more than likely is a plugin issue. How did you export the plugin, this makes a difference. Jason helped me out and this option was the difference in my problem: Exported the plugin and used the checkbox "use class files compiled in the workspace" option.
jf1
I already exported it like that. But it does not work...
bradreed
Okay, just wanted to double check that. If you can post your plugin.jar file, I can try to get it to work in my report engine when I get a chance.
bradreed
Jana,
Checked out the jar in my report designer, it looks really good. But I won't be able to bring down my Birt server until tonight, so I can get back to you then.
JasonW
Jana,
Can you post the project with the source?
Jason
jf1
Jason,<br />
<br />
thank you for your reply. I managed to get a bit further now by marking org.eclipse.core.runtime as optional. Now the class the my execute Report class tries to load it, but gets the following error-message:<br />
<br />
22.12.2010 16:26:16 org.eclipse.birt.report.model.metadata.ExtensionLoader handleError<br />
SCHWERWIEGEND: Message:The class [org.instantview.birt.barcode.BarcodeItemFactory] can not be instantiated. Error code:FAILED_TO_CREATE_INSTANCE <br />
<br />
I thought prehaps the program is not able to load org.eclipse.birt.report.model.api. Because thats the only jar which is used by that class:<br />
<br />
<br />
<em class='bbc'>package org.instantview.birt.barcode;<br />
<br />
import org.eclipse.birt.report.model.api.DesignElementHandle;<br />
import org.eclipse.birt.report.model.api.ExtendedItemHandle;<br />
import org.eclipse.birt.report.model.api.extension.IMessages;<br />
import org.eclipse.birt.report.model.api.extension.IReportItem;<br />
import org.eclipse.birt.report.model.api.extension.ReportItemFactory;<br />
<br />
public class BarcodeItemFactory extends ReportItemFactory<br />
{<br />
public BarcodeItemFactory() {<br />
super();<br />
}<br />
<br />
public IReportItem newReportItem(DesignElementHandle modelHandle) {<br />
if (modelHandle instanceof ExtendedItemHandle<br />
&& BarcodeItem.EXTENSION_NAME.equals(((ExtendedItemHandle)modelHandle).getExtensionName())) {<br />
return new BarcodeItem((ExtendedItemHandle)modelHandle);<br />
}<br />
return null;<br />
}<br />
<br />
public IMessages getMessages() {<br />
// TODO implement this to support localization<br />
return null;<br />
}<br />
<br />
}</em><br />
<br />
Do I have to put the class somewhere into the Report-Engine directory?<br />
<br />
Jana
JasonW
If you have all of the libs in the reportengine/lib directory in your classpath that package should be visible.
Jason
jf1
As far as I know I have the needed files in my classpath.
I will send you the full source code of the plugin and the source code of the execute-Report in a mail, because i am not allowed to post it in a forum.
I would be really glad if you can test it. Thank you for your help.
Jana
Apologist
<p>This <a data-ipb='nomediaparse' href='
http://www.keepdynamic.com/barcode-birt-report/'>BIRT
barcode maker plug-in</a> is built in BIRT Custom Extended Report Item Framework and support barcode creation in birt report.</p>
Jacob Lee
<p>I am just looking for a plugin extension of barcodes,i want to <a data-ipb='nomediaparse' href='
http://www.keepautomation.com/guide/barcode_birt.html'><span
style="color:#000000;">generate barcodes in eclipse birt</span></a>,can you give me some advice or recommendation of tools?</p>