agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] Error trapping help
4+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] Error trapping help
@ 2006-09-25 15:29 
  2006-09-25 15:42 ` [Pljava-dev] Error trapping help 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2006-09-25 15:29 UTC (permalink / raw)

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.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] Error trapping help
  2006-09-25 15:29 [Pljava-dev] Error trapping help 
@ 2006-09-25 15:42 ` 
  2006-09-25 16:14   ` [Pljava-dev] Error trapping help 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2006-09-25 15:42 UTC (permalink / raw)

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
>   





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] Error trapping help
  2006-09-25 15:29 [Pljava-dev] Error trapping help 
  2006-09-25 15:42 ` [Pljava-dev] Error trapping help 
@ 2006-09-25 16:14   ` 
  2006-09-25 16:23     ` [Pljava-dev] Error trapping help 
  0 siblings, 1 reply; 4+ messages in thread

From:  @ 2006-09-25 16:14 UTC (permalink / raw)

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
>>   
>
>





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* [Pljava-dev] Error trapping help
  2006-09-25 15:29 [Pljava-dev] Error trapping help 
  2006-09-25 15:42 ` [Pljava-dev] Error trapping help 
  2006-09-25 16:14   ` [Pljava-dev] Error trapping help 
@ 2006-09-25 16:23     ` 
  0 siblings, 0 replies; 4+ messages in thread

From:  @ 2006-09-25 16:23 UTC (permalink / raw)

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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-09-25 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 15:29 [Pljava-dev] Error trapping help 
2006-09-25 15:42 ` 
2006-09-25 16:14   ` 
2006-09-25 16:23     ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox