Skip to content

How we can change the default file creation path #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shinurag opened this issue Sep 12, 2024 · 6 comments
Closed

How we can change the default file creation path #479

shinurag opened this issue Sep 12, 2024 · 6 comments

Comments

@shinurag
Copy link

Could you please let me know how to change the temporary file creation location to a different folder path for the following line of execution?

jPrintFile = JasperFillManager.fillReport(jReport, params, jrbcds);
// jReport : JasperReport
// params: HashMap<String, Object> params = new HashMap<>();
// jrbcds: JRBeanCollectionDataSource

@teodord
Copy link
Collaborator

teodord commented Sep 13, 2024

Which temporary files are we talking about and why would their location be important to worth changing?

Thank you,
Teodor

@shinurag
Copy link
Author

shinurag commented Sep 17, 2024

I developed a JAR file for generating PDF files, but the process terminated at
jPrintFile = JasperFillManager.fillReport(jReport, params, jrbcds); While this JAR file functions correctly in the lower environment, it only works intermittently in production, where it often fails. To address this, we plan to change the file creation folder to determine if it resolves the issue.

@shinurag
Copy link
Author

@teodord : Can you see any issues in the log I've included below?

2024-09-25 15:39:47
Full thread dump OpenJDK 64-Bit Server VM (25.392-b08 mixed mode):

"Java2D Disposer" #15 daemon prio=10 os_prio=0 tid=0x00007f4ee419a000 nid=0x26af in Object.wait() [0x00007f4f09abb000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076ace8610> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
- locked <0x000000076ace8610> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at sun.java2d.Disposer.run(Disposer.java:148)
at java.lang.Thread.run(Thread.java:750)

Locked ownable synchronizers:
- None

"Attach Listener" #14 daemon prio=9 os_prio=0 tid=0x00007f4f14001000 nid=0xf2b6 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
- None

"pool-1-thread-1" #13 prio=5 os_prio=0 tid=0x00007f4f60663000 nid=0xf25c runnable [0x00007f4f3e78e000]
java.lang.Thread.State: RUNNABLE
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:259)
- locked <0x000000076ac24a50> (a java.util.zip.ZStreamRef)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at java.awt.Font.createFont0(Font.java:936)
at java.awt.Font.createFont(Font.java:877)
at net.sf.jasperreports.engine.fonts.SimpleFontFace.(SimpleFontFace.java:101)
at net.sf.jasperreports.engine.fonts.SimpleFontFace.(SimpleFontFace.java:129)
at net.sf.jasperreports.engine.fonts.SimpleFontFace.getInstance(SimpleFontFace.java:68)
at net.sf.jasperreports.engine.fonts.SimpleFontFamily.setItalic(SimpleFontFamily.java:115)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamily(SimpleFontExtensionHelper.java:269)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamilies(SimpleFontExtensionHelper.java:232)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:193)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:162)
at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:56)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)
at net.sf.jasperreports.engine.util.JRStyledTextParser.(JRStyledTextParser.java:83)
at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:121)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969)
at com.abc.def.extracts.InvGenExport.processFullTaxInvoice(InvGenExport.java:619)
at com.abc.def.extracts.InvGen.run(InvGen.java:143)
at java.lang.Thread.run(Thread.java:750)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

@dadza
Copy link
Collaborator

dadza commented Sep 25, 2024

What JasperReports version are you using?

@shinurag
Copy link
Author

@dadza JasperReport version is using 4.7.1

@dadza
Copy link
Collaborator

dadza commented Sep 26, 2024

You can change the Java temporary files folder by passing an argument like -Djava.io.tmpdir=/path/to/temp/folder when starting the Java process. Note that this will apply to other temporary files created by the Java process.

@dadza dadza closed this as completed Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants