I am trying to call a dynamic image in jasperserver 8.0.0, the problem is that it is working for jasperstudio 6.19 but when I upload it to the server it shows me an error (The error message is to contact the administrator :D)
<image>
<reportElement key="image-1" x="11" y="2" width="76" height="51" uuid="51d3ca8b- d083-4e86-9249-8fc9f7dbb1fa"/>
<imageExpression><![CDATA[$P{DIR} + $F{COD_EMPRESA}.toString()]]></imageExpression>
</image>
COD_EMPRESA returns a number for example 10, and that 10 is the image.
I found the solution by placing the images in a folder inside the server, since I worked locally and the folder was outside the server, in the image path I put the following code and it worked (the path points to the server and also works on jasperstudio)
"/images/"+ $F{COD_EMPRESA}.toString()
Related
I'll start by stating the context this question is based on: I'm running eXist-4.7.1 in a Tomcat container, and am trying to specify fonts in a configuration file for a PDF transformation using FOP (eXist-4.7.1 ships with FOP version 2.3).
The good news: it seems that some progress has been made since earlier reports on font configuration on the eXist-open mailing list (https://markmail.org/message/so43jgratswpu4dz), and I'm now able to load fonts via the http:// protocol. Here is a self-contained XQuery example (which can be stored in and run from the db):
xquery version "3.1";
import module namespace xslfo="http://exist-db.org/xquery/xslfo";
let $fo :=
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="my_page" margin="0.5in">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my_page">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="urbanist">Hello world!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
let $fop.config :=
<fop version="1.0">
<use-cache>false</use-cache>
<renderers>
<renderer mime="application/pdf">
<fonts>
<font kerning="yes" embed-url="https://github.com/coreywho/Urbanist/raw/master/fonts/static/Urbanist-Black.ttf">
<font-triplet name="urbanist" style="normal" weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
let $pdf := xslfo:render($fo, "application/pdf", (), ($fop.config))
return response:stream-binary($pdf, "application/pdf", "output.pdf")
The even better news: this is working without problems on my Windows box, where it produces a PDF document looking as follows (with the right font):
The bad news: when running the exact same XQuery example in exactly the same Tomcat setup on my Linux production server, the xslfo:render() call exits with an error:
<exception>
<path>/db/apps/test-fop-fonts/test-fop-fonts.xq</path>
<message>exerr:ERROR .fop (Permission denied) [at line 40, column 13]</message>
</exception>
Unfortunately, this is about everything that's being logged. Clearly, something is going wrong on the Linux box, but I have no clue what it could be. Apart from this glitch, eXist is operating perfectly in my Linux Tomcat, so I'm quite confident file permissions should be OK.
Has anyone else encountered this "permission denied" error?
Best,
Ron
Apparently, it turned out to be a lower-level OS problem: the problem disappeared when starting Tomcat as root user, after which eXist could happily create the PDF file.
After some more digging, it appeared that FOP caches files in home directory of the user running it, which was lacking for my non-privileged Tomcat user.... and that the problem could be fixed by just creating a home directory for this user, or providing the path to a writable folder for that user in the Tomcat startup script, e.g. -Duser.home=$CATALINA_TMPDIR!
If anyone else should bump into this, I've found the solution here: https://forum.xwiki.org/t/pdf-export-issue-with-file-permissions/4933/11. (phew!)
I have an image that is embedded in my report. Locally (via JasperReports Studio) everything works fine. I can export image in any format to any output format and everything is in order.
However, when I deploy my report on JRS (with image) I'm getting something like this
, when image is in bmp format.
When I convert image to png or jpg and then I deploy it on the JRS I am getting the following error:
ERROR EngineServiceImpl,pool-5-thread-179:598 - Error while exporting report to PDF
net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array
is not a recognized imageformat.
Any clues?
EDIT:
I use JasperStudio, here's the configuration of img element:
<image>
<reportElement x="200" y="50" width="120" height="111" uuid="03e9bde6-8ddd-4b0e-b3c7-8d44b4d71ff9"/>
<imageExpression><![CDATA["Images/hidden_logo.png"]]></imageExpression>
</image>
In my local machine i can download the report successfully. When I copy the jaspers and jrxml file to my production server it is showing this error. Please suggest me.
net.sf.jasperreports.engine.JRException: Could not load object from location : D:\Ravi Workspace\Openbrm\open-brm-openbrm-2.0\resources\designs\ageing-esr-40-srpski-subreport.jasper
In My report I have defined like this and all my jasper files are in the same folder.
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["D:\\Ravi Workspace\\Openbrm\\open-brm-openbrm-2.0\\resources\\designs\\"]]></defaultValueExpression>
</parameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{invoiceInfoList})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "ageing-esr-40-srpski-subreport.jasper"]]></subreportExpression>
The path you are using is directly linked to your hard drive. The folder structure for the server will be different.
According to this answer https://stackoverflow.com/a/3387463/5191221 there is no way to use relative paths for the subreport.
So you could either set the path to the exact server path where the subreport lies (I would avoid that at all costs).
Or you could put the subreport into the same folder like the main report and just call it directly:
<subreportExpression><![CDATA["ageing-esr-40-srpski-subreport.jasper"]]></subreportExpression>
When I use Coldfusion 10, locally, I can read a zip file's text file content using:
<cfzip action="read" file="http://someurl.com/somezip.zip" entrypath="sometext.txt" variable="somevar" />
But on my Railo VPS, this produces an internal server error 500 on IIS7.5
Can anyone tell me where I am going wrong with Railo?
Not sure about Railo, but according to the <cfzip> doc, ACF does not support reading off http://, only ram://. You should use <cfhttp> to download the content first.
I'm working on Java Database Connectivity through Eclipse IDE. I built a database through Ubuntu Terminal, and I need to connect and work with it. However, when I just add "mysql-connector-java-5.0.8-bin.jar" to the project library, I don't get the project output, but the following output is showed, anybody knows what this is and how I can get the output from my project ?
<ConnectionProperties>
<PropertyCategory name="Connection/Authentication">
<Property name="user" required="No" default="" sortOrder="-2147483647" since="all">
The user to connect as
</Property>
<Property name="password" required="No" default="" sortOrder="-2147483646" since="all">
The password to use when connecting
</Property>
<Property name="socketFactory" required="No" default="com.mysql.jdbc.StandardSocketFactory" sortOrder="4" since="3.0.3">
The name of the class that the driver should use for creating socket connections to the server. This class must implement the interface 'com.mysql.jdbc.SocketFactory' and have public no-args constructor.
</Property>
<Property name="connectTimeout" required="No" default="0" sortOrder="9" since="3.0.1">
Timeout for socket connect (in milliseconds), with 0 being no timeout. Only works on JDK-1.4 or newer. Defaults to '0'.
</Property>
...
Run your java file which tries to connect to MySQL through JDBC as a Application.
1)Right Click on java file
2)Go on run as
3) select java application.
It solved the problem for me.
Here is the process for installing the driver. You only need to follow these steps
once.
Make a directory, inside your cs home directory, called jdbc.
Copy the following file, available from the course website, to the directory
you just made: mysql-connector-java-3.0.6-stable-bin.jar.
Open the file .bashrc in your home directory with an editor such as
emacs. (Note that files whose names begin with . are ordinarily hidden
by default, so you may need to “show hidden files” to get to .bashrc.)
Add the following two lines the file .bashrc (anywhere in the file), changing ”username” to your own username:
MYSQLDRV="mysql-connector-java-3.0.6-stable-bin.jar"
export CLASSPATH="/home/username/jdbc/$MYSQLDRV:."
Save .bashrc.
Log out and log back in again, or, alternatively, type source .bashrc at a command prompt.
One other thing. You must inform your mySQL-connecting Eclipse projects
that you would like to use this driver. Do so by right-clicking the project in
question, choosing “Build Path — Add External Archives,” then navigating to
the aforementioned driver file. You will need to do this for every such Eclipse
project.