Lists: | pljava-dev |
---|
From: | scottpetersen at softhome(dot)net (Scott Petersen) |
---|---|
To: | |
Subject: | [Pljava-dev] Error trapping help |
Date: | 2006-09-25 15:29:56 |
Message-ID: | 4517F5F4.2020804@softhome.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
Folks,
I have loaded my Jasper report definition (.jrxml) into a postgresql
database as a text field. I can retrieve the record and convert it to
an InputStream. This is where the problem breaks down. When I pass the
InputStream to JRXmlLoader.load(is) to get a JasperDesign to then
continue on the compile and execution process I receive an error that I
have not been able to trap.
The following jar files are loaded:
commons-beanutils-1.5.jar
commons-collections-2.1.jar
commons-digester-1.7.jar
commons-logging-1.0.2.jar
itext-1.3.1.jar
jasperreports-1.2.6.jar
jdt-compiler-3.1.1.jar
pljava.jar
The following code snipet show what I am doing:
try
{
rs.next();
String reportSource = rs.getString("report_source");
InputStream is = fromString(rs.getString("report_source"));
// is.read(returnString, 0, is.available); -- read of
buffer works
try
{
jasperDesign = JRXmlLoader.load(is); <<<== dies on this line
}
catch (JRException e)
{
e.printStackTrace();
return "JRXmlLoader failure";
}
}
catch (SQLException se)
{
se.printStackTrace();
if (rs != null)
{
rs.close();
}
return "InputStream failure";
}
I was able to read the InputStream in a previous test. But when I add
the line that contains JRXmlLoader.load(is) the program returns the
following error:
psql:java_test:112: ERROR: java.lang.ExceptionInInitializerError
I have 2 issues. First how do I get past this issue? The second
problem is how can I get more information on what the problem is in
order to track it down.
Any and all help appreciated.
Scott.
From: | thomas at tada(dot)se (Thomas Hallgren) |
---|---|
To: | |
Subject: | [Pljava-dev] Error trapping help |
Date: | 2006-09-25 15:42:11 |
Message-ID: | 4517F8D3.1080404@tada.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
Hi Scott,
Try and catch the ExceptionInInitializerError and print the stack trace
of the exception that caused it. That will probably give you the
information you are looking for.
Regards,
Thomas Hallgren
Scott Petersen wrote:
> Folks,
>
> I have loaded my Jasper report definition (.jrxml) into a postgresql
> database as a text field. I can retrieve the record and convert it to
> an InputStream. This is where the problem breaks down. When I pass the
> InputStream to JRXmlLoader.load(is) to get a JasperDesign to then
> continue on the compile and execution process I receive an error that I
> have not been able to trap.
>
> The following jar files are loaded:
> commons-beanutils-1.5.jar
> commons-collections-2.1.jar
> commons-digester-1.7.jar
> commons-logging-1.0.2.jar
> itext-1.3.1.jar
> jasperreports-1.2.6.jar
> jdt-compiler-3.1.1.jar
> pljava.jar
>
> The following code snipet show what I am doing:
> try
> {
> rs.next();
> String reportSource = rs.getString("report_source");
> InputStream is = fromString(rs.getString("report_source"));
> // is.read(returnString, 0, is.available); -- read of
> buffer works
> try
> {
> jasperDesign = JRXmlLoader.load(is); <<<== dies on this line
> }
> catch (JRException e)
> {
> e.printStackTrace();
> return "JRXmlLoader failure";
> }
> }
> catch (SQLException se)
> {
> se.printStackTrace();
> if (rs != null)
> {
> rs.close();
> }
> return "InputStream failure";
> }
>
>
> I was able to read the InputStream in a previous test. But when I add
> the line that contains JRXmlLoader.load(is) the program returns the
> following error:
>
> psql:java_test:112: ERROR: java.lang.ExceptionInInitializerError
>
>
> I have 2 issues. First how do I get past this issue? The second
> problem is how can I get more information on what the problem is in
> order to track it down.
>
> Any and all help appreciated.
> Scott.
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>
From: | scottpetersen at softhome(dot)net (Scott Petersen) |
---|---|
To: | |
Subject: | [Pljava-dev] Error trapping help |
Date: | 2006-09-25 16:14:00 |
Message-ID: | 45180048.4040800@softhome.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
Thanks for the prompt reply Thomas. That really helped. I now get the
following stack trace:
java.lang.ExceptionInInitializerError
at
net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:151)
at
net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:831)
at
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:202)
at com.OpenERP.JasperReportsIntro.fubar(JasperReportsIntro.java:79)
Caused by: java.lang.SecurityException: read on C:\Program
Files\PostgreSQL\8.1\data\jasperreports.properties
at
org.postgresql.pljava.internal.Backend$1.assertPermission(Backend.java:176)
at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.nonRecursiveCheck(Backend.java:111)
at
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.checkPermission(Backend.java:89)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.exists(Unknown Source)
at java.io.Win32FileSystem.canonicalize(Unknown Source)
at java.io.File.getCanonicalPath(Unknown Source)
at java.io.FilePermission$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.FilePermission.init(Unknown Source)
at java.io.FilePermission.<init>(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.exists(Unknown Source)
at
net.sf.jasperreports.engine.util.JRLoader.getFileInputStream(JRLoader.java:499)
at
net.sf.jasperreports.engine.util.JRLoader.getLocationInputStream(JRLoader.java:471)
at
net.sf.jasperreports.engine.util.JRProperties.loadProperties(JRProperties.java:266)
at
net.sf.jasperreports.engine.util.JRProperties.initProperties(JRProperties.java:170)
at
net.sf.jasperreports.engine.util.JRProperties.<clinit>(JRProperties.java:156)
... 4 more
Any additional ideas would be appreciated.
Scott.
Thomas Hallgren wrote:
> Hi Scott,
> Try and catch the ExceptionInInitializerError and print the stack
> trace of the exception that caused it. That will probably give you the
> information you are looking for.
>
> Regards,
> Thomas Hallgren
>
> Scott Petersen wrote:
>> Folks,
>>
>> I have loaded my Jasper report definition (.jrxml) into a postgresql
>> database as a text field. I can retrieve the record and convert it
>> to an InputStream. This is where the problem breaks down. When I
>> pass the InputStream to JRXmlLoader.load(is) to get a JasperDesign
>> to then continue on the compile and execution process I receive an
>> error that I have not been able to trap.
>>
>> The following jar files are loaded:
>> commons-beanutils-1.5.jar
>> commons-collections-2.1.jar
>> commons-digester-1.7.jar
>> commons-logging-1.0.2.jar
>> itext-1.3.1.jar
>> jasperreports-1.2.6.jar
>> jdt-compiler-3.1.1.jar
>> pljava.jar
>>
>> The following code snipet show what I am doing:
>> try
>> {
>> rs.next();
>> String reportSource = rs.getString("report_source");
>> InputStream is = fromString(rs.getString("report_source"));
>> // is.read(returnString, 0, is.available); -- read of
>> buffer works
>> try
>> {
>> jasperDesign = JRXmlLoader.load(is); <<<== dies on this line
>> }
>> catch (JRException e)
>> {
>> e.printStackTrace();
>> return "JRXmlLoader failure";
>> }
>> }
>> catch (SQLException se)
>> {
>> se.printStackTrace();
>> if (rs != null)
>> {
>> rs.close();
>> }
>> return "InputStream failure";
>> }
>>
>> I was able to read the InputStream in a previous test. But when I
>> add the line that contains JRXmlLoader.load(is) the program returns
>> the following error:
>>
>> psql:java_test:112: ERROR: java.lang.ExceptionInInitializerError
>>
>>
>> I have 2 issues. First how do I get past this issue? The second
>> problem is how can I get more information on what the problem is in
>> order to track it down.
>>
>> Any and all help appreciated.
>> Scott.
>> _______________________________________________
>> Pljava-dev mailing list
>> Pljava-dev at gborg.postgresql.org
>> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>>
>
>
From: | thomas at tada(dot)se (Thomas Hallgren) |
---|---|
To: | |
Subject: | [Pljava-dev] Error trapping help |
Date: | 2006-09-25 16:23:19 |
Message-ID: | 45180277.3040200@tada.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
Scott Petersen wrote:
> Caused by: java.lang.SecurityException: read on C:\Program
> Files\PostgreSQL\8.1\data\jasperreports.properties
> at
>
Looks like your JRLoader attempts to read from your filesystem. That is
not permitted in a trusted function. In order to do that, you must use
LANGUAGE javaU in your CREATE FUNCTION so that you get the untrusted
language handler. A better solution is probably to provide the
jasperreport.properties in some other way, a resource in a jar that is
loaded or something. I don't know Jasper very well so I can't help you
there.
Regards,
Thomas Hallgren