Jump to content
Changes to the Jaspersoft community edition download ×

JasperReports compilation using wrong temp directory


max_10

Recommended Posts

Howdy

I'm using the JasperReports library version 4.5.1 in my Java application, and I'm trying to upgrade to version 4.6.0.

I am using the JasperReports ant task to build our *.jrxml files into *.jasper files at compile time. Here is the relevant excerpt from our build.xml file:

<target name="compile-report" depends="init">    <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpath="${javac.classpath}"/>    <mkdir dir="${build.classes.dir}/usda/weru/weps/reports"/>     <jrc tempdir="${build.classes.dir}/usda/weru/weps/reports"         compiler="usda.weru.weps.reports.compile.JRJavacCompiler"         destdir="${build.classes.dir}/usda/weru/weps/reports">        <src>            <fileset dir="${basedir}/reports">                <include name="**/*.jrxml"/>                               </fileset>        </src>        <classpath path="${run.classpath}"/>    </jrc>       <!--copy the styles into the classpath-->    <copy todir="${build.classes.dir}/usda/weru/weps/reports">        <fileset dir="${basedir}/reports">            <include name="**/*.jrtx"/>        </fileset>               </copy></target>[/code]

Note that we are using a custom implementation of the JRJavacCompiler, but it is not the problem.

Upgrading the library to 4.6.0 yields the following exception:

Error saving expressions class file : C:Program FilesNetBeans 8.0_harvestsdetail_1417022482708_967062.java

My question is this: Why is JasperReports trying to save anything in C:Program FilesNetBeans 8.0? I specify a temp directory in the ant task, why does it not use that location?

Here is the full text of the exception stack trace:

File : C:UsersmaxerdwienDocumentsNetbeans_srcbaselineweps.gui-maxreports_harvestsdetail.jrxml ... FAILED.
Error compiling report design : C:UsersmaxerdwienDocumentsNetbeans_srcbaselineweps.gui-maxreports_harvestsdetail.jrxml
net.sf.jasperreports.engine.JRException: Error saving expressions class file : C:Program FilesNetBeans 8.0_harvestsdetail_1417022482708_967062.java
    at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:153)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.getSourceFile(JRAbstractCompiler.java:310)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.createCompileUnit(JRAbstractCompiler.java:282)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:177)
    at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:496)
    at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:156)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:445)
    at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:138)
    at net.sf.jasperreports.ant.JRAntCompileTask.compile(JRAntCompileTask.java:402)
    at net.sf.jasperreports.ant.JRAntCompileTask.execute(JRAntCompileTask.java:249)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.io.FileNotFoundException: C:Program FilesNetBeans 8.0_harvestsdetail_1417022482708_967062.java (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at java.io.FileWriter.<init>(FileWriter.java:90)
    at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:145)
    ... 38 more

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...