I am receiving this error: Does anybody know how to fix
it
James
james@ninaza.com
"Resource Bundle not Found"
trace " at
java.util.ResourceBundle.getBundle(String baseName,
Locale inLocale)
at
org.apache.xerces.impl.msg.XMLMessageFormatter.for
matMessage(Locale locale, String key, Object[]
arguments) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\impl\msg\XMLMessageFormatter
.java:line 110
at
org.apache.xerces.impl.XMLErrorReporter.reportError
(XMLLocator location, String domain, String key, Object
[] arguments, Int16 severity) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\impl\XMLErrorReporter.java:line
324
at
org.apache.xerces.impl.XMLErrorReporter.reportError
(String domain, String key, Object[] arguments, Int16
severity) in C:\VSSBASE\RandD\ThirdParty\nfop\xerces-
2_0_2
\src\org\apache\xerces\impl\XMLErrorReporter.java:line
296
at
org.apache.xerces.impl.XMLScanner.reportFatalError
(String msgId, Object[] args) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\impl\XMLScanner.java:line 1269
at org.apache.xerces.impl.PrologDispatcher.dispatch
(Boolean complete) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\impl\XMLDocumentScannerImpl.j
ava:line 726
at
org.apache.xerces.impl.XMLDocumentFragmentScanner
Impl.scanDocument(Boolean complete) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\impl\XMLDocumentFragmentSca
nnerImpl.java:line 333
at org.apache.xerces.parsers.DTDConfiguration.parse
(Boolean complete) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\parsers\DTDConfiguration.java:lin
e 524
at org.apache.xerces.parsers.DTDConfiguration.parse
(XMLInputSource source) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\parsers\DTDConfiguration.java:lin
e 580
at org.apache.xerces.parsers.XMLParser.parse
(XMLInputSource inputSource) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\parsers\XMLParser.java:line 154
at
org.apache.xerces.parsers.AbstractSAXParser.parse
(InputSource inputSource) in
C:\VSSBASE\RandD\ThirdParty\nfop\xerces-2_0_2
\src\org\apache\xerces\parsers\AbstractSAXParser.java:
line 1169
at org.apache.fop.apps.Driver.render(XMLReader
parser, InputSource source) in
C:\VSSBASE\RandD\ThirdParty\nfop\apps\Driver.java:lin
e 504
at org.apache.fop.apps.Driver.run()" String
Logged In: YES
user_id=699785
The "Resource Bundle Not Found" error is an indirect
exception that occurs because of either a malformed or
missing FO input to the Driver constructor. After meticulous
and painful research, I discovered that the error is a result of
a missing XMLMessages.properties file in the
org.apache.xerces.impl.msg package. To resolve, the author
should simply embed the XMLMessages (and likely the
XMLSchemaMessages.properties) in the .dll. In VS.NET,
simply change the Build Action for these files to Embedded
Resource.
As I mentioned, the direct cause of this problem is an
incomplete or missing FO file passed to the Driver method.
Here is a working example of passing the FO content via a
file into the Driver:
============================================
// Create PDF file from FOP and launch displaying it. Inputs
include the
// names of the FO document (ie. MyReport.fo) and the PDF
file (MyReport.pdf)
private void showPdfFile(string fullFoDoc, string pdfFile)
{
// Create parameters to pass into NFOP Driver
class
InputSource source = new InputSource(new
java.io.FileInputStream(fullFoDoc));
ByteArrayOutputStream output = new
ByteArrayOutputStream();
try
{
// Render PDF into a byte array
Driver driver = new Driver(source,
output);
driver.setRenderer
(Driver.RENDER_PDF);
driver.run();
output.close();
int sz = output.buf.Length;
byte[] pdf = new byte[sz];
for (int i = 0; i < sz; i++)
{ pdf[i] = (byte)output.buf[i]; }
// Generate the PDF file from the byte
array
BinaryWriter binWriter =
new BinaryWriter
(System.IO.File.Open(pdfFile, FileMode.Create));
binWriter.Write(pdf);
binWriter.Flush();
binWriter.Close();
// Finally, launch process to run the
PDF file, likely in Acrobat Reader
System.Diagnostics.Process p = new
System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo
pi =
new
System.Diagnostics.ProcessStartInfo();
pi.FileName = pdfFile;
p.StartInfo = pi;
p.Start();
}
catch (java.util.MissingResourceException mre)
{
MessageBox.Show("The following error
has occurred: " + mre.Message + "\r\n" +
"\r\n" +
"ClassName = "
+ mre.getClassName() + "\r\n" +
"Key = " +
mre.getKey() + "\r\n" +
"Localized
Message = " + mre.getLocalizedMessage() +
"\r\n",
"Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch (java.io.IOException ioe)
{
MessageBox.Show("The following error
has occurred: " + ioe.Message + "\r\n" +
"\r\n" +
"InnerException
= " + ioe.InnerException.Message + "\r\n" +
"Source = " +
ioe.InnerException.Source + "\r\n" +
"Localized
Message = " + ioe.getLocalizedMessage() + "\r\n",
"Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch (FOPException fope)
{
MessageBox.Show("The following error
has occurred: " + fope.Message + "\r\n" +
"\r\n" +
"InnerException
= " + fope.InnerException.Message + "\r\n" +
"Source = " +
fope.InnerException.Source + "\r\n" +
"Root Exception
= " + fope.getRootException().getMessage() +
"\r\n",
"Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch(Exception ex)
{
MessageBox.Show("The following error
has occurred: " + ex.Message + "\r\n" +
"\r\n" +
ex.StackTrace,
"Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
============================================
==============================
I hope this helps to save someone the grueling hours it took
me to resolve this issue.
Mervin Williams