Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353335

Summary: PDF generation fails when using JRE6 64-bit for BIRT Runtime
Product: z_Archived Reporter: Jon Nazario <jnazario>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: bluesoldier, hustlg, wyan
Version: unspecified   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Jon Nazario CLA 2011-07-28 11:01:11 EDT
Build Identifier: RADO802-I20110302_1155

I am developing an application which needs the BIRT Runtime to generate PDF files.  Every time I tried generating the PDF file with the IRunAndRenderTask.run(), I get a pop-up window saying "There is no disk in the drive....".  This is not even catchable.  

While debugging I see the paths in traces to look like *Nix systems vs Windows.  At the end, I tried swapping from a 64-bit to a 32-bit JRE and that fix the problem.  I don't see anything that says that BIRT doesn't support 64-bit PDF generations so I think this is a bug.

For more information, I posted this in the forums but no reply:
http://www.birt-exchange.org/org/forum/index.php/topic/22959-pdfrenderoption-error-there-is-no-disk-in-the-drive/page__pid__80685__st__0&#entry80685


Below is bunch of logs that might help:

<<<<< Configuration >>>>>
- IBM RAD ver 8.0
- BIRT 3.7
- Using Windows 7 64-bit

<<<<< Call Stack >>>>>
- Why at RunAndRenderTask.doRun() ~Line: 180 calls HTMLReportLayoutEngine?
- Which then fails at:  HTMLReportLayoutEngine.layout(..) line 100?

HTMLReportLayoutEngine.layout(IReportExecutor, IReportContent, IContentEmitter, boolean) line: 100	
RunAndRenderTask.doRun() line: 180	
RunAndRenderTask.run() line: 77	
CreateReport.runReport() line: 69	
CreateReport.main(String[]) line: 26	


<<<<< My test code >>>>>

package test.was.reporting;

import java.util.logging.Level;

import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderOption;
import org.eclipse.core.internal.registry.RegistryProviderFactory;

public class CreateReport {

	public void runReport() throws BirtException 
	{
		IRunAndRenderTask task = null;
		IReportEngine engine = null;
		EngineConfig config = null;
		String path = "C:/dev/project/WasTest/WebContent/";
				
		// TODO:  Workaround for Windows 7
		Platform.shutdown();
		RegistryProviderFactory.releaseDefault();
		
		// Create Report Engine
		config = new EngineConfig();
		config.setLogConfig(path + "logs", Level.ALL);
		Platform.startup(config);

		IReportEngineFactory factory = 
			(IReportEngineFactory) Platform.createFactoryObject(
					IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
		engine = factory.createReportEngine(config);
					
		// Run reports
		IReportRunnable design = null;
		String designName = path + "reports/design/CurrentStocks.rptdesign";
		String pdfOutFilename = path + "reports/out/dailystocks.pdf";

		design = engine.openReportDesign(designName);
		task = engine.createRunAndRenderTask(design);	
		
		PDFRenderOption options = new PDFRenderOption();
		options.setOutputFileName(pdfOutFilename);
	    options.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
	    
	    task.setRenderOption(options);
	    task.run();
		task.close();

		engine.destroy();
		Platform.shutdown( );
	}	
}


Reproducible: Always

Steps to Reproduce:
1. Execute the code from the "Details" section using a 64-bit JRE6 under Windows 7 64-bit
Comment 1 Gang Liu CLA 2011-07-29 06:00:47 EDT
I'd tried it with birt3.7 runtime in windows 64bit JDK, it works.

I think the issue is that  "\Device\Hardisk1\DR9" is not available when rendering the PDF report.

I met a similar issue before, Operating system ask user to insert a disc into the cd-rom driver. it had been fixed, but I can not find the bug id now.
Report engine need search all fonts for PDF on the available device. when the device is actually not available but operating system think it available (unplug the device improperly?), this error may occurs.
Comment 2 Jon Nazario CLA 2011-07-29 09:37:55 EDT
If the issue is related to trying to read unavailable devices, how comes it works when I switch to 32-bit JRE?

How can I get a better trace?  by playing with the source code? or is there an easier way?
Comment 3 Gang Liu CLA 2011-07-31 22:26:33 EDT
Please find fontConfig.xml in package org.eclipse.birt.runtime, you should find the following seciton:
<font-paths>
		<path path="C:/windows/fonts" />
		<path path="d:/windows/fonts" />
		<path path="e:/windows/fonts" />
		<path path="f:/windows/fonts" />
		<path path="g:/windows/fonts" />
		<path path="C:/WINNT/fonts" />
		<path path="d:/WINNT/fonts" />
		<path path="e:/WINNT/fonts" />
		<path path="f:/WINNT/fonts" />
		<path path="g:/WINNT/fonts" />
		<path path="/usr/X/lib/X11/fonts/TrueType" />
		<path path="/usr/share/fonts/default/TrueType" />
		<path path="/usr/openwin/lib/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/euro_fonts/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_2/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_5/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_7/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_9/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_13/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/iso_8859_15/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ar/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/hi_IN.UTF-8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ja/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/ko/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/ru.ansi-1251/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/th_TH/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh_TW/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/zh_HK.BIG5HK/X11/fonts/TT" />
		<path path="/usr/openwin/lib/locale/zh_CN.GB18030/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh/X11/fonts/TrueType" />
		<path path="/usr/openwin/lib/locale/zh.GBK/X11/fonts/TrueType" />
		<path path="/usr/X11R6/lib/X11/fonts/TrueType" />
		<path path="/usr/X11R6/lib/X11/fonts/truetype" />
		<path path="/usr/X11R6/lib/X11/fonts/tt" />
		<path path="/usr/X11R6/lib/X11/fonts/TTF" />
		<path path="/usr/X11R6/lib/X11/fonts/OTF" />
		<path path="/usr/share/fonts/ja/TrueType" />
		<path path="/usr/share/fonts/truetype" />
		<path path="/usr/share/fonts/ko/TrueType" />
		<path path="/usr/share/fonts/zh_CN/TrueType" />
		<path path="/usr/share/fonts/zh_TW/TrueType" />
		<path path="/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" />
	</font-paths>

You can remove the path which is unavailable, and try again.

If you use birt allInOne, you should find it in plugin org.eclipse.birt.report.engine.fonts.
Comment 4 Jon Nazario CLA 2011-08-01 14:36:34 EDT
I am using the Runtime.  After inflating and changing the fontsConfig.xml to repackage I get errors loading the jar.

I used this cmd to make the jar:
jar cvfm org.eclipse.birt.runtime_test.jar META-INF/MANIFEST.MF .


Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
	at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:241)
	at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:196)
	at java.util.jar.JarVerifier.processEntry(JarVerifier.java:266)
	at java.util.jar.JarVerifier.update(JarVerifier.java:220)
	at java.util.jar.JarFile.initializeVerifier(JarFile.java:384)
	at java.util.jar.JarFile.getInputStream(JarFile.java:449)
	at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:924)
	at sun.misc.Resource.cachedInputStream(Resource.java:89)
	at sun.misc.Resource.getByteBuffer(Resource.java:172)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:502)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
	at java.net.URLClassLoader.access$300(URLClassLoader.java:79)
	at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1038)
	at java.security.AccessController.doPrivileged(AccessController.java:284)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:429)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
Comment 5 Gang Liu CLA 2011-08-02 03:58:52 EDT
I can not reproduce this error after re-packaging the jar with

jar cvfm org.eclipse.birt.runtime_test.jar META-INF/MANIFEST.MF .

You can try to use winzip to open the jar, and replace the file.

Can you reproduce this bug on other machine? 
 "\Device\Hardisk1\DR9" looks like a linux/Unix path instead of windows. BIRT only tries to visit the paths in fontconfig.xml
Comment 6 Gang Liu CLA 2011-08-02 04:13:26 EDT
 "There is no disk in drive. Please insert a disk into drive \Device\Hardisk1\DR9"

This error represents 
1. You have a removable drive, such as an Iomega Zip drive.
2. You do not have a removable disk in the removable disk drive.

Please refer to http://support.microsoft.com/kb/330137
Comment 7 Jon Nazario CLA 2011-08-02 09:16:20 EDT
I found the issue comes from having "Daemon Tools" virtual disk running.  Once I disable this application, the report generated without problems.

Regardless, the issue should be fixed or have a better log about the problem... 

Why let the engine try load something that you could check if exists before hand?

Thanks for you help too.
Comment 8 Wei Yan CLA 2011-08-02 12:51:55 EDT
The exception throw out even for file.exist(). I think the only solution is change the font configuration file.

for the security exception, it may caused by the JAR signature. You may remove the signature from the manifest file before repackage the jar.
Comment 9 Gang Liu CLA 2011-08-19 02:35:19 EDT
set to won't fix
Comment 10 Xiaoying Gu CLA 2011-08-19 02:41:56 EDT
wontfix