Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » dynamic image with Birt 3.7
dynamic image with Birt 3.7 [message #722673] Tue, 06 September 2011 13:41 Go to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
Hi there,

i upgraded from BIRT 2.5.2 to BIRT 3.7. I have a dynamic image in one of my reports, which gets its content via a method of a class that returns a byte[]. Works fine with 2.5.2, fails with 3.7.
If i save the byte[] to disk and view the image, everything is fine, are there any changes within the engine i need to know about? (changelog didn't say so)

Re: dynamic image with Birt 3.7 [message #722681 is a reply to message #722673] Tue, 06 September 2011 14:06 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try the report attached to this blog post?
http://birtworld.blogspot.com/2010/09/birt-image-report-item.html

Jason

On 9/6/2011 9:41 AM, hage wrote:
> Hi there,
>
> i upgraded from BIRT 2.5.2 to BIRT 3.7. I have a dynamic image in one of
> my reports, which gets its content via a method of a class that returns
> a byte[]. Works fine with 2.5.2, fails with 3.7. If i save the byte[] to
> disk and view the image, everything is fine, are there any changes
> within the engine i need to know about? (changelog didn't say so)
>
>
Re: dynamic image with Birt 3.7 [message #722684 is a reply to message #722673] Tue, 06 September 2011 14:06 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try the report attached to this blog post?
http://birtworld.blogspot.com/2010/09/birt-image-report-item.html

Jason

On 9/6/2011 9:41 AM, hage wrote:
> Hi there,
>
> i upgraded from BIRT 2.5.2 to BIRT 3.7. I have a dynamic image in one of
> my reports, which gets its content via a method of a class that returns
> a byte[]. Works fine with 2.5.2, fails with 3.7. If i save the byte[] to
> disk and view the image, everything is fine, are there any changes
> within the engine i need to know about? (changelog didn't say so)
>
>
Re: dynamic image with Birt 3.7 [message #722715 is a reply to message #722684] Tue, 06 September 2011 15:00 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
Thx for your reply,

the path to the jar (item 2c) is correctly been generated, the image above (images and jar within the same directory) shows the behaviour described before. just "The resource of this report item is not reachable."

hage
Re: dynamic image with Birt 3.7 [message #722768 is a reply to message #722715] Tue, 06 September 2011 16:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you using the 3.7 viewer or the RE API to generate the report?

Jason

On 9/6/2011 11:00 AM, hage wrote:
> Thx for your reply,
>
> the path to the jar (item 2c) is correctly been generated, the image
> above (images and jar within the same directory) shows the behaviour
> described before. just "The resource of this report item is not reachable."
> hage
Re: dynamic image with Birt 3.7 [message #722929 is a reply to message #722768] Wed, 07 September 2011 08:35 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
i'm using the RE API, the viewer (the Report Designer) starts but it wont let me "run" the reports. Something is missing/wrong here also.

I'm using a RunAndRenderTask for executing the report within my code, something like this:
public IRunAndRenderTask createTask(URL rptDesignURL){
		IRunAndRenderTask task = null;
		try {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put(ModuleOption.RESOURCE_LOCATOR_KEY, resourceLocator);
			design = engine.openReportDesign(null, rptDesignURL.openStream(), map);
			task = engine.createRunAndRenderTask(design);
...some catches...
return task;
}


after this, i setup a IRenderOptions object (with attributes outputformat and outputfilename) and set it to the task with:
task.setRenderOption(renderOptions);

finally i start generating the report with:
		try {
			task.run();
		} catch (EngineException e) {
		    log.error("Could not render design: ", e);
			throw new IllegalStateException(e);
		}


what am i missing here?

hage
Re: dynamic image with Birt 3.7 [message #723301 is a reply to message #722929] Thu, 08 September 2011 09:26 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
additional information: Loglevel Level.FINEST didnt produce any exception (in the logfile) concerning the missing image data.

Any idea, anyone?

hage

[Updated on: Thu, 08 September 2011 10:12]

Report message to a moderator

Re: dynamic image with Birt 3.7 [message #723367 is a reply to message #723301] Thu, 08 September 2011 12:26 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
after realizing "viewer" does not mean the desginer, but that servlet which comes with the runtime, i installed it and run the report jason attached before. It works well in the viewer. The image in item 4b is displayed correctly. The effect of that is, now i'm even more confused, but at least i know, it had to work some way.
Re: dynamic image with Birt 3.7 [message #723461 is a reply to message #722673] Thu, 08 September 2011 15:39 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
i can't get it working with the RE API, runtime/libs are the same in the viewer and in my project, i don't see any differences here that could cause this (working with the viewer (byte[] injected via Java Script, not working with RE API, byte[] injected by a Java Class).

any help appreciated!

hage
Re: dynamic image with Birt 3.7 [message #723537 is a reply to message #723461] Thu, 08 September 2011 18:31 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Does the sample report I posted work with your re api? BTW in my
install it also works in the designer.

Jason

On 9/8/2011 11:39 AM, hage wrote:
> i can't get it working with the RE API, runtime/libs are the same in the
> viewer and in my project, i don't see any differences here that could
> cause this (working with the viewer (byte[] injected via Java Script,
> not working with RE API, byte[] injected by a Java Class).
>
> any help appreciated!
>
> hage
Re: dynamic image with Birt 3.7 [message #723683 is a reply to message #723537] Fri, 09 September 2011 07:11 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
updating my classpath (derby and sampledb was missing) causes a working output of the sample report using my re api. Now i'm totally confused, is it really necessary that i recode my report using javascript instead of java for embedding dynamic images?

hage

[Updated on: Fri, 09 September 2011 13:54]

Report message to a moderator

Re: dynamic image with Birt 3.7 [message #724556 is a reply to message #723683] Mon, 12 September 2011 14:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This should work. Can you post a simple report that is using a java
event handler to read the image and I will debug it?

Jason

On 9/9/2011 3:11 AM, hage wrote:
> the image in item 4b works, if i outcomment the url and use the image
> from a resource (because of proxy issues i can't get an image from an
> url currently). Now i'm totally confused, is it really necessary that i
> recode my report using javascript instead of java for embedding dynamic
> images?
>
> hage
Re: dynamic image with Birt 3.7 [message #726102 is a reply to message #722768] Fri, 16 September 2011 15:07 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
sorry for replying that late. Posting an event handler isnt that easy, 'cause we're not using any eventhandlers. we have developed our own oda driver and designer addons, so for a query we are using beanshell from which we are calling java classes, that returns, in case of the dynamic image, a byte[].

Beanshell Setup Query (you probably can ignore this):
columns(new String[] { "image" });
inParameters(new String[] { "width", "height" });


Beanshell Query Text:
import ...


c = helper.execute(new ClassA(true));
sag = c.getValue();

chart = new SpiderChart().createChart(sag);

w = new Integer(inpv("width"));
h = new Integer(inpv("height"));

return helper.createImageResult(chart.createBufferedImage(w,h));


"helper" is a static class within our query class in the oda driver project, which supplies some methods to handle the data (in this case, create the byte[] out of the chart (jfreechart)).

createImageResult in Helper class:
        public byte[] createImageResult(BufferedImage im) throws IOException
        {
        	ByteArrayOutputStream bos = new ByteArrayOutputStream();
        	ImageIO.write(im, "png", bos);
        	return bos.toByteArray();
        }


up to the return statement, the byte array contains the image data, i tried to writing that into a file, and everything looks fine. It's just not appearing within the report. Hope you can help me with this.

thx,

hage
Re: dynamic image with Birt 3.7 [message #726108 is a reply to message #726102] Fri, 16 September 2011 15:34 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
just for public information, i had some issues running the new designer from eclipse 3.7 with my additional plugins, getting the following exception:
javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Unable to create SAAJ meta-factorycom.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory


i used the jdk 1.6.0_26, upgrading to 1.7.0 solved this issue, which somehow is caused by some osgi dependencies, causing a uses constraint, that i was not able to solve. hope this helps.
Re: dynamic image with Birt 3.7 [message #726122 is a reply to message #726108] Fri, 16 September 2011 15:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Did you get the image to work?

Jason

On 9/16/2011 11:34 AM, hage wrote:
> just for public information, i had some issues running the new designer
> from eclipse 3.7 with my additional plugins, getting the following
> exception:
>
> javax.xml.soap.SOAPException: Unable to create message factory for SOAP:
> Unable to create SAAJ
> meta-factorycom.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot
> be cast to javax.xml.soap.SAAJMetaFactory
>
>
> i used the jdk 1.6.0_26, upgrading to 1.7.0 solved this issue, which
> somehow is caused by some osgi dependencies, causing a uses constraint,
> that i was not able to solve. hope this helps.
Re: dynamic image with Birt 3.7 [message #726655 is a reply to message #726122] Mon, 19 September 2011 07:27 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
no, i did not. The Java7 issue was just because of mentioning the designer before.

still any help appreciated

hage
Re: dynamic image with Birt 3.7 [message #726779 is a reply to message #726655] Mon, 19 September 2011 14:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am a bit confused. Did you get the image report from the blog post to
work with your api code? Any chance you can post a sample that does not
work so I can debug it?

Jason

On 9/19/2011 3:27 AM, hage wrote:
> no, i did not. The Java7 issue was just because of mentioning the
> designer before.
>
> still any help appreciated
>
> hage
Re: dynamic image with Birt 3.7 [message #726814 is a reply to message #726779] Mon, 19 September 2011 15:49 Go to previous messageGo to next message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
the code from the report you posted, works. But thats all javascript. My code, as posted above (without the use of js), still doesn't work. I'm currently working on a javascript solution, but that would just be a workaround. i'll try to create a simple example for you to test, later on (but i won't be able to post our whole oda implementation, so i don't know, if you will be able to test that at all, with your setup).

thx in advance,
hage

[Updated on: Mon, 19 September 2011 15:51]

Report message to a moderator

Re: dynamic image with Birt 3.7 [message #726823 is a reply to message #726814] Mon, 19 September 2011 16:02 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you can do that I will also convert it to a Java event handler.

Jason

On 9/19/2011 11:49 AM, hage wrote:
> the code from the report you posted, works. But thats all javascript. My
> code, as posted above (without the use of js), still doesn't work. I'm
> currently working on a javascript solution, but that would just be a
> workaround. i'll try to create a simple example for you to test, later on.
> thx in advance, hage
Re: dynamic image with Birt 3.7 [message #727012 is a reply to message #726823] Tue, 20 September 2011 07:58 Go to previous message
hage Mising name is currently offline hage Mising nameFriend
Messages: 67
Registered: September 2011
Member
my js solution/workaround now works. i'll see if i give the java only version any further tries later on, depends on the needs of our customers.

this is how i did it:
// import necessary package for bundle import
importPackage(Packages.org.eclipse.core.runtime);  

// import bundles
var samtBundle = Packages.org.eclipse.core.runtime.Platform.getBundle( "abc.xyz.samt.service" );
...

// load classes from bundles
samtClass = samtBundle.loadClass( "abc.xyz.samt.service.SamtClass" );
...

var samtInstance = samtClass.newInstance();
...

//call some methods
var valueA = 5;
samtInstance.setterMethod(valueA);
samtInstance.generateImage();
var result = samtInstance.getImageBytes();

//make result globally available
reportContext.setPersistentGlobalVariable( "ImageBytes", result )


after this, you can access the byte[] via
reportContext.getPersistentGlobalVariable( "ImageBytes" )


in any expression within the report (in the expression of the dynamic image in my case).


(nevertheless, it would be nice to know, if someone gets this byte[] to image thing working without a js, let me know if you do so)

thx for all of your replies and help jason,

hage

[Updated on: Tue, 20 September 2011 08:23]

Report message to a moderator

Previous Topic:BIRT - ODA - EMF instance
Next Topic:how to configure where BIRT cache is located
Goto Forum:
  


Current Time: Thu Mar 28 13:12:21 GMT 2024

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

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

Back to the top