Jump to content
Changes to the Jaspersoft community edition download ×

Exception thrown Printing on Mac OS X


2004 IR Help

Recommended Posts

By: ivory - leslie877

Exception thrown Printing on Mac OS X

2004-11-26 18:37

First of all, many thanks to Teodor Danciu for developing such a neat reporting tool and sharing it with the rest of us. Well Done. Terrific. I've been able to generate the reports without errors on both Windows and Linux. I'm currently having some difficulty printing on Mac OS X.

 

I'm attempting to print a report generated by JasperReports within the context of a Java Application running on Mac OS X Panther version 10.3.6. I generate the report within the application, it is then displayed in a Frame which extends from net.sf.jasperreports.view.JasperViewer. My reason for extending the class rather than using it directly has to do with removing the WindowListeners so that closing the frame where the report appears does not cause the application to terminate.

 

The save and print buttons which appear are very convenient. I attempt to print using the print button and I see the default Mac OS X print dialog appear. From there I select the page to print and then press "Print". But an error is generated as a result of doing this.

 

***** Begin Stack Trace *****

 

Exception in thread "Thread-1" javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found

at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:99)

at net.sf.jasperreports.engine.util.JRStyledTextParser.<init>(JRStyledTextParser.java:145)

at net.sf.jasperreports.engine.export.JRGraphics2DExporter.<init>(JRGraphics2DExporter.java:152)

at net.sf.jasperreports.engine.print.JRPrinterAWT.print(JRPrinterAWT.java:263)

JavaAWT: Assertion failure: Java exception thrown

JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 40

JavaAWT: Assertion failure: _javaException

JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 48

2004-11-26 18:17:44.689 java[994] PMSessionEndDocumentNoDialog failed (error code = -30879)

2004-11-26 18:17:44.690 java[994] *** -[NSAutoreleasePool dealloc]: Exception ignored while releasing an object in an autorelease pool: NSInternalInconsistencyException Failed to end PMPrintContext

 

***** End Stack Trace *****

 

I'm hoping that I can simply swap out one of the jar files for a Mac OS X specific jar, or perform some other minor configuration change to resolve this. My work around for the time being is to save the report to the hard drive as a PDF file, and then view and print the file inside the application Previewer, which is the default PDF viewer for Mac OS X. However, it would be convenient to print directly from the original Java App and skip this step.

 

I'm greatful for any assistance I receive for this matter. Thanks so much.

 

 

 

 

By: ivory - leslie877

RE: Exception thrown Printing on Mac OS X

2004-12-03 15:59

I discovered the following in the API about the FactoryConfigurationError which is seen in the stack trace..

 

-- Begin Copy

 

public class FactoryConfigurationError extends Error

 

Thrown when a problem with configuration with the Parser Factories exists. This error will typically be thrown when the class of a parser factory specified in the system properties cannot be found or instantiated.

 

-- End Copy

 

If anyone has had some success printing reports from JasperReports on Mac OS X I'd love to have any feedback. Thanks.

 

 

 

 

By: ivory - leslie877

RE: Exception thrown Printing on Mac OS X

2004-12-04 12:10

Got it.

 

I had been using a jar file "xerces.jar" which I had obtained somewhere, I can't remember, on the apache website. And as I had mentioned that was working fine on Windows and Linux, where the jre directly from Sun is used. On Mac OS X however the presence of the jar was creating problems. Indeed, the jar is not needed with a 1.4.2 jre on Mac OS X. The only jar files relevant to JR on the classpath are the four commmons jars (logging, beanutils, collections, digester), the itext jar and the jasperreports jar itself. After removing xerces.jar and any references to it from the classpath, I'm printing the reports predictably.

 

Cool.

 

 

 

 

By: ivory - leslie877

RE: Exception thrown Printing on Mac OS X

2004-12-02 15:55

Bumping it up. I'd like to resolve this and avoid producing hard files for each report generated in the life of the application.

 

I've upgraded the Java version on my Mac to 1.4.2. "java -version" now yields..

 

java version "1.4.2_05"

Java 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.3)

Java HotSpot Client VM (build 1.4.2-38, mixed mode)

 

I'm currently using the most current build of Jasper Reports available as of this posting, so the jar file on my classpath is "jasperreports-0.6.3.jar".

 

I've obtained a different release of xerces from this site

http://www.apache.org/dist/xml/xerces-j/binaries/

I had already obtained the file "xerces.jar" which is included on the classpath. I tried to include the file "xercesImpl.jar" from the download to the classpath as well but the error is similar. I think the only difference between "Thread-1" and "AWT-AppKit" is because I updated the JRE.

 

-- Begin Stack Trace

Exception in thread "AWT-AppKit" javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found

at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:99)

at net.sf.jasperreports.engine.util.JRStyledTextParser.<init>(JRStyledTextParser.java:145)

at net.sf.jasperreports.engine.export.JRGraphics2DExporter.<init>(JRGraphics2DExporter.java:146)

at net.sf.jasperreports.engine.print.JRPrinterAWT.print(JRPrinterAWT.java:263)

JavaAWT: Assertion failure: Java exception thrown

JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 40

JavaAWT: Assertion failure: _javaException

JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 48

2004-12-02 15:00:09.361 java[494] PMSessionEndDocumentNoDialog failed (error code = -30879)

2004-12-02 15:00:09.361 java[494] *** -[NSAutoreleasePool dealloc]: Exception ignored while releasing an object in an autorelease pool: NSInternalInconsistencyException Failed to end PMPrintContext

-- End Stack Trace

 

And in my code I do set the System property for the parser

 

System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");

 

Any help would be appreciated. Thanks in advance.

 

 

 

 

 

By: lorrdpsd - lorenson

RE: Exception thrown Printing on Mac OS X

2005-02-10 14:50

Did you ever figure this out??? I am getting the same error

 

 

 

 

By: John Pollard - johnnypoll

RE: Exception thrown Printing on Mac OS X

2005-02-15 02:18

Just to keep this alive, I also deploy Jasper to Mac as well as Windows. I use and need Xerces as part of my app for non-jasper reasons, so I don't have the option to hide away the Xerces jar(s). I see this error when printing on the Mac and currently have no workaround, will post if I find something.

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...