Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Problems with images from shared resources in PDF output(BIRT PDF output and Images)
icon6.gif  Problems with images from shared resources in PDF output [message #517776] Tue, 02 March 2010 01:57 Go to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Like most of the folks here, I'm pretty new to BIRT but have been playing with if for the past few weeks.

I've managed to make awesome reports so easily and in a blink of an eye.

I'm using BIRT 2.5.1 and my problems is that reports that I try to generate in PDF format seem to have problems to output the images (Haven't tried charts yet...)

Every time I try to output a PDF report featuring a JPG image, instead of it there's a text saying "Current report item is not supported in this report format." If I use an embedded image the resulting report is normal, but I need the images to be from a shared resource.

This is the configuration of my PDFRenderOption (By the way, I'm using a Servlet whose only purpose is to print the report. It is to be deployed to a Weblogin 9.2 Server. Everything works awesome but the images):

...

design = birtReportEngine.openReportDesign( sc.getResource("/Reports/"+reportName+".rptdesign").toString().substring(6) );
//create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );		
task.getAppContext().put("BIRT_VIEWER_HTTPSERVLET_REQUEST", req);

PDFRenderOption options = new PDFRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
resp.setHeader(	"Content-Disposition", "inline; filename=\""+reportName+".pdf\"" );			
options.setOutputStream(resp.getOutputStream());

options.setImageHandler(new HTMLServerImageHandler());

task.setRenderOption(options);

//run report
task.run();
task.close();
...


Everything, Images, Report designs is in the WebContent Folder. Images are in WebContent/Images and report designs are in WebContent/Reports.

Hope anyone helps me out with this.

[Updated on: Tue, 02 March 2010 02:21]

Report message to a moderator

Re: Problems with images from shared resources in PDF output [message #517984 is a reply to message #517776] Tue, 02 March 2010 16:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try an embedded image?
Also comment out the image handler line and try that.

Jason

ziploide wrote:
> Like most of the folks here, I'm pretty new to BIRT but have been
> playing with if for the past few weeks.
>
> I've managed to make awesome reports so easily and in a blink of an eye.
>
> I'm using BIRT 2.5.0 and my problems is that reports that I try to
> generate in PDF format seem to have problems to output the images
> (Haven't tried charts yet...)
>
> Every time I try to output a PDF report featuring a JPG image, instead
> of it there's a text saying "Current report item is not supported in
> this report format." If I use an embedded image the resulting report is
> normal, but I need the images to be from a shared resource.
>
> This is the configuration of my PDFRenderOption (By the way, I'm using a
> Servlet whose only purpose is to print the report. It is to be deployed
> to a Weblogin 9.2 Server. Everything works awesome but the images):
>
>
> ..
>
> design = birtReportEngine.openReportDesign(
> sc.getResource("/Reports/"+reportName+".rptdesign").toString().substring(6)
> );
> //create task to run and render report
> IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design
> );
> task.getAppContext().put("BIRT_VIEWER_HTTPSERVLET_REQUEST", req);
>
> PDFRenderOption options = new PDFRenderOption();
> options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
> resp.setHeader( "Content-Disposition", "inline;
> filename=\""+reportName+".pdf\"" );
> options.setOutputStream(resp.getOutputStream());
>
> options.setImageHandler(new HTMLServerImageHandler());
>
> task.setRenderOption(options);
>
> //run report
> task.run();
> task.close();
> ..
>
>
> Everything, Images, Report designs is in the WebContent Folder. Images
> are in WebContent/Images and report designs are in WebContent/Reports.
>
> Hope anyone helps me out with this.
>
Re: Problems with images from shared resources in PDF output [message #517990 is a reply to message #517984] Tue, 02 March 2010 16:51 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hi Jason,

Thanks for your fast reply.

In fact at first I didn't have any image handler. I added that one (and the one for file based images) but none helped...

I wouldn't mind using embedded images but the fact is that I use plenty and that makes my WAR very expensive in size since I already use most of the images in JSP and I'd love to reuse to make it as practical as possible.

Anything I can do about that? I'm open to any suggestions.

Thanks!
Re: Problems with images from shared resources in PDF output [message #518016 is a reply to message #517990] Tue, 02 March 2010 18:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I just wanted you to test it to see if the image is coming in.
Your code should be working. Can you post one of your report designs?
I am interested on how you included the image (URL, Expression, etc);

Jason

ziploide wrote:
> Hi Jason,
>
> Thanks for your fast reply.
>
> In fact at first I didn't have any image handler. I added that one (and
> the one for file based images) but none helped...
>
> I wouldn't mind using embedded images but the fact is that I use plenty
> and that makes my WAR very expensive in size since I already use most of
> the images in JSP and I'd love to reuse to make it as practical as
> possible.
>
> Anything I can do about that? I'm open to any suggestions.
>
> Thanks!
Re: Problems with images from shared resources in PDF output [message #518294 is a reply to message #518016] Wed, 03 March 2010 17:11 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hey Jason.

Sorry for my late reply.

Here is the report design. It is extremely simple. It just has a table and didn't even finish it since I had the problem with the images.

As you can see, all I have is an embedded image in a cell and an image from a shared resource, in this case, from the WebContent/Images folder.

Only the embedded image is displayed. I use the BIRT report design view from Eclipse. I'm using Galileo 3.5.1 and Birt 2.5.1

Here is the code:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 2.5.1.v20090903 Build &lt;2.5.1.v20090917-1447></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="layoutPreference">auto layout</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <data-sources>
        <script-data-source name="datasource" id="49"/>
    </data-sources>
    <data-sets>
        <script-data-set name="dataset" id="52">
            <structure name="cachedMetaData"/>
            <property name="dataSource">datasource</property>
        </script-data-set>
    </data-sets>
    <styles>
        <style name="report" id="4">
            <property name="fontFamily">sans-serif</property>
            <property name="fontSize">10pt</property>
        </style>
        <style name="crosstab-cell" id="5">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
        <style name="crosstab" id="6">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
        <style name="report_title" id="21">
            <property name="fontFamily">"Times New Roman"</property>
            <property name="verticalAlign">bottom</property>
        </style>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2"/>
    </page-setup>
    <body>
        <grid id="40">
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">folio</property>
                    <expression name="expression" type="javascript">reportContext.getAppContext().get("imageBarcode");</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <column id="41"/>
            <column id="42"/>
            <row id="43">
                <cell id="44">
                    <image id="46">
                        <property name="height">54px</property>
                        <property name="width">244px</property>
                        <property name="allowExport">true</property>
                        <property name="source">embed</property>
                        <property name="imageName">logoBMX.jpg</property>
                    </image>
                </cell>
                <cell id="45">
                    <image id="59">
                        <property name="height">54px</property>
                        <property name="width">244px</property>
                        <property name="source">file</property>
                        <expression name="uri" type="constant">WebContent/Images/logoBMX.jpg</expression>
                    </image>
                </cell>
            </row>
        </grid>
    </body>
    <list-property name="images">
        <structure>
            <property name="name">logoBMX.jpg</property>
            <property name="data">
                /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwg
                JC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIy
                MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA2APQDASIAAhEBAxEB/8QA
                HwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIh
                MUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVW
                V1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXG
                x8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQF
                BgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAV
                YnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
                hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq
                8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+sfxJ4o0fwlpTajrN2tvBnagwWaRsZ2qByT/AJNbFfPH7SWn
                am2paRqW2RtKSEwAjlY5ixJz6Fl2/XbQBmeK/wBoTXNRkaHw5Aml2wPE0irLM35gqv0wfrVPwV8cfEWm
                +IIf+Eiv5NQ0qU7JlZFDRZ/jUgA8encVw3g3Q9M8Qa8LPWNbg0ezWJpHuZsc4xhVyQMnP6GvWrW0+BOl
                2stubg6pdRRO/mTvOPMYAnaCoVMnHFAHofxB+LGl+CtOs3tkj1O8vU823ijmAXyyOJCQD8pPT159K5Hw
                z+0Zp17cx23iHS2sA5wbq3cyRg+rLjcB9N30rwJml1/XIYIxFbC4mWGCJpG8qBWb5VBYkhRnuTVzxX4O
                1rwbqZstYtGjyT5Uy5McwHdG79R7jPIFAH25a3UF7axXVrNHNbyqHjljYMrqehBHUVLXzh8APHF9Fro8
                J3lxJNZTxM1mrc+S65Ygeikbjj1A9TX0fQAUVk+JtbXw34a1DWWgNwLOEymINt347ZwcV4jJ+0xOW/de
                FYwP9q+J/wDZKAPoSivBNP8A2loXuUTUfDbxQE/NJb3W9lHrtKjP517N4e8R6T4q0pdT0a7W5tWYoWCl
                SrDGVIPIPI/OgDVooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA5fx741s/Anhq
                TVLlBNMzCO2t920yue2cHAAySfb3FeEx/EHxN8XdfsfCVwtlZ6bfSgTpbwBm2L85O584ICnBGOa7H9pO
                zmk8NaLeqCYYLt439i65H/oBrxz4Ya/Z+GPiJpWqag+y0jZ0lfBOwOjLu47AsD9KAJfGnw/ufDnjtvDe
                my/2k8u1rZYyPNIYZCsoPDfzGD3xXp/w6+AyxomqeMEBdlYLpowQoIwGdgevJOB0457V5N8Q9Yg1j4i6
                zqmn3RmgkucwzqSMhQACPbjivrfwprser+DNH1a5lSN7q0jdy7BcvtG7r75oA+c/HnwS1rwzcPd6Isup
                6UFLmQYEsAHJ3juMfxD8QK6ebxH4Y8c/Bq30/wASa7bf8JLa28kkLzORIJVLbAWPBLKFB5756iug/aG8
                QTWPg2w060mKpqU581kb70aDJXI7Esv5V4VpPgLXNY8Kaj4lhjhi0uxVmeWd9pkI6hBjkj8BnjrQB7V8
                B/h4mnWaeL7545Lq5jK2kS4PkoeCxP8AeI4x2B98D26vgzTdW1DRryO7029ntZ42DK8LlTkfz+hr7e8M
                ahc6t4U0jUbxFS5urOGaVVGAGZATj8TQBj/FD/kmPiL/AK83r5q+EV14ds/GrS+J/sX9n/ZZAPtkYdN+
                VxwQeetfSvxQ/wCSY+Iv+vN6+Yfhf4OsfHHi1tI1Ce4ghFs82+3KhsqVGOQRjmgDrvjDq3w5vtLtYvCt
                tZHVfPBkmsrcxIsW05BwAGJJXHB6Hp37v9nvw9q2j+HNSvNRjmt4L6ZGt4JVKnCg5kwezZA99v0rhviV
                8GLPwV4bfXtM1e5lSGVEaG4Vd3zHGQy45Bxxj15rd+BXxE1K6lvfD+rzSXUFtbSXkVzI5eRApUMhJPI5
                yPTp6YANj4la58Uo/FraT4Wspl08RJJHcWtqHLgjBDu2VBDA8DHGDXB3fjv4t+BLu2uNfacwSMQsV7Ej
                xy46jcvIP0Iqvd+MvHHxa8XDTtDuprCIqzRWsFyYkRB1aRhyx5H9BWX8QPBvjXwrpdofEmq/bbKWbbEo
                vHmVX2n+FgMcZ5oA+go/G8uufBy98V6di1vF0+eQAYfyZkDA9RzyMjI6YrwjTPjJ8R7yd7G1vjfXd0vl
                QotnGzo2c7kCqMnAI5BGCeO473wF/wAm0+IP+uN7/wCgVzH7OMMcnjzUJHjVnj05ijEZKkyICR6cEigD
                Lf4ofE7wnq8S6zc3SvxIbXUbUKJFz/ug44PIIr6Y8Oa9H4o8J2Ws2OxTd2+8K2SEk6FT0zhgR+FeNftM
                Rp5fhqTaN5Nyu7vj93xVnwl4yk8D/s72mrw26XFz9pkhgjkJ2bmlblsc4ABNAGJd638cdbvrhrazvbSN
                JGTy4LZIowVJB2s/LDI65NV9C+MXjXwr4mTSvGCNPCJFS4juYRHNCrY+ZSoGeDnnOfbrWb4e0f4mfE9b
                rWbXXZkgWYxl5b54k3gAlVRM4wGHYDmuM8aaVr2i+J5LHxJdNc6jGibpWnMpKkfL8x56UAfRfxv8W654
                R0LS7nQ777JNNcskjeWj7l2k4+YHvXlFn8Tfip4m04W2kG6uWtctPcWVkGkbceA2FIGMcYAzz1ruf2jv
                +RS0L/r6P/os10XwEijj+Ftq6IqtJczM5A5Y7sZP4AD8KAPI9I+PXjLSLW6tb/yNQnI2xSXUe1oWB5yF
                xu78Hv37VBffEH4s2EEOtXl1qVtZzkGKWSyVYWzyAMpjkdPWqviC3hl/aAmgkjVopNdjDoRwwMi5z9cm
                voT4vorfCjXwwBAhQj6iRcUAV/hP8QpfH+g3Mt5BFDqFlIscwiztcEZVwD0zhhjnpXnXjb4zeINW8Rv4
                e8CRPhJDGLiGHzZrhlzu2AggLwecZwM5FQfs/POmheNWtc/aBbxGLH9/bNj9a8z8Aw+J7jxQq+EZAmr+
                U5Vi0YO3+LBfj+tAHaxfFD4l+BtYgXxMlxNDINxtr6BV8xe5RwAcj6keor1nxzrXiDVfAdr4p+H+qkRo
                hmliWGNzLF/EcODhkIOQPfuBXmHiDwL8ZPFVrFba3Gl5FE/mRh57ZSrYxwVINet/CzQ9S8H/AA8Fj4hR
                LaS3lmlYGRXVIz82cgkepoA848C/He6j0TWl8VXSXF5bwmexcxhDM3QREKAOuDn0LZ6U74U+MPiF468W
                bbnW2Gk2hE13ttYgGGfljB25G7nvnANeP+Mr3RtR8Xald+H7VrbTJZd0MTDGOBkgfwgnJA7A19LfA3VN
                EvPh7bWelosV3Z/LfRkDeZGJO8nHII6HsBjtQB6ZRRRQBz3jnw0PF3g3UtFDoktxHmF3HCyKQyk+gyAD
                7E18qQ/CbxzPqsmnp4duxKhOZHwkRx3EhIU/ga+zKKAPkzwz8NtGfxnP4b8W+IBp2oQlcW0KgrLlA2BM
                flDc4xjntmrHi/4I+LNImu7mxRdS0yAF43SYeYsQ6AoxzkDsM1S+N+j3th8TNSvJoJBa3nlyQTFTtceW
                oIB6ZBBGK4uDxHrttam1g1rUYrcgqYo7p1Qg9RgHGKANLwNHpN74t06x8Q5bSZnKy5mMYjyDhsg8YIGf
                bNdj8UviTpmtaZbeFPCkH2fQbNhl0BQTbegC9doznnknB7VxXgS0+3ePtAtzbi4R7+HzImTeGTeN2R3G
                M59q+mNX+B/gbVrhpxp8ti7Nub7HMUU/8BOVH4AUAfOXw58ITeNPGNppwQm0Qia8cHG2EEZ/E5AH1r7R
                jjSKNY41CIoCqqjAAHQCsPwt4O0Pwbp5s9Gs1hDHMkrfNJKf9pup+nQdq3qAOc8fadd6v4C1vT7CEzXU
                9qyRRggFm9OeK+Z/D3hn4meDdYOoaR4f1CK78toi/wBlEo2kjI7jsK+u6KAPl7VvC/xi8fmNNYtbk26k
                ERzvHbxKfXYCMnnrgmvVfhd8KIvBFjdXGpTR3Wq3sRhlMedkUZ6opIBOeCT7D059MooA+W9U+F/jr4fe
                JxqfheO6vYYnzb3NqoZ9p/hePk+x4INJ4k8N/F3x1a295rGm3MsKNiG2Plw7SRy3l5BHTqea+paKAPIv
                B/hPXdO+BOs6Dd6dJFqk8V0sVuWXLFlwvIOOfrWH8DvA3iXwv4sv7vWtJls7eSxMSO7qct5iHHBPYGve
                aKAPHvjx4R17xVBoS6Hp0l4bdpzLsZRt3CPHUjrg/lSaL8NdR1f4FxeFdTU6dqSTPPH5mGCOJGK5wTwQ
                ccdM/hXsVFAHyzoek/Fz4eXU+n6Rpl55c7ZZY4VuIC3QODyFOMenbNZ+t/DH4m6rq8l/qmlXN7eTYaSb
                z42+g+9gYHYcCvraigDyf43+Fdb8UeG9IttF097yaC4LyIjKNo2YzyR3rd+EGh6l4d+Hlrp2rWrWt2k0
                rNExBIBYkdCRXd0UAfOGrfDvxZcfGptbi0aZtNOrx3H2gOmPLDqS2M56CvZfiTpd7rXw81nTtOga4u54
                lWOJSAWO9T346A11VFAHjnwH8Ia/4UXXv7c02Sz+0GDyt7Kd+3zM9CemR+dch4t+D3irwx4lbXPBbzTw
                +Y00f2dwk1uST8uM/MMHHHUZBHr9JUUAfNiv8b/Ft3axPHfWS28iyB5I1tE3A9W4Bb6cj2rufixD471f
                w9Z+H9G02S4eZA2pXdoRHG/H+rQM+7aTknPYD1Ir1qigDxP4ZfBwWfhXVv8AhJ7UR32qRNbCFgrG3j7M
                CMjcWw3ttHvXLeCfBnxB+Hfjr7XBok95p4cwXJgkTbcQ5+8oLDnowzjng96+laKAGo2+NX2su4A4YYI+
                tFOooAKKKKAILyytdQtXtb22hubd+HimQOrfUHiuEuvgl4BupWk/sVoixyRFcyKPwG7AoooA3fDHgDwx
                4Plkm0XTEgnkXa8zO0jleuMsTgfSuloooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooo
                oAKKKKACiiigAooooAKKKKAP/9k=
            </property>
        </structure>
    </list-property>
</report>


You'll notice a data source and data set that I really don't use for the time beign but I added the because I was in need of a dynamic image. I stripped everything out to see if there was any problem elsewhere but as you can see, this is just a dead plain simple report that can't show a shared resource image.

Hope that helps. If you need any other piece of core or the rest of the project just let me know.

Dan
Re: Problems with images from shared resources in PDF output [message #518313 is a reply to message #518294] Wed, 03 March 2010 17:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The issue is that the uri is not complete. Try to enter something like
the following expression:

fp = reportContext.getHttpServletRequest().getRequestURL();
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";


Another option is to use an image from the resource folder ( you can set
in preferences) put your image in that directory in the designer, and
include it in your report. When you deploy to the WebViewer you can set
the resource folder in the web.xml(relative or full path). If you are
using the report engine api you can set the resource folder using:

config.setResourcePath("C:\\myresources");


Jason

ziploide wrote:
> Hey Jason.
>
> Sorry for my late reply.
>
> Here is the report design. It is extremely simple. It just has a table
> and didn't even finish it since I had the problem with the images.
>
> As you can see, all I have is an embedded image in a cell and an image
> from a shared resource, in this case, from the WebContent/Images folder.
>
> Only the embedded image is displayed. I use the BIRT report design view
> from Eclipse. I'm using Galileo 3.5.1 and Birt 2.5.1
>
> Here is the code:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version
> 2.5.1.v20090903 Build <2.5.1.v20090917-1447></property>
> <property name="units">in</property>
> <property name="iconFile">/templates/blank_report.gif</property>
> <property name="layoutPreference">auto layout</property>
> <property name="bidiLayoutOrientation">ltr</property>
> <data-sources>
> <script-data-source name="datasource" id="49"/>
> </data-sources>
> <data-sets>
> <script-data-set name="dataset" id="52">
> <structure name="cachedMetaData"/>
> <property name="dataSource">datasource</property>
> </script-data-set>
> </data-sets>
> <styles>
> <style name="report" id="4">
> <property name="fontFamily">sans-serif</property>
> <property name="fontSize">10pt</property>
> </style>
> <style name="crosstab-cell" id="5">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="crosstab" id="6">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="report_title" id="21">
> <property name="fontFamily">"Times New Roman"</property>
> <property name="verticalAlign">bottom</property>
> </style>
> </styles>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2"/>
> </page-setup>
> <body>
> <grid id="40">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">folio</property>
> <expression name="expression"
> type="javascript">reportContext.getAppContext().get("imageBarcode ");</expression>
>
> <property name="dataType">string</property>
> </structure>
> </list-property>
> <column id="41"/>
> <column id="42"/>
> <row id="43">
> <cell id="44">
> <image id="46">
> <property name="height">54px</property>
> <property name="width">244px</property>
> <property name="allowExport">true</property>
> <property name="source">embed</property>
> <property name="imageName">logoBMX.jpg</property>
> </image>
> </cell>
> <cell id="45">
> <image id="59">
> <property name="height">54px</property>
> <property name="width">244px</property>
> <property name="source">file</property>
> <expression name="uri"
> type="constant">WebContent/Images/logoBMX.jpg</expression >
> </image>
> </cell>
> </row>
> </grid>
> </body>
> <list-property name="images">
> <structure>
> <property name="name">logoBMX.jpg</property>
> <property name="data">
>
> /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsL DBkSEw8UHRofHh0aHBwg
>
>
> JC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgy IRwhMjIyMjIyMjIyMjIy
>
>
> MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA2 APQDASIAAhEBAxEB/8QA
>
>
> HwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUF BAQAAAF9AQIDAAQRBRIh
>
>
> MUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVW
>
>
> V1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip qrKztLW2t7i5usLDxMXG
>
>
> x8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEB AQEBAQAAAAAAAAECAwQF
>
>
> BgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMi MoEIFEKRobHBCSMzUvAV
>
>
> YnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVm Z2hpanN0d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S6Hp0l4bdpzLsZRt3CPHUjrg/lSaL8NdR1f4FxeFdTU6 dqSTPPH5mGCOJGK5wTwQ
>
>
> ccdM/hXsVFAHyzoek/Fz4eXU+n6Rpl55c7ZZY4VuIC3QODyFOMenbNZ+t/DH 4m6rq8l/qmlXN7eTYaSb
>
>
> z42+g+9gYHYcCvraigDyf43+Fdb8UeG9IttF097yaC4LyIjKNo2YzyR3rd+E Gh6l4d+Hlrp2rWrWt2k0
>
>
> rNExBIBYkdCRXd0UAfOGrfDvxZcfGptbi0aZtNOrx3H2gOmPLDqS2M56CvZf iTpd7rXw81nTtOga4u54
>
>
> lWOJSAWO9T346A11VFAHjnwH8Ia/4UXXv7c02Sz+0GDyt7Kd+3zM9CemR+dc h4t+D3irwx4lbXPBbzTw
>
>
> +Y00f2dwk1uST8uM/MMHHHUZBHr9JUUAfNiv8b/Ft3axPHfWS28iyB5I1tE3 A9W4Bb6cj2rufixD471f
>
>
> w9Z+H9G02S4eZA2pXdoRHG/H+rQM+7aTknPYD1Ir1qigDxP4ZfBwWfhXVv8A hJ7UR32qRNbCFgrG3j7M
>
>
> CMjcWw3ttHvXLeCfBnxB+Hfjr7XBok95p4cwXJgkTbcQ5+8oLDnowzjng96+ laKAGo2+NX2su4A4YYI+
>
>
> tFOooAKKKKAILyytdQtXtb22hubd+HimQOrfUHiuEuvgl4BupWk/sVoixyRF cyKPwG7AoooA3fDHgDwx
>
>
> 4Plkm0XTEgnkXa8zO0jleuMsTgfSuloooAKKKKACiiigAooooAKKKKACiiig AooooAKKKKACiiigAooo
>
> oAKKKKACiiigAooooAKKKKAP/9k=
> </property>
> </structure>
> </list-property>
> </report>
>
>
> You'll notice a data source and data set that I really don't use for the
> time beign but I added the because I was in need of a dynamic image. I
> stripped everything out to see if there was any problem elsewhere but as
> you can see, this is just a dead plain simple report that can't show a
> shared resource image.
>
> Hope that helps. If you need any other piece of core or the rest of the
> project just let me know.
>
> Dan
Re: Problems with images from shared resources in PDF output [message #518319 is a reply to message #518313] Wed, 03 March 2010 18:36 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Jason,

I'm sorry, I know this may sound stupid but this code:

Jason Weathersby wrote on Wed, 03 March 2010 12:43
Try to enter something like
the following expression:

fp = reportContext.getHttpServletRequest().getRequestURL();
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";




It is a javascript, right? Where should I put it? I know this is basic knowledge but I'm still having my way around this powerful suite.

Also for the other tip about:

config.setResourcePath("C:\\myresources");

Since it is a Webapp, is it alright if I use something like:

config.setResourcePath( servletcontext.getResource("WebContent/"+"Images") );


Thanks for your time and advices. Will try both.

Dan
Re: Problems with images from shared resources in PDF output [message #518328 is a reply to message #518319] Wed, 03 March 2010 19:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

There is a fx button for the expression of the URI for the image. Just
put it in the expression. And yes it is JavaScript.

your resource path setting should work.

Jason



ziploide wrote:
> Jason,
>
> I'm sorry, I know this may sound stupid but this code:
>
> Jason Weathersby wrote on Wed, 03 March 2010 12:43
>> Try to enter something like the following expression:
>>
>> fp = reportContext.getHttpServletRequest().getRequestURL();
>> lt = fp.lastIndexOf("/");
>> fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";
>
>
> It is a javascript, right? Where should I put it? I know this is basic
> knowledge but I'm still having my way around this powerful suite.
>
> Also for the other tip about:
>
> config.setResourcePath("C:\\myresources");
>
> Since it is a Webapp, is it alright if I use something like:
>
>
> config.setResourcePath(
> servletcontext.getResource("WebContent/"+"Images") );
>
>
> Thanks for your time and advices. Will try both.
>
> Dan
Re: Problems with images from shared resources in PDF output [message #518373 is a reply to message #518313] Wed, 03 March 2010 22:28 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hello again Jason.

Sorry to trouble you again but the javascript approach was not successful. I get an Error 500 with the following stacktrace:

org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:186)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
	at WebReport.doGet(WebReport.java:132)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3244)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.lang.IllegalArgumentException
	at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
	at sun.net.www.protocol.file.Handler.openConnection(Handler.java:65)
	at sun.net.www.protocol.file.Handler.openConnection(Handler.java:55)
	at java.net.URL.openConnection(URL.java:943)
	at java.net.URL.openStream(URL.java:1007)
	at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.tryURLSearch(ResourceLocatorImplBase.java:273)
	at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.tryURLSearch(ResourceLocatorImplBase.java:244)
	at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.getResource(ResourceLocatorImplBase.java:187)
	at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.findResource(ResourceLocatorImplBase.java:56)
	at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.findResource(ResourceLocatorImplBase.java:74)
	at org.eclipse.birt.report.model.core.Module.findResource(Module.java:1240)
	at org.eclipse.birt.report.model.api.ModuleHandle.findResource(ModuleHandle.java:2251)
	at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeImage(LocalizedContentVisitor.java:693)
	at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:165)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170)
	... 16 more



I wasn't successful either while trying to find the object type of "config" to try the approach in Report API:

config.setResourcePath( servletcontext.getResource("WebContent/"+"Images") );


What kind of object is "config"?

Thanks

Dan
Re: Problems with images from shared resources in PDF output [message #518603 is a reply to message #518373] Thu, 04 March 2010 15:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

config is the instance of the EngineConfig class.
Can you add a data item to the top of the report with the expression:
fp = reportContext.getHttpServletRequest().getRequestURL();
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";

See if this matches the location of the image. Do the same thing for
reportContext.getHttpServletRequest().getSession().getServle tContext().getRealPath('/webcontent/images');

and finally a third data element with //I i do not believe this method
will work because it returns a jndi location I believe
reportContext.getHttpServletRequest().getSession().getServle tContext().getResource('/webcontent');


Also try and change:
servletcontext.getResource("WebContent/"+"Images") );

to

servletcontext.getRealPath("WebContext/" +"Images"));


I did not think about this when I first replied, but if you are writing
your own servlet you need to add the request object to the app context
so the script engine can get access to the request.
To do this when you create a new task to run the report add:

task.getAppContext().put(EngineConstants.APPCONTEXT_BIRT_VIE WER_HTTPSERVET_REQUEST,
req );

EngineConstants is in this package:
org.eclipse.birt.report.engine.api

BTW the above expressions will be null in the designer, you need to
deploy the report to test it.


Jason

ziploide wrote:
> Hello again Jason.
>
> Sorry to trouble you again but the javascript approach was not
> successful. I get an Error 500 with the following stacktrace:
>
>
> org.eclipse.birt.report.engine.api.EngineException: Error happened while
> running the report
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:186)
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:75)
>
> at WebReport.doGet(WebReport.java:132)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> at
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceA ction.run(StubSecurityHelper.java:227)
>
> at
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(S tubSecurityHelper.java:125)
>
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStu bImpl.java:283)
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStu bImpl.java:175)
> at
> weblogic.servlet.internal.WebAppServletContext$ServletInvoca tionAction.run(WebAppServletContext.java:3244)
>
> at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(Aut henticatedSubject.java:321)
>
> at
> weblogic.security.service.SecurityManager.runAs(SecurityMana ger.java:121)
> at
> weblogic.servlet.internal.WebAppServletContext.securedExecut e(WebAppServletContext.java:2010)
>
> at
> weblogic.servlet.internal.WebAppServletContext.execute(WebAp pServletContext.java:1916)
>
> at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequ estImpl.java:1366)
>
> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
> at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
> Caused by: java.lang.IllegalArgumentException
> at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
> at sun.net.www.protocol.file.Handler.openConnection(Handler.jav a:65)
> at sun.net.www.protocol.file.Handler.openConnection(Handler.jav a:55)
> at java.net.URL.openConnection(URL.java:943)
> at java.net.URL.openStream(URL.java:1007)
> at
> org.eclipse.birt.report.model.util.ResourceLocatorImplBase.t ryURLSearch(ResourceLocatorImplBase.java:273)
>
> at
> org.eclipse.birt.report.model.util.ResourceLocatorImplBase.t ryURLSearch(ResourceLocatorImplBase.java:244)
>
> at
> org.eclipse.birt.report.model.util.ResourceLocatorImplBase.g etResource(ResourceLocatorImplBase.java:187)
>
> at
> org.eclipse.birt.report.model.util.ResourceLocatorImplBase.f indResource(ResourceLocatorImplBase.java:56)
>
> at
> org.eclipse.birt.report.model.util.ResourceLocatorImplBase.f indResource(ResourceLocatorImplBase.java:74)
>
> at
> org.eclipse.birt.report.model.core.Module.findResource(Modul e.java:1240)
> at
> org.eclipse.birt.report.model.api.ModuleHandle.findResource( ModuleHandle.java:2251)
>
> at
> org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.localizeImage(LocalizedContentVisitor.java:693)
>
> at
> org.eclipse.birt.report.engine.presentation.LocalizedContent Visitor.localize(LocalizedContentVisitor.java:165)
>
> at
> org.eclipse.birt.report.engine.internal.executor.l18n.Locali zedReportItemExecutor.execute(LocalizedReportItemExecutor.ja va:37)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:65)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:140)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:111)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutNodes(HTMLInlineStackingLM.java:160)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:140)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:70)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:132)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:140)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:70)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPageLM.java:90)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutE ngine.layout(HTMLReportLayoutEngine.java:99)
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doR un(RunAndRenderTask.java:170)
>
> ... 16 more
>
>
>
> I wasn't successful either while trying to find the object type of
> "config" to try the approach in Report API:
>
>
> config.setResourcePath(
> servletcontext.getResource("WebContent/"+"Images") );
>
>
> What kind of object is "config"?
>
> Thanks
>
> Dan
Re: Problems with images from shared resources in PDF output [message #518673 is a reply to message #518603] Thu, 04 March 2010 17:47 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hey Jason, you are really being very helpful, I'm learning tons just from this problem.

Look, here are the outputs of the data items:

DataItem 1:
Data (id = 63) seems to output:

http://127.0.0.1:55360/viewer/WebContent/Images/logoBMX.jpg

Data (id = 63) definition:

        <data id="63">
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">Column Binding</property>
                    <expression name="expression" type="javascript">fp = reportContext.getHttpServletRequest().getRequestURL();
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <property name="resultSetColumn">Column Binding</property>
        </data>


Data Item 2:
Data (id = 64): 
+ A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg"; 
data.engine.BirtException ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";
	at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1215)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1179)
	at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
	at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:75)
	at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
	at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
	at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:920)
	at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
	at org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:131)
	at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
	at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
	at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
	at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
	at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
	at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
	at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:318)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:380)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:880)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:748)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";
	at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
	at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:773)
	at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.doEvaluateRawExpression(ExprEvaluateUtil.java:266)
	at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateRawExpression(ExprEvaluateUtil.java:232)
	at org.eclipse.birt.data.engine.impl.PreparedDummyQuery$ResultIterator.<init>(PreparedDummyQuery.java:531)
	at org.eclipse.birt.data.engine.impl.PreparedDummyQuery$ResultIterator.<init>(PreparedDummyQuery.java:508)
	at org.eclipse.birt.data.engine.impl.PreparedDummyQuery$QueryResults.getResultIterator(PreparedDummyQuery.java:367)
	at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:98)
	at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1875)
	at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
	... 59 more
Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";
	at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:299)
	at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:102)
	at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScript(JavascriptEvalUtil.java:134)
	at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:769)
	... 69 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "lastIndexOf" of null (#1)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
	at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3563)
	at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3582)
	at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3601)
	at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2160)
	at org.mozilla.javascript.gen.c5._c0(:1)
	at org.mozilla.javascript.gen.c5.call()
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
	at org.mozilla.javascript.gen.c5.call()
	at org.mozilla.javascript.gen.c5.exec()
	at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:95)
	... 71 more


Data Item 3:
Data (id = 65): 
+ A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getResource('/WebContent');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "lastIndexOf" of null (#1)
 Script source: , line: 0, text:
fp = reportContext.getHttpServletRequest().getSession().getServletContext().getResource('/WebContent');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg"; 


Data (id = 65) definition:

        <data id="65">
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">Column Binding</property>
                    <expression name="expression" type="javascript">fp = reportContext.getHttpServletRequest().getSession().getServletContext().getResource('/WebContent');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";</expression>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <property name="resultSetColumn">Column Binding</property>
        </data>


Funny thing is that I don't have a viewer directory like the path Data Item 1 outputs...

I couldn't deploy the EAR to my Weblogic due to "org.eclipse.core.runtime.CoreException: Extended Operation failure: org.eclipse.jst.j2ee.internal.archive.operations.EARComponen tExportOperation " but the preview threw those.

Does any of this ring a bell?

Dan
Re: Problems with images from shared resources in PDF output [message #518696 is a reply to message #518603] Thu, 04 March 2010 19:07 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Ok Jason...

I know giving support for tons of people with problems with BIRT is way too much for someone to handle on a regular basis and I feel so bad troubling you with problems that may be lack of knowledge...

The fact is I used another approach. Since embedded images display fine, I tried making a library with the images embedded in it so I can import them in my reports and if I need to change an image I just have to edit one single library but the fact is that now the report is blank because I think birt can't find the library...

This is the path in my report:
        <structure>
            <property name="fileName">WebContent/Reports/bnmxLib.rptlibrary</property>
            <property name="namespace">bnmxLib</property>
        </structure>


As you can see, my original problem might be related since birt while constructing the PDF might have problems with relative paths.

I tried editing the resources path in config without any luck.

Any ideas on this? Might this be a bug?

Dan
Re: Problems with images from shared resources in PDF output [message #518710 is a reply to message #518696] Thu, 04 March 2010 19:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Dan,

Can you try to put the library in the same directory as the report and
change the xml snippet in the report to just bnmxlLib.rptlibary?

You should be able to set the resource folder and put them there as well.


In the previous test did this:
Data (id = 64): + A BIRT exception occurred: Error evaluating Javascript
expression. Script engine error: TypeError: Cannot call method
"lastIndexOf" of null (#1)
Script source: , line: 0, text:
fp =
reportContext.getHttpServletRequest().getSession().getServle tContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");
fp.substring( 0, lt) + "/WebContent/Images/logoBMX.jpg";. See next
exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError:
Cannot call method "lastIndexOf" of null (#1)
Script source: , line: 0, text:
fp =
reportContext.getHttpServletRequest().getSession().getServle tContext().getRealPath('/WebContent/images');
lt = fp.lastIndexOf("/");

Happen when you deployed to your app server?

I wonder if WL denies getRealPath()


this output

http://127.0.0.1:55360/viewer/WebContent/Images/logoBMX.jpg

Looks like you ran it in the designer (or the preview with webviewer).


Jason


ziploide wrote:
> Ok Jason...
>
> I know giving support for tons of people with problems with BIRT is way
> too much for someone to handle on a regular basis and I feel so bad
> troubling you with problems that may be lack of knowledge...
>
> The fact is I used another approach. Since embedded images display fine,
> I tried making a library with the images embedded in it so I can import
> them in my reports and if I need to change an image I just have to edit
> one single library but the fact is that now the report is blank because
> I think birt can't find the library...
>
> This is the path in my report:
>
> <structure>
> <property
> name="fileName">WebContent/Reports/bnmxLib.rptlibrary</property >
> <property name="namespace">bnmxLib</property>
> </structure>
>
>
> As you can see, my original problem might be related since birt while
> constructing the PDF might have problems with relative paths.
>
> I tried editing the resources path in config without any luck.
>
> Any ideas on this? Might this be a bug?
>
> Dan
Re: Problems with images from shared resources in PDF output [message #518728 is a reply to message #518603] Thu, 04 March 2010 20:21 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hi Jason

Quote:

Can you try to put the library in the same directory as the report and
change the xml snippet in the report to just bnmxlLib.rptlibary?

You should be able to set the resource folder and put them there as well.



Now when deployed I can see the embedded image in the library inserted in my report.


Quote:

Happen when you deployed to your app server?



Yes it did.

Quote:

I wonder if WL denies getRealPath()



It does. Only when deployed. When in workspace works just like Tomcat. That's why I use getResource and force the url to string...

I upgraded to BIRT 2.5.2 and the results are the same but now the message that appears where the "shared image" should, reads "The resource of this report item is not reachable." and the log shows:
Mar 4, 2010 2:13:09 PM org.eclipse.birt.report.engine.emitter.EmitterUtil getImage
SEVERE: null


As you pointed out the resources can't be found and I'm getting a lot of trouble trying to make them available.

Anything comes to your mind?

Dan
Re: Problems with images from shared resources in PDF output [message #518731 is a reply to message #518710] Thu, 04 March 2010 20:28 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Jason it's a fact...

I did the same with the image, copied it to the reports folder, edited the xml source to just read the name of the image (logoBMX.jpg instead of the path WebContent/Images/logoBMX.jpg) and it shows just fine in the PDF.

I can live with that but it really bothers me why I can't use a path to have a neat and organized resource folder...

Do you mind if we try to solve the path problem to reach the resources in a neat way?

Dan
Re: Problems with images from shared resources in PDF output [message #518760 is a reply to message #518731] Thu, 04 March 2010 22:34 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Dan,

Do you have a skype account?
Send me an email with it at jasonweathersby at windstream.net.

Jason

ziploide wrote:
> Jason it's a fact...
>
> I did the same with the image, copied it to the reports folder, edited
> the xml source to just read the name of the image (logoBMX.jpg instead
> of the path WebContent/Images/logoBMX.jpg) and it shows just fine in the
> PDF.
>
> I can live with that but it really bothers me why I can't use a path to
> have a neat and organized resource folder...
>
> Do you mind if we try to solve the path problem to reach the resources
> in a neat way?
>
> Dan
Re: Problems with images from shared resources in PDF output [message #518773 is a reply to message #518760] Thu, 04 March 2010 23:09 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

BTW I tried this on Tomcat and set my resource folder like:

config.setResourcePath(sc.getRealPath("/lib"));

where sc was the servlet context. I created a lib directory in my web
app put my image in it and it worked fine. This is not in the designer
but deployed.

Jason

Jason Weathersby wrote:
> Dan,
>
> Do you have a skype account?
> Send me an email with it at jasonweathersby at windstream.net.
>
> Jason
>
> ziploide wrote:
>> Jason it's a fact...
>>
>> I did the same with the image, copied it to the reports folder, edited
>> the xml source to just read the name of the image (logoBMX.jpg instead
>> of the path WebContent/Images/logoBMX.jpg) and it shows just fine in
>> the PDF.
>>
>> I can live with that but it really bothers me why I can't use a path
>> to have a neat and organized resource folder...
>>
>> Do you mind if we try to solve the path problem to reach the resources
>> in a neat way?
>>
>> Dan
Re: Problems with images from shared resources in PDF output [message #519405 is a reply to message #518773] Mon, 08 March 2010 17:55 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Hey Jason.

I'll try that in Tomcat first then take it to Weblogic. I guess that paths and contexts differ so much between application servers.

Thanks for your help. I'll keep you posted with that.

Dan.

PS: I sent you my Skype ID as you requested. I'll try not to bother you with it and keep the thread alive to help someone else with the same problems.
Re: Problems with images from shared resources in PDF output [message #519406 is a reply to message #518773] Mon, 08 March 2010 18:10 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Jason Weathersby wrote on Thu, 04 March 2010 18:09
BTW I tried this on Tomcat and set my resource folder like:

config.setResourcePath(sc.getRealPath("/lib"));

where sc was the servlet context. I created a lib directory in my web
app put my image in it and it worked fine. This is not in the designer
but deployed.

Jason



Could you post the string that translates this:
(sc.getRealPath("/lib")


Thanks man.
Re: Problems with images from shared resources in PDF output [message #519421 is a reply to message #518773] Mon, 08 March 2010 18:38 Go to previous messageGo to next message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
Jason no luck at all in any case.

When deployed the RealPath is:
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\WebReport\Images


And when executed from within Eclipse the RealPath is:
D:\PROJECTS\OPQ\Reports\ServletExample\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\WebReport\Images


Both paths lead to folders where the image exists...

Can't figure out what is wrong and why is it so difficult to point to a resource.... Where did you locate your lib folder? Can you post your real path?

Dan
Re: Problems with images from shared resources in PDF output [message #519457 is a reply to message #519421] Mon, 08 March 2010 21:18 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Dan,

I am not certain what is happening: In the report design the image
should just be the name, no path. In the preferences in the designer
you can set the resource folder to whatever you want. When deployed you
can set it with the code posted earlier. Mine looks like this when
deployed.

C:\apps\apache-tomcat-5.5.20\webapps\WebReport\lib

Jason

ziploide wrote:
> Jason no luck at all in any case.
>
> When deployed the RealPath is:
>
> C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\webapps\WebReport\Images
>
>
> And when executed from within Eclipse the RealPath is:
>
> D:\PROJECTS\OPQ\Reports\ServletExample\.metadata\.plugins\or g.eclipse.wst.server.core\tmp0\wtpwebapps\WebReport\Images
>
>
>
> Both paths lead to folders where the image exists...
>
> Can't figure out what is wrong and why is it so difficult to point to a
> resource.... Where did you locate your lib folder? Can you post your
> real path?
>
> Dan
icon14.gif  Re: Problems with images from shared resources in PDF output [message #519479 is a reply to message #517776] Mon, 08 March 2010 23:12 Go to previous message
ziploide  is currently offline ziploide Friend
Messages: 13
Registered: March 2010
Junior Member
The issue is solved. Jason help me out and I'm gonna post what we did so anyone can benefit from it Cool

First, set the resources path in Windows-> Preferences->Report Design-> Resource. There will be a button that reads "Workspace" and make it lead to the folder where you have your images. It should be a folder that once you deploy your WebApp in is at the top level of your WAR file.

I pointed that path to:
${workspace_loc:WebReport/WebContent/Images}


That's an expression that is automatically generated once you choose your resources (images) folder. I chose that since that Images folder is deployed at top level when the WAR is generated.

The next step is to tell your engine that you want that path as your resources path.

You do just that simply in a line:
config.setResourcePath( Formats.getPath("/Images", sc) );


Where config is an instance of "EngineConfig" and "Formats" is a class where I have a routine that successfully finds the path regardless of your App Server:
public static synchronized String getPath(String path, ServletContext sc) {
		String realPath = "";
		
		realPath = sc.getRealPath(path);
		
		if (realPath == null) {
			try {
				realPath = sc.getResource(path).getPath();
			} catch (MalformedURLException e) {
				e.printStackTrace();
			}
		}
		
		return realPath;
	}


That way I was able to display an image from a shared resource.

Note that your XML source of your report should have a reference to your image without anything before its name like the following:
        <image id="23">
            <property name="height">0.5625in</property>
            <property name="width">2.5416666666666665in</property>
            <property name="source">file</property>
            <expression name="uri" type="constant">logoBMX.jpg</expression>
        </image>


Hope you find this helpful as I did.

Best of regards,
Dan
Previous Topic:Using java with RCP BIRT
Next Topic:Hiding empty rows in a cross tab
Goto Forum:
  


Current Time: Thu Apr 25 03:46:08 GMT 2024

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

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

Back to the top