Free Support Forum - aspose.com

Input stream has been finalized or forced closed without being explicitly closed

@awais.hafeez

Hello,

I have also seen this issue in:

  • Aspose Cells
  • Aspose Slides
  • Aspose PDF
  • Aspose Mail
  • Aspose Imaging

The Payara Server is reporting: “Input stream has been finalized or forced closed without being explicitly closed;” while shutting the server down.

Thank you for fixing this issue for Aspose Words.

@Sascha_Lissek,

I am afraid, your question is not clear enough. Therefore we request you to please provide complete details of your usecase/problem. Please also ZIP and attach sample XLSX, PPTX, PDF and MSG files (you are getting this particular problem with) and piece of source code to reproduce the exact issue. We will then investigate the issue on our end and provide you more information.

@awais.hafeez

(I have the same problem with the above mentioned Librarys:

I only wanted to tell you that the same issue is in the other Librarys.) please see below.

For example:
In the mail library is the FileFormatUtil.detectFileFormat(“filename”). There the library creates an InputStream which will never be closed.

When i shutdown the server it reports:
Input stream has been finalized or forced closed without being explicitly closed; stream instantiation reported in following stack trace
java.lang.Throwable
at com.sun.enterprise.loader.ASURLClassLoader$SentinelInputStream.(ASURLClassLoader.java:1284)
at com.sun.enterprise.loader.ASURLClassLoader$InternalJarURLConnection.getInputStream(ASURLClassLoader.java:1392)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:238)
at com.sun.enterprise.loader.ASURLClassLoader.getResourceAsStream(ASURLClassLoader.java:936)
at java.lang.Class.getResourceAsStream(Class.java:2223)
at com.aspose.email.internal.ms.core.resources.ResourcesLoader.loadResource(Unknown Source)
at com.aspose.email.internal.hp.d.f(Unknown Source)
at com.aspose.email.internal.hp.d.c(Unknown Source)
at com.aspose.email.internal.m.j.(Unknown Source)
at com.aspose.email.internal.m.b.a(Unknown Source)
at com.aspose.email.internal.m.b.(Unknown Source)
at com.aspose.email.internal.m.b.a(Unknown Source)
at com.aspose.email.kl.a(SourceFile:359)
at com.aspose.email.kl.(SourceFile:27)
at com.aspose.email.gs.a(SourceFile:133)
at com.aspose.email.gs.a(SourceFile:216)
at com.aspose.email.aiy.e(SourceFile:505)
at com.aspose.email.wh.a(SourceFile:219)
at com.aspose.email.HeaderCollection.a(SourceFile:590)
at com.aspose.email.ajb.c(SourceFile:230)
at com.aspose.email.ajb.a(SourceFile:266)
at com.aspose.email.ajb.b(SourceFile:168)
at com.aspose.email.FileFormatUtil.d(SourceFile:215)
at com.aspose.email.FileFormatUtil.a(SourceFile:94)
at com.aspose.email.FileFormatUtil.detectFileFormat(SourceFile:123)

and:
Input stream has been finalized or forced closed without being explicitly closed; stream instantiation reported in following stack trace
java.lang.Throwable
at com.sun.enterprise.loader.ASURLClassLoader$SentinelInputStream.(ASURLClassLoader.java:1284)
at com.sun.enterprise.loader.ASURLClassLoader$InternalJarURLConnection.getInputStream(ASURLClassLoader.java:1392)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:238)
at com.sun.enterprise.loader.ASURLClassLoader.getResourceAsStream(ASURLClassLoader.java:936)
at java.lang.Class.getResourceAsStream(Class.java:2223)
at com.aspose.email.internal.t.a.a(Unknown Source)
at com.aspose.email.MhtSaveOptions.(SourceFile:146)

For the UnsatisfiedLinkError: My apology, this was only in the Aspose Word library.

If you need the stack trace for the other librarys, tell me and i will provide.

For now i can redeploy my App without problems (Only the not closed Streams) .

Thank you for your help.

@Sascha_Lissek

We tried to reproduce the issue with latest version of Aspsoe.Email for Java but it is working fine, we may have missed something. Can you please provide sample file along with steps to reproduce it.